Seedlabs
Source research

RAGPart & RAGMask: Retrieval-Stage Defenses Against Corpus Poisoning in Retrieval-Augmented Generation

Pankayaraj Pathmanathan, Michael-Andrei Panaitescu-Liess, Cho-Yu Jason Chiang, Furong Huang · 2025 · 8 citationsRead the paper

Retrieval-Augmented Generation (RAG) has emerged as a promising paradigm to enhance large language models (LLMs) with external knowledge, reducing hallucinations and compensating for outdated information. However, recent studies have exposed a critical vulnerability in RAG pipelines corpus poisoning where adversaries inject malicious documents into the retrieval corpus to manipulate model outputs. In this work, we propose two complementary retrieval-stage defenses: RAGPart and RAGMask. Our defenses operate directly on the retriever, making them computationally lightweight and requiring no modification to the generation model. RAGPart leverages the inherent training dynamics of dense retrievers, exploiting document partitioning to mitigate the effect of poisoned points. In contrast, RAGMask identifies suspicious tokens based on significant similarity shifts under targeted token masking. Across two benchmarks, four poisoning strategies, and four state-of-the-art retrievers, our defenses consistently reduce attack success rates while preserving utility under benign conditions. We further introduce an interpretable attack to stress-test our defenses. Our findings highlight the potential and limitations of retrieval-stage defenses, providing practical insights for robust RAG deployments.

What the full text shows

Working prototype
  • RAGPart and RAGMask reduce attack success rates (ASR) across gradient-based and interpretable poisoning attacks while preserving utility (SR) under benign conditions. (Tested across 2 benchmarks (NQ, FIQA), 4 poisoning strategies, and 4 dense retrievers)
  • Perplexity-based and paraphrase-based defenses fail to defend against interpretable poisoning attacks (Query-as-Poison and AdvRAGgen). (Evaluated across 4 retrievers on NQ and FIQA datasets)
  • Intersection-based aggregation leads to a larger drop in utility (SR) compared to majority vote-based aggregation. (Tested on FiQA dataset for both Naive and RAGPart methods)
  • RAGPart remains robust under both intersection and majority vote aggregation strategies, unlike the naive combination baseline. (Tested on FiQA dataset)
  • RAGMask provides better utility preservation than RAGPart, but RAGPart is more computationally practical for resource-constrained scenarios. (Comparative analysis of the two proposed defenses)
Setup
Datasets: Natural Questions (NQ, 2.68M docs) and FIQA (57.6K docs). Retrievers: Contriever, ANCE, Multilingual E5, and GTE Large. Attacks: HotFlip, HotFlip (spread out), Query-as-Poison, and AdvBDGen.
How
The authors propose RAGPart, which partitions documents into N fragments, embeds them individually, and averages combinations of k fragments to diminish the influence of poisoned points. They also propose RAGMask, which identifies suspicious tokens by observing similarity shifts between the query and the document when specific tokens are masked.
Limitations
Cannot defend against adversarial documents that are semantically similar to the query (e.g., 'The capital of France is Berlin') because they cannot be classified as poison until generation occurs.

Summarized by Gemma 4 from the open-access full text · 12 Nov 2026. Read it