Source Attribution in Retrieval-Augmented Generation

Ikhtiyor Nematov, Tarik Kalai, Elizaveta Kuzmenko, Gabriele Fugagnoli, Dimitris Sacharidis, Katja Hose, Tomer SagiarXiv 2025 · DOI

Abstract

Retrieval-Augmented Generation (RAG) has become a standard architecture for grounding Large Language Model (LLM) responses in external knowledge. However, identifying which specific retrieved documents are responsible for a generated answer remains a significant challenge. This paper evaluates game-theoretic attribution methods—specifically Shapley values—to identify a balance between high-accuracy source identification and the computational overhead of probing LLMs. We demonstrate that surrogate-based approximation methods like Kernel SHAP provide a viable path toward transparent RAG systems.

Introduction

While RAG systems significantly reduce hallucinations by providing models with relevant context, they often operate as a "black box." When an LLM generates a response based on a set of ten retrieved documents, it is often unclear which document provided the critical information. This lack of transparency is a hurdle for trust and verifiability in high-stakes domains like medicine or law.

Traditional feature attribution methods, particularly Shapley values, represent the gold standard for fair credit assignment in cooperative game theory. However, calculating exact Shapley values for $n$ documents requires $2^n$ model evaluations. For a standard RAG query involving 10 documents, this necessitates 1,024 expensive LLM calls, making exact calculation computationally prohibitive. This study investigates whether approximation methods can provide reliable source attribution efficiently.

Methodology

Defining Utility

The researchers define the utility of a document subset as the log-likelihood of the LLM generating the target response when conditioned on that specific subset. To calculate this efficiently, the study employs a "teacher-forcing" approach, measuring the probability the model assigns to ground-truth tokens given the context.

Attribution Strategies

The study compares several attribution strategies against the exact Shapley value baseline:

  • Leave-One-Out (LOO): A simple baseline measuring the drop in utility when a single document is removed from the full set.
  • Sampling-based (TMC-Shapley, Beta-Shapley): Methods that estimate values by evaluating random permutations or specific subset sizes.
  • Surrogate-based (Kernel SHAP, ContextCite): These methods treat the LLM as a black box and fit a weighted linear model to a small number of subset evaluations to approximate attribution scores.

Experimental Setup

Datasets

The evaluation utilizes two established RAG benchmarks and one novel synthetic dataset:

  1. BioAsq: A large-scale biomedical question-answering dataset.
  2. Natural Questions (NQ): General knowledge questions derived from Google Search queries.
  3. Synthetic Inter-document Dataset: A custom benchmark designed to isolate three specific document relationships:
  4. Redundancy: Multiple documents contain the same answer.
  5. Complementarity: Different documents hold separate pieces of a multi-part answer.
  6. Synergy (Multi-hop): Document A provides the necessary context to interpret Document B, which contains the final answer.

Key Insights

The Efficiency of Surrogates

Surrogate-based methods, specifically Kernel SHAP and ContextCite, emerged as the most effective approximations. These methods achieved a Pearson correlation of >0.95 with exact Shapley values using only 100 samples. This suggests that high-fidelity attribution is possible at a fraction of the cost of exhaustive computation.

Position and Direct Answer Biases

The study uncovered two significant biases in how LLMs utilize context:

  • Position Bias: In redundant scenarios, LLMs exhibit a "first-is-best" bias. Documents appearing earlier in the context window consistently received higher attribution scores, even when the content was identical to later documents.
  • Direct Answer Bias: In synergetic (multi-hop) scenarios, attribution methods struggle to credit "bridge" documents. The model disproportionately credits the document containing the final answer string while under-crediting the document that provided the logical framework required to reach that answer.

Model Scaling and Stability

Performance varied across models (Llama-3.2-8B, Mistral-7B, and Qwen-3B). Larger, more capable models like Llama-3.2-8B and Mistral-7B yielded more stable and interpretable attribution scores. This suggests that as models become better at utilizing provided context, their internal logic becomes more amenable to game-theoretic attribution.

Results and Discussion

Across all tested models, Kernel SHAP consistently outperformed sampling-based methods (TMC and Beta-Shapley). Most methods demonstrated high precision in identifying the single most important document, with Precision@1 scores generally exceeding 0.8.

However, a theoretical tension remains. Shapley values rely on the "additivity" axiom, which assumes the total utility is the sum of its parts. In RAG, documents interact in non-additive ways (e.g., synergy). Despite this mismatch, the results indicate that Shapley-based rankings are highly effective for identifying critical sources in practice.

Conclusion and Future Work

Current attribution methods are highly effective at identifying primary sources but remain limited by their inability to fully account for complex inter-document dependencies. Future research should focus on "interaction-aware" attribution methods that can distinguish between a document's independent utility and its utility when paired with others. Additionally, addressing the inherent position bias of LLMs is essential for achieving truly fair and objective source attribution in RAG systems.

Summary updated

BibTeX
@misc{nematov2025source,
  author = {Ikhtiyor Nematov and Tarik Kalai and Elizaveta Kuzmenko and Gabriele Fugagnoli and Dimitris Sacharidis and Katja Hose and Tomer Sagi},
  title = {{Source Attribution in Retrieval-Augmented Generation}},
  year = {2025},
  eprint = {2507.04480},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.04480},
}
Figure