TL;DR
Retrieval-Augmented Generation (RAG) keeps language models factual by letting them read an external library—until an attacker slips forged books onto the shelves. While existing RAG defenses expect attackers to use just one forgery style at a time, ShieldRAG treats every retrieved passage as an unverified tip rather than gospel truth. By cross-examining independent hypotheses with a second round of targeted searches and checking against its own memory, ShieldRAG neutralizes complex, blended poisoning attacks before they corrupt the final answer.
What Problem Does This Paper Address?
RAG systems curb hallucinations by retrieving top-$k$ relevant documents from an external corpus and handing them to a Large Language Model (LLM) as context. However, if that corpus is open or collaboratively maintained, attackers can execute corpus poisoning: injecting malicious documents crafted to both trick the dense retriever into fetching them and persuade the LLM to output an attacker-chosen falsehood.
Existing defenses usually clean the retrieved pile via semantic clustering, isolate-and-aggregate voting, or clever prompting. The catch? They assume a uniform attack. In reality, an adversary can mix and match strategies—combining retrieval-optimized perturbations (SentAttack), LLM-generated target passages (PoisonedRAG), and fabricated authority chains (One Shot Dominance).
As shown above, poisoned documents easily infiltrate the top-$k$ results and sit uncomfortably close to clean documents in embedding space (cosine similarity 0.5–0.9). When multiple attack types are blended (mixed poisoning), poisoned passages no longer cluster neatly together, overwhelming standard filters and majority-vote aggregators that rely solely on that initial, contaminated retrieval batch.
Methods
Instead of answering directly from the first batch of retrieved documents, ShieldRAG acts like an investigative journalist across three inference-time stages:
- Stage 1: Candidate Answer Generation. Dense retrievers look at semantic vibes, which attackers exploit. ShieldRAG first applies Retrieval Consistency Filtering using a length-normalized lexical score (BM25) with both a lower and upper threshold. Too little word overlap means irrelevant noise; abnormally high overlap flags keyword-stuffing or adversarial optimization. Each surviving document is then fed individually to the LLM to generate isolated candidate answers, preventing multiple poisoned docs from ganging up in a single prompt.
- Stage 2: Evidence Retrieval for Candidate Answers. Rather than trusting those candidates, ShieldRAG rewrites the original query paired with each candidate answer to launch diversified, perspective-specific searches. Crucially, it enforces Cross-Round Exclusion—banning the Stage 1 source documents from being retrieved again—and runs the lexical filter a second time.
- Stage 3: Evidence-Guided Answer Generation. The LLM sifts through the second-round documents to strip out unsupported or conflicting claims, building clean verification evidence. Separately, ShieldRAG prompts the LLM to write down what it already knows about the query from its parametric memory (internal knowledge). The final answer is synthesized using only the verified evidence and internal knowledge—deliberately leaving the raw Stage 1 candidates out of the final room.
Datasets
The authors evaluate on 100 test questions each from three standard QA benchmarks:
- Natural Questions (NQ) and MS-MARCO (open-domain QA).
- HotpotQA (multi-hop QA).
To test defenses against blended threats, the authors introduce a mixed-poisoning evaluation framework, where up to 5 poisoned documents per query are injected into the corpus, with each document's attack method independently sampled from PoisonedRAG, SentAttack, and One Shot Dominance.
Key Insights and Ideas
- Goldilocks lexical filtering catches adversarial tricks: Filtering out high lexical overlap is just as important as filtering out low overlap. Removing either threshold drops accuracy by 6–7 percentage points under heavy mixed poisoning because adversarial passages often over-optimize query terms.
- Use initial candidates as search compasses, not final witnesses: Including Stage 1 candidate answers in the final generation prompt actually hurts robustness (dropping NQ accuracy from 77% to 72% and nearly tripling attack success), because it reintroduces attacker-planted hypotheses into the final decision.
- Never let a suspect verify its own alibi: Without Cross-Round Exclusion, poisoned documents get re-retrieved 96% of the time during verification (up from 58%), causing accuracy on NQ to fall from 77% to 64%.
- Explicitly extracting internal knowledge matters: Simply telling an LLM to "use your own knowledge" fails when retrieved context looks authoritative. Generating a separate internal-knowledge passage first gives the model an anchor when external verification turns up empty or noisy.
Key Results
Evaluated across three generators (Mistral-Nemo-12B, Llama-3.1-8B, GPT-4o) and three dense retrievers (Contriever, Contriever-MS, ANCE), ShieldRAG consistently outperforms Vanilla RAG and four recent defenses (RobustRAG, InstructRAG, Astute RAG, TrustRAG).
- Single-Method Poisoning: With GPT-4o on NQ, Vanilla RAG’s Answer Accuracy (ACC) / Attack Success Rate (ASR) collapses to 5.0% / 95.0% under PoisonedRAG. ShieldRAG restores performance to 93.0% / 2.0%.
- Mixed Poisoning: With 5 mixed poisoned documents per query using Llama-3.1-8B, Vanilla RAG drops to 30.0% ACC / 64.0% ASR on NQ and 10.0% / 88.0% on HotpotQA. ShieldRAG achieves 77.0% / 5.0% on NQ and 57.0% / 14.0% on HotpotQA, beating the runner-up (TrustRAG) by 9–12 accuracy points while cutting attack success drastically.
- Adaptive Attacks: Even when a white-box attacker uses GPT-4o to iteratively rewrite poisoned passages to slip inside ShieldRAG's exact BM25 thresholds, ASR on HotpotQA only creeps up from 20.0% to 27.0% after 10 rewrite budgets, showing strong downstream resilience.
Limitations and Future Work
- Latency overhead: Thoroughness isn't free. ShieldRAG averages 9 LLM calls per query, running 4.6×–4.9× slower than Vanilla RAG (e.g., ~2.1s vs. ~0.43s per query on NQ with Llama-3.1-8B). Lightweight verifiers or adaptive budgets could trim this cost.
- Multi-document and multimodal blind spots: Because Stage 1 generates candidates from single documents in isolation, ShieldRAG may struggle when forming an initial hypothesis requires piecing clues together across long reasoning chains, or when dealing with tables and images.
- Coordinated adaptive attackers: While tested against filter-aware attackers, defending against adversaries who coordinate poison across both initial and verification queries—or optimize directly against final-answer feedback—remains an open frontier.
Summary updated