Abstract
Retrieval-Augmented Generation (RAG) has become the industry standard for mitigating hallucinations in Large Language Models (LLMs) by providing external, relevant context. However, existing benchmarks often suffer from data contamination, as models may have memorized answers during pre-training, making it difficult to distinguish between genuine context utilization and parametric memory retrieval. We present ReEval, a novel framework that automatically generates adversarial "trick" contexts to stress-test the faithfulness of LLMs to provided evidence. By employing answer-swapping and context-enriching perturbations, we demonstrate that even state-of-the-art models like GPT-4 frequently default to internal memory when faced with conflicting external data. Our findings highlight a significant "memory over context" bias and demonstrate that adversarial examples are highly transferable across models, offering a cost-effective method for red-teaming RAG systems.
Introduction
The primary promise of Retrieval-Augmented Generation (RAG) is the "open-book" approach: a model should base its responses on specific, retrieved documents rather than its internal training data. This is crucial for applications involving private data, rapidly changing news, or specialized domains where a model's pre-training may be outdated or incorrect.
Despite its widespread adoption, current RAG benchmarks are often static. Because models are trained on massive datasets like Wikipedia, they frequently encounter the same information present in evaluation sets. This creates a data contamination problem: a model might provide the correct answer simply because it remembers it, not because it successfully "read" the retrieved document. If a model relies solely on memory, it will fail when the provided context contradicts its internal knowledge. ReEval addresses this by dynamically generating adversarial test cases that force a choice between provided context and internal memory.
Methodology: The ReEval Framework
ReEval utilizes a "pivot LLM" (such as ChatGPT) to generate adversarial contexts through a structured prompt-chaining process. The framework operates in three primary stages:
- Seed Case Selection: The system identifies questions that the target model can answer correctly when provided with the right text, but fails to answer correctly from memory alone. This ensures the evaluation specifically measures the model's ability to utilize external context.
- Evidence Perturbation: ReEval creates two distinct categories of adversarial attacks to challenge the model's reasoning:
- Category 1 (Answer Swapping): The pivot LLM identifies the correct answer within a text span and replaces it with a plausible but factually incorrect alternative (e.g., changing a historical date). This tests if the model will update its answer based on the new, albeit false, evidence.
- Category 2 (Context Enriching): The LLM adds relevant but potentially distracting information to the document while keeping the original answer intact. This evaluates whether the model gets "lost" in the noise or maintains its focus on the correct evidence.
- Cross-Model Evaluation: These perturbed documents are fed to various LLMs to determine if they follow the new evidence or hallucinate based on their original training.
Experimental Setup and Results
The researchers applied ReEval to two major open-domain Question Answering (QA) datasets: Natural Questions (NQ), consisting of real Google search queries, and RealtimeQA, which contains questions about current events unlikely to be in a model's static training set. Over 5,700 adversarial test cases were generated across five major models: Alpaca-7B, ChatGPT (GPT-3.5), Claude 2, PaLM, and GPT-4.
Key Findings
- The "Memory Over Context" Trap: A significant bias was observed where LLMs default to their pre-training knowledge when external text contradicts it. Even when explicitly told to use the provided text, models often failed to update their answers in Category 1 scenarios.
- Adversarial Transferability: One of the most striking results was that adversarial examples generated by smaller, open-source models (like Alpaca-7B) were highly effective at tricking much larger, proprietary models like GPT-4. This suggests that ReEval can serve as a highly cost-effective "red-teaming" tool for expensive, closed-source systems.
- Model Robustness: While larger models like GPT-4 showed more resilience than smaller counterparts, they were not immune. GPT-4 ignored context or hallucinated in approximately 15-20% of adversarial cases.
- Limitations of Prompting: Techniques like "Faithful Prompting" (instructing the model to only use provided text) yielded inconsistent results. While it helped models like PaLM, it occasionally decreased performance for others like ChatGPT, indicating that prompting alone cannot fully overcome deep-seated parametric memory.
Conclusion
ReEval exposes a critical vulnerability in current RAG systems: the tendency of LLMs to prioritize internal memory over provided context. By automating the generation of natural, semantically coherent adversarial attacks, ReEval provides a robust framework for evaluating and improving the faithfulness of retrieval-augmented models. Future research will focus on expanding this framework to address long-form answers and multi-hop reasoning challenges, where models must synthesize information from multiple documents.
Summary updated