Model Internals-based Answer Attribution for Trustworthy Retrieval-Augmented Generation

Jirui Qi, Gabriele Sarti, Raquel Fernández, Arianna Bisazza

Introduction

Retrieval-Augmented Generation (RAG) has become a cornerstone of modern Large Language Model (LLM) deployments, significantly reducing hallucinations by grounding model outputs in external knowledge. However, as RAG systems scale, a critical challenge remains: attribution. Determining which specific document—if any—actually informed a model's response is essential for user trust and system auditability.

Current attribution methods generally fall into two categories: Self-Citation, where the model is prompted to cite its sources, and NLI-based Attribution, where an external Natural Language Inference (NLI) model checks for entailment between documents and answers. Both suffer from significant flaws. Self-citation is prone to hallucinations and formatting errors, while NLI-based methods are "post-hoc," identifying what could support an answer rather than what the LLM actually used. This paper introduces MIRAGE (Model Internals-based RAG Explanations), a framework designed to provide faithful citations by analyzing the internal states of the model.

The MIRAGE Framework

MIRAGE moves beyond surface-level text analysis by examining how retrieved documents shift a model's token probabilities. The framework operates in a two-step process:

1. Context-sensitive Token Identification (CTI)

The first step determines which parts of a generated answer were influenced by the retrieved context versus the model's internal training data. MIRAGE calculates the Kullback-Leibler (KL) divergence between the token probability distributions generated with the context and without it. If a significant shift occurs, the token is flagged as "context-sensitive."

2. Contextual Cues Imputation (CCI)

For identified context-sensitive tokens, MIRAGE employs gradient-based saliency methods to "look back" at the input. By calculating the gradients of the output tokens with respect to the input document tokens, the system identifies which specific segments of the retrieved documents exerted the most influence on the model's decision. These granular, token-level connections are then aggregated to produce standard sentence-level citations.

Experimental Evaluation

The researchers evaluated MIRAGE across two distinct tasks to test its versatility and accuracy:

  • XOR-AttriQA: A multilingual dataset (covering Bengali, Finnish, Japanese, Russian, and Telugu) focused on concise, extractive question answering. This served as a benchmark for agreement with human-annotated citations.
  • ELI5 (Explain Like I'm Five): A dataset for long-form, open-ended English QA, testing the framework's ability to handle complex, multi-sentence responses where traditional self-citation often fails.

Key Insights: Faithfulness vs. Plausibility

A central contribution of MIRAGE is the distinction between faithfulness and plausibility. An NLI-based validator might confirm that a document supports a statement (plausibility), even if the LLM generated that statement based on memorized facts (ignoring the context). MIRAGE detects this discrepancy. By focusing on internal probability shifts, MIRAGE ensures that a citation is only generated if the document actually drove the model's reasoning process.

Furthermore, MIRAGE offers enhanced controllability. Unlike the "black box" nature of prompting for citations, MIRAGE allows developers to adjust attribution thresholds. This enables fine-tuning of how much influence a document must have before it is officially cited, providing a level of transparency unavailable in standard RAG pipelines.

Results and Performance

The empirical results demonstrate that MIRAGE significantly outperforms existing baselines:

  • Human Alignment: On the XOR-AttriQA dataset, the MIRAGE_CAL variant achieved an 86.7% average agreement with human annotators, outperforming standard NLI-based baselines.
  • Long-form Performance: In the ELI5 task using a Zephyr 7B model, MIRAGE achieved a citation quality F1 score of 45.6, a substantial improvement over the 30.6 achieved by the self-citation method.
  • Cross-lingual Robustness: Because it relies on the mathematical properties of token prediction rather than linguistic heuristics, MIRAGE maintains consistent performance across diverse languages without requiring specialized translation modules.

Limitations and Future Directions

While MIRAGE represents a significant step toward trustworthy RAG, it has limitations. Most notably, it requires access to model weights (gradients and logits), making it currently incompatible with closed-source APIs like GPT-4 or Claude 3. Additionally, gradient-based saliency can occasionally be noisy, sometimes highlighting non-semantic "stop words" rather than core content. Future work may involve exploring more sophisticated attribution methods, such as Integrated Gradients, and testing the framework on larger models and longer context windows.

Conclusion

MIRAGE provides a robust, "plug-and-play" solution for faithful attribution in RAG systems. By grounding citations in the model's internal decision-making process rather than post-hoc justifications, it offers a more reliable path toward building AI systems that users can verify and trust.

Summary updated

BibTeX
@inproceedings{qi2024model,
  author = {Jirui Qi and Gabriele Sarti and Raquel Fernández and Arianna Bisazza},
  title = {{Model Internals-based Answer Attribution for Trustworthy Retrieval-Augmented Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.347},
}
Figure