Dehallucinating Parallel Context Extension for Retrieval-Augmented Generation

Zexiong Ma, Shengnan An, Zeqi Lin, Yanzhen Zou, Jian-Guang Lou, Bing Xie

TL;DR

Researchers have introduced DePaC (Dehallucinating Parallel Context Extension), a framework designed to stop Retrieval-Augmented Generation (RAG) systems from making things up or missing key details. By combining a specialized "refusal" training technique with a smarter way to aggregate information from multiple documents, DePaC significantly reduces hallucinations while offering much faster, linear-time inference compared to standard approaches.

What Problem Does This Paper Address?

Retrieval-Augmented Generation (RAG) is the standard way to ground Large Language Models (LLMs) in external facts. However, as the number of retrieved documents grows, two major issues emerge:

  1. Fact Fabrication: The model generates answers not supported by the context (hallucinations).
  2. Fact Omission: The model misses the right answer because it gets "distracted" by irrelevant documents during the aggregation process.

Existing "Parallel Context Extension" (PCE) methods try to handle many documents by processing them in parallel windows. But as shown in Figure 2, these methods often fail. If one document window is irrelevant, the model might confidently say "Unknown," and this "certainty" can drown out the correct answer found in a different document window during the final aggregation step.

Figure 2: Existing PCE approaches face two types of in-context hallucination issues when applied to RAG: (1) Fact fabrication. LLM generates fabricated answers that are inconsistent with the contextual facts. (2) Fact omission. The absence of required information in certain windows disproportionately influence the aggregation function, leading to disregard critical information in other windows.

Methods

The authors propose DePaC, which tackles these issues through two main components:

1. Context-aware Negative Training (NegTrain)

To fight fact fabrication, the authors fine-tune the LLM (specifically Mistral-7B) to be more honest. They create a dataset where the model is given a question and a document. If the document is relevant, it's trained to answer normally. If the document is irrelevant, it's explicitly trained to output a "rejection token" (like <UNK>). This teaches the model to "refuse" to hallucinate when the evidence isn't there.

2. Information-Calibrated Aggregation (ICA)

To fight fact omission, DePaC changes how it combines the outputs from different document windows. Standard methods often look for the "lowest uncertainty" (highest probability). However, a model can be very certain that it doesn't know the answer (high probability for "Unknown").

ICA instead measures Information Increment. It uses Kullback-Leibler (KL) divergence to compare the model's output distribution with a document to its distribution without that document. If a document significantly changes the model's prediction compared to the "base" question, it's considered high-information and prioritized.

Figure 3: DePaC consists of two key components: (1) a context-aware negative training technique to alleviate fact fabrication, and (2) an information-calibrated aggregation method to alleviate fact omission.

Datasets

The authors evaluated DePaC across nine diverse RAG tasks:

  • Information Seeking: FuncNR (Python function names), EntLR (Wikidata entity labels), MVIH (Multi-values Needle-in-a-Haystack), and APIBench (real-world API calls).
  • Document QA (DocQA): Qasper (academic papers), MultifieldQA (diverse long docs), and NarrativeQA (books/movie scripts).
  • Multi-hop QA: 2WikimQA and HotPotQA, which require synthesizing info across multiple documents.

Key Insights and Ideas

  • Linear vs. Quadratic Scaling: One of the biggest wins is efficiency. Standard LLM attention scales quadratically $O((kn)^2)$ with the number of documents $k$. Because DePaC processes documents in parallel windows, its complexity is linear $O(k \cdot n^2)$. This makes it much faster for long-context RAG.
  • Certainty is a Trap: Previous methods (like NBCE) failed because they assumed high confidence equals a correct answer. DePaC realizes that a model can be "confidently wrong" or "confidently ignorant." By measuring the change in information (KL divergence), DePaC identifies which documents actually help answer the question.
  • Parallelism is Key: DePaC allows the model to "switch" context windows mid-sentence, which is crucial for multi-hop questions where the answer is split across different files.

Key Results

  • Hallucination Reduction: DePaC drastically cut hallucinations. For example, in fact omission, it dropped the error rate from ~39% (Vanilla) to ~20%. In fact fabrication, it dropped from ~40% to ~12.7% (see Figure 1).
  • Performance Gains: On the APIBench task, DePaC achieved an average score of 45.1, nearly doubling the performance of the Vanilla baseline (24.1) and outperforming other PCE methods like NBCE (32.6).
  • Inference Speed: As shown in the complexity analysis, DePaC's execution time stays low even as context length explodes to 120k tokens, whereas vanilla inference time skyrockets.
Execution time comparison showing DePaC's linear scaling

Limitations and Future Work

  • Data Generation Cost: The authors relied on GPT-4-Turbo to generate the training data for NegTrain, which cost about $90 in API fees. They suggest future work could use cheaper models.
  • Training Overhead: While the training is a "one-time effort," it still requires fine-tuning a base model (Mistral-7B in this case), which might not be feasible for all users.
  • Model Inheritance: Since the training data came from GPT-4, the fine-tuned model might inherit some of GPT-4's inherent biases or safety behaviors.

Summary updated

BibTeX
@misc{ma2024dehallucinating,
  author = {Zexiong Ma and Shengnan An and Zeqi Lin and Yanzhen Zou and Jian-Guang Lou and Bing Xie},
  title = {{Dehallucinating Parallel Context Extension for Retrieval-Augmented Generation}},
  year = {2024},
  eprint = {2412.14905},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.14905},
}
Figure