Towards More Robust Retrieval-Augmented Generation: Evaluating RAG Under Adversarial Poisoning Attacks

Jinyan Su, Jin Peng Zhou, Zhengxin Zhang, Preslav Nakov, Claire Cardie · OpenReview

Abstract

Retrieval-Augmented Generation (RAG) systems have emerged as a promising solution to mitigate LLM hallucinations and enhance their performance in knowledge-intensive domains. However, these systems are vulnerable to adversarial poisoning attacks, where malicious passages injected into retrieval databases can mislead the model into generating factually incorrect outputs. In this paper, we investigate both the retrieval and the generation components of RAG systems to understand how to enhance their robustness against such attacks. From the retrieval perspective, we analyze why and how the adversarial contexts are retrieved and assess how the quality of the retrieved passages impacts downstream generation. From a generation perspective, we evaluate whether LLMs' advanced critical thinking and internal knowledge capabilities can be leveraged to mitigate the impact of adversarial contexts, i.e., using skeptical prompting as a self-defense mechanism. Our experiments and findings provide actionable insights into designing safer and more resilient retrieval-augmented frameworks, paving the way for their reliable deployment in real-world applications.

Introduction

Retrieval-Augmented Generation (RAG) has become the industry standard for reducing LLM hallucinations by grounding responses in external, verifiable data. However, this reliance on external data creates a significant security vulnerability: the retrieval corpus. If an attacker can inject even a small amount of "poisoned" data into the database, they can manipulate the retriever to prioritize these false passages. This paper introduces a structured taxonomy to analyze these attacks and demonstrates that "skeptical prompting"—instructing models to critically evaluate retrieved content—can act as a powerful self-defense mechanism for advanced LLMs.

Methodology

The researchers conducted a rigorously controlled empirical study focusing on two phases:

  1. Retrieval Analysis: Testing how different retrievers (e.g., Contriever, DPR, ANCE) behave when a corpus is seeded with adversarial passages.
  2. Generation Analysis: Introducing a taxonomy of context types to evaluate their impact on LLM output:
  3. Adversarial: Specifically crafted to appear highly relevant while containing a target incorrect answer.
  4. Untouched: Standard, "clean" passages from the original dataset.
  5. Guiding: Factually correct passages crafted for high relevance to act as a "counter-poison."

The study utilized three gold-standard benchmarks: Natural Questions (NQ), HotpotQA, and MS-MARCO, each paired with massive knowledge bases.

Example of an adversarial poisoning attack where a crafted corpus achieves a higher similarity score than the original relevant corpus.

Key Insights and Results

The "Tailoring" Trap

Adversarial passages are not merely incorrect; they are "hyper-relevant." By being specifically written to answer a query incorrectly, they often achieve higher similarity scores than genuine documents, effectively "hijacking" the top spots in the retrieval ranking. As shown in Figure 1, an adversarial corpus can achieve a similarity score of 1.406 compared to 1.216 for the most relevant original corpus.

Intelligence as a Shield

A key finding is the "reasoning threshold" for defense. Advanced models like GPT-4o and Claude 3.5 Sonnet showed significant performance gains when using skeptical prompting. Unlike standard RAG prompts that instruct a model to "use the provided context," skeptical prompting explicitly tells the model to use its own judgment and internal knowledge if the retrieved context seems misleading.

Comparison of F1 scores across different LLMs on the NQ dataset under neutral and skeptical prompting.

As illustrated in Figure 2, for GPT-4o on the NQ dataset, skeptical prompting raised the F1 score from approximately 60% (neutral prompt) to 86% in the presence of adversarial data. However, less capable models (like GPT-3.5 or Llama-8B) often performed worse with skeptical prompts, likely due to a lack of internal knowledge or critical thinking skills to distinguish truth from well-crafted lies.

Defense Efficacy and Retriever Impact

  • Attack Success: In some configurations, adversarial contexts were successfully retrieved for over 97% of queries in HotpotQA.
  • Safety of Skepticism: Skeptical prompting significantly improved robustness against attacks without degrading performance on clean, "untouched" contexts.
  • Full-Stack Problem: The choice of retriever and prompt can cause the final F1 score to vary by more than 10% for the same LLM, highlighting that RAG robustness requires a holistic approach.

Conclusion

While skeptical prompting is a powerful tool, it is not a complete solution. Even with optimized defenses, RAG performance under attack often lags behind "Non-RAG" performance (where the model relies solely on internal knowledge). Future research should explore retriever-aware attacks, adaptive prompting systems that dynamically switch to a skeptical stance, and expanding this analysis to more complex tasks like long-form summarization.

Summary updated

BibTeX
@misc{su2024towards,
  author = {Jinyan Su and Jin Peng Zhou and Zhengxin Zhang and Preslav Nakov and Claire Cardie},
  title = {{Towards More Robust Retrieval-Augmented Generation: Evaluating RAG Under Adversarial Poisoning Attacks}},
  year = {2024},
  eprint = {2412.16708},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.16708},
}
Figure