Influence Guided Context Selection for Effective Retrieval-Augmented Generation

Jiale Deng, Yanyan Shen, Ziyuan Pei, Youmin Chen, Linpeng Huang

Retrieval-Augmented Generation (RAG) has become the standard architecture for grounding Large Language Models (LLMs) in external knowledge. By providing a model with relevant documents, developers can mitigate hallucinations and ensure responses are based on up-to-date information. However, the effectiveness of RAG is fundamentally limited by the quality of the retrieved context. Standard retrievers often return a mix of relevant facts, redundant information, and distracting noise.

This paper introduces Contextual Influence (CI), a novel metric designed to identify the most helpful documents for a generator by measuring their marginal contribution to performance. To make this practical for real-time applications, the authors develop the CI Surrogate Model (CSM), a lightweight selector that predicts these values at inference time, leading to significant improvements in both accuracy and efficiency.

The Challenges of Context Selection

Traditional RAG systems typically rely on "rerankers" that score documents based on their semantic similarity to a query. The authors identify three critical flaws in this approach:

  1. Redundancy: Rerankers often select multiple documents containing the same information. This wastes the LLM’s context window without adding new value.
  2. Generator Awareness: A document might be highly relevant to a query, but if the LLM already possesses that knowledge within its internal parameters, the document is superfluous.
  3. The Top-k Bottleneck: Most systems use a fixed "top-k" parameter (e.g., always retrieving the top 5 documents). However, the optimal number of documents varies significantly depending on the complexity of the question.

Quantifying Contextual Influence (CI)

The proposed solution treats context selection as an inference-time data valuation problem. The Contextual Influence (CI) value measures the "influence" of a specific document by calculating how much the generator's performance changes when that document is removed from the context—a "Leave-One-Out" (LOO) approach. A positive CI value indicates the document improves the answer, while a negative value suggests it acts as a distractor.

The CI Surrogate Model (CSM)

Since calculating exact CI values requires multiple LLM passes and access to ground-truth answers (which are unavailable at inference time), the authors propose the CSM. The CSM is a hierarchical model featuring:

  • Local Layer: A BERT-based component that analyzes query-document pairs.
  • Global Layer: A self-attention mechanism that evaluates how documents interact with one another within the retrieved set.

The CSM is trained using two primary strategies. Supervised Training (ST) uses "oracle" CI values from historical data, employing a data intervention strategy to help the model distinguish between subtle quality differences. End-to-End Training (E2E) allows the CSM to learn directly from the generator's output by passing gradients through the selection process using the Gumbel-Softmax trick.

Experimental Results

The researchers evaluated the CSM across eight knowledge-intensive tasks, including Open-Domain QA (NQ, TriviaQA), Multihop QA (HotpotQA), and Fact Checking (FEVER), using Llama3-8B and Qwen2.5-7B as backbones.

Performance and Efficiency

The CSM achieved a 15.03% average performance boost over state-of-the-art baselines. In Open-Domain QA tasks, the improvement reached as high as 21.72%. Beyond accuracy, the CSM proved highly efficient. For a list of 50 retrieved documents, the CSM reduced inference latency from 1437ms (using list-wise rerankers like RankGPT) to just 481ms on the NQ dataset.

The "Zero-Influence" Phenomenon

A key insight from the study is that approximately 80% of retrieved contexts have a CI value near zero. This confirms that the majority of data fed into standard RAG systems is "dead weight." By applying a simple selection rule—keep only documents with a CI value > 0—the system automatically adapts the context size to the specific needs of the query, eliminating the need for a fixed top-k parameter.

Conclusion

By shifting the focus from simple relevance to marginal influence, the authors provide a more robust framework for context selection in RAG. The CSM not only improves the accuracy of LLMs by filtering out noise and redundancy but also significantly reduces computational overhead. Future work aims to develop a "universal" context selector that can generalize across tasks without the need for specialized fine-tuning.

Summary updated

BibTeX
@inproceedings{deng2025influence,
  author = {Jiale Deng and Yanyan Shen and Ziyuan Pei and Youmin Chen and Linpeng Huang},
  title = {{Influence Guided Context Selection for Effective Retrieval-Augmented Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=ugaepulZyA},
}
Figure