RAGShield: Detecting Numerical Claim Manipulation in Government RAG Systems
Abstract
Retrieval-Augmented Generation (RAG) systems are deployed across federal agencies for citizen-facing tax guidance, benefits eligibility, and legal information, where a single incorrect number causes direct financial harm. This paper proves that all embedding-based RAG defenses share a fundamental blind spot: changing a tax deduction by $50,000 produces cosine similarity 0.9998, invisible to every known detection threshold. Across 174 manipulation pairs and two embedding models, the mean sensitivity gap is 1,459x. The blind spot is confirmed on real IRS documents.The root cause is that embeddings encode topic, not numerical precision. RAGShield sidesteps this by operating on extracted values directly: a pattern-based engine identifies dollar amounts and percentages in government text, links each value to its governing entity through two-pass context propagation (99.8% entity detection on 2,742 real IRS passages), and verifies every claim against a cross-source registry built from the corpus itself. A temporal tracker flags value changes that fall outside known government update schedules. On 430 attacks generated from real IRS document content, RAGShield detects every one (0.0% ASR, 95% CI [0%, 1%]) while embedding-based defenses miss 79-90% of the same attacks.
Figures & tables
| Attack | Venue | Key Result | Vector |
|---|---|---|---|
| PoisonedRAG [ 2 ] | USENIX’25 | 5 texts 90% ASR | Injection |
| Phantom [ 1 ] | NeurIPS’24 | 98.2% retrieval | Injection |
| CPA-RAG [ 8 ] | arXiv’25 | Black-box, fluent | Injection |
| CorruptRAG [ 9 ] | arXiv’25 | Single-doc attack | Injection |
| PhantomText [ 10 ] | arXiv’25 | 74.4% via hidden text | Loader |
| This paper | — | Numerical manip. | Insider |
| Embed-Level | Claim-Level | Temporal | Insider Det. | |
|---|---|---|---|---|
| RobustRAG [ 3 ] | ✓ | ✗ | ✗ | ✗ |
| TrustRAG [ 5 ] | ✓ | ✗ | ✗ | ✗ |
| RAGPart [ 6 ] | ✓ | ✗ | ✗ | ✗ |
| RAGDefender [ 4 ] | ✓ | ✗ | ✗ | ✗ |
| RAGForensics [ 7 ] | ✓ | ✗ | ✗ | Partial |
| RAGShield | ✓ | ✓ | ✓ | ✓ |
| Metric | MiniLM | BGE |
|---|---|---|
| Manipulation pairs tested | 174 | 174 |
| Mean cosine similarity | 0.9989 | 0.9979 |
| Max embedding perturbation | 0.0229 | 0.0243 |
| Mean sensitivity gap | 1,459 | 911 |
| Max numerical change | $50,000 | $50,000 |
| Detected at | 0/174 | 0/174 |
| Range | Count | Mean CosSim | Mean Perturb | Max Perturb |
|---|---|---|---|---|
| 54 | 0.9989 | 0.0011 | 0.0042 | |
| – | 31 | 0.9983 | 0.0017 | 0.0229 |
| – | 15 | 0.9990 | 0.0010 | 0.0025 |
| – | 34 | 0.9990 | 0.0010 | 0.0073 |
| – | 14 | 0.9993 | 0.0007 | 0.0020 |
| 26 | 0.9989 | 0.0011 | 0.0083 |
| Component | Library | Notes |
|---|---|---|
| Claim extraction | regex + two-pass NER | 120 entity, 16 attribute patterns |
| Claim registry | SQLite | Indexed by claim key |
| Temporal tracking | datetime + calendar | 4 agency schedules |
| Embeddings | sentence-transformers | all-MiniLM-L6-v2 (384-dim) |
| Provenance | PyNaCl (Ed25519) | Real signatures, not HMAC |
| Vector search | NumPy | Cosine similarity |
| Configuration | Patterns | Detection | Unknown |
|---|---|---|---|
| Base patterns, single-pass | 45 | 40.5% | 1,312 |
| + Filing/IRA/SS/adoption patterns | 75 | 85.4% | 323 |
| + Worksheet/railroad/misc patterns | 100 | 87.1% | 285 |
| + Two-pass resolution (fwd+bwd) | 100 | 98.5% | 34 |
| + Final catch-all patterns | 120 | 99.8% | 5 |
| Defense | T3-H | T6 | T-TEMP | Overall |
|---|---|---|---|---|
| No Defense | 100 | 100 | 100 | 100 [99,100] |
| Embed-only | 81.8 | 81.4 | 81.4 | 81.6 [79,83] |
| RAGShield | 0.0 | 0.0 | 0.0 | 0.0 [0,1] |
| Defense | Unblocked | Total Harm | Mean/Attack |
|---|---|---|---|
| No Defense | 430 | $243,309 | $566 |
| Embed-only | 351 | $213,739 | $609 |
| RAGShield | 0 | $0 | $0 |
| Defense | T3-H | T6 | T-TEMP | Overall |
|---|---|---|---|---|
| No Defense | 100 | 100 | 100 | 100 |
| RobustRAG † | 98.0 [93,99] | 100 [90,100] | 54.2 [39,69] | 88.0 [82,92] |
| TrustRAG † | 90.2 [82,95] | 84.0 [69,93] | 91.7 [79,97] | 89.0 [83,93] |
| RAGPart † | 100 [95,100] | 100 [90,100] | 58.3 [42,73] | 90.0 [84,94] |
| Embed-only | 96.1 [90,99] | 100 [90,100] | 20.8 [11,36] | 79.0 [72,85] |
| RAGShield | 0.0 [0,5] | 0.0 [0,10] | 0.0 [0,10] | 0.0 [0,3] |
| Defense | Unblocked | Total Harm | Mean/Attack |
|---|---|---|---|
| No Defense | 100 | $461,624 | $4,616 |
| RobustRAG † | 88 | $41,751 | $474 |
| TrustRAG † | 89 | $457,078 | $5,136 |
| RAGPart † | 90 | $453,655 | $5,041 |
| Embed-only | 79 | $38,309 | $485 |
| RAGShield | 0 | $0 | $0 |
| Configuration | ASR | Blocked | Harm |
|---|---|---|---|
| Full (embed + claim + temporal) | 0.0% | 100/100 | $0 |
| Claim verification only | 0.0% | 100/100 | $0 |
| Embedding only | 79.0% | 21/100 | $38,309 |
| Temporal only | 78.0% | 22/100 | $41,338 |
| No defense | 100.0% | 0/100 | $461,624 |
| Query Topic | Correct | Poisoned | No Def | v2 |
| Std. deduction (single) | $15,000 | $15,500 | ✗ | ✓ |
| SSI monthly rate | $943/mo | $993/mo | ✗ | ✓ |
| 401(k) limit | $23,500 | $24,500 | ✗ | ✓ |
| EITC max (3+ children) | $7,430 | $7,630 | ✗ | ✓ |
| Child tax credit | $2,000 | $2,100 | ✗ | ✓ |
| Medicare B premium | $185/mo | $195/mo | ✗ | ✗ ∗ |
| Format Type | Value | Entity |
| Table format (tab-separated) | ✓ | ✓ |
| Conditional claims (if/then) | ✓ | ✓ |
| Mixed non-claim numbers (phone, pub#) | ✓ | ✓ |
| Footnote markers near numbers | ✓ | ✓ |
| Historical comparison (2024 vs 2025) | ✓ | ✓ |
| Heavy abbreviations (SSI fed. benefit) | ✓ | ✓ |
| Strategy | Tests | Evasion | Type |
|---|---|---|---|
| E1: Unicode lookalike digits | 24 | 0.0% | Extract |
| E2: Spelled-out numbers | 3 | 100% | Extract |
| E3: Relative claims (“increased by”) | 24 | 0.0% | Extract |
| E4: Split across sentences | 24 | 0.0% | Extract |
| E5: Footnote override | 24 | 0.0% | Extract |
| E6: Percentage reframe (“103.3%”) | 16 | 100% | Extract |
| Pre-poison | Correct Src | Poisoned Src | Detection |
|---|---|---|---|
| 0% | 3 | 0 | 83.3% |
| 33% | 2 | 1 | 83.3% |
| 50% | 1 | 2 | 87.5% |
| 67% | 1 | 2 | 87.5% |
| 100% | 0 | 3 | 45.8% |
RAG Security
Retrieval-augmented generation security studies how to protect retrieval-based language systems from attacks, data leakage, and unsafe outputs.
See all 104 papers