NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

From RAGs to rich parameters: Probing how language models utilize external knowledge over parametric information for factual queries

Hitesh Wadhwa, Rahul Seetharaman, Somyaa Aggarwal, Reshmi Ghosh, Samyadeep Basu, Soundararajan Srinivasan, Wenlong Zhao, Shreyas Chaudhari, Ehsan Aghazadeh

Abstract

Retrieval Augmented Generation (RAG) enriches the ability of language models to reason using external context to augment responses for a given user prompt. This approach has risen in popularity due to practical applications in search, question/answering, and chatbots. However, the exact nature of how this approach works isn't clearly understood. In this paper, we mechanistically examine the RAG pipeline to highlight that language models take a shortcut and have a strong bias towards utilizing only the context information to answer the question, while relying minimally on their parametric memory. We probe this mechanistic behavior in language models with: (i) Causal Mediation Analysis to show that the parametric memory is minimally utilized when answering a question and (ii) Attention Contributions and Knockouts to show that the last token residual stream does not get enriched from the subject token in the question, but gets enriched from other informative tokens in the context. We find this pronounced shortcut behavior true across both LLaMa and Phi family of models.

Introduction

Retrieval-Augmented Generation (RAG) has become the industry standard for reducing hallucinations and providing Large Language Models (LLMs) with up-to-date information. By "plugging in" external documents, developers help models answer questions they weren't originally trained on. However, the internal "tug-of-war" between what a model already knows (its parametric memory) and what it is told in the moment (the RAG context) remains poorly understood. This study explores whether models truly integrate these two sources of information or if they simply take the path of least resistance by ignoring their internal knowledge in favor of the provided context.

Methodology

To investigate this interaction, the researchers employed three mechanistic interpretability techniques on Llama-2 (7B) and Phi-2 (2.7B):

  1. Causal Tracing: This involves "corrupting" the input with noise and selectively "restoring" hidden states to identify which parts of the model are causally responsible for the correct answer.
  2. Attention Contribution: Measuring the norm of attention weights to determine which tokens the model prioritizes when generating the final answer.
  3. Attention Knockouts: Forcibly breaking connections between specific tokens (e.g., the subject of a question) and the final prediction to measure performance degradation.
Experimental setup for comparing attribute predictions with and without Retrieval-Augmented Generation (RAG).

The study utilized the Knowns Fact Dataset, consisting of 1,209 factual triples (Subject, Relation, Object). To simulate RAG, GPT-4 was used to generate synthetic contexts where the answer (the "attribute") appeared exactly once, ensuring the model's reliance on the context could be isolated from simple verbatim repetition of the query.

Mechanistic Insights: The "Shortcut" Behavior

The most striking finding is that LLMs exhibit a "shortcut" behavior when external context is available. They prioritize the provided text so heavily that their internal knowledge retrieval mechanisms—specifically the Multi-Layer Perceptron (MLP) layers—barely activate.

In a "vanilla" setting without RAG, the MLP layers act as the model's internal database. However, with RAG, the "Average Indirect Effect" (AIE) of these MLP layers drops significantly. The model essentially bypasses its internal "hard drive" to extract the answer directly from the prompt. This shift is accompanied by a change in information flow: without RAG, the model focuses on the subject token to look up facts; with RAG, it ignores the subject and focuses almost entirely on the attribute token found in the context.

Key Results

The quantitative data confirms a near-total shift in model behavior when RAG is introduced:

  • Causal Impact Drop: In Llama-2, the importance (AIE) of the last subject token plummeted from 0.2 to 0.0375 upon the introduction of RAG context.
  • Attention Dominance: For Phi-2, the attention contribution of the subject token in the query was 7 times lower in the RAG setting compared to the vanilla setting.
  • Knockout Resilience: When researchers "knocked out" the model's ability to attend to the subject of the question, the probability of the correct answer dropped by 60-95% in vanilla mode. With RAG, the same knockout caused a negligible drop of less than 5%, proving the model was simply "copy-pasting" from the context rather than using the question's subject to retrieve internal facts.
Causal Mediation Analysis showing the Average Indirect Effect (AIE) of MLP layers in Llama-2. The reduction in intensity in the RAG condition (left) compared to the vanilla condition (right) illustrates the model bypassing its internal parametric memory.

Conclusion and Future Work

This research highlights a fundamental characteristic of Transformer-based LLMs: a strong bias toward context over parametric memory. While this makes RAG effective for providing new information, it also suggests models are not "thinking" or cross-referencing their internal logic against the context.

Future work is needed to determine if this shortcut persists in much longer contexts (the "needle-in-a-haystack" scenario) or when faced with noisy and contradictory real-world data. Additionally, investigating whether instruction-tuning or RLHF can encourage models to be more skeptical or integrative of external information remains a critical next step for the field.

Summary updated

BibTeX
@inproceedings{wadhwa2026from,
  author = {Hitesh Wadhwa and Rahul Seetharaman and Somyaa Aggarwal and Reshmi Ghosh and Samyadeep Basu and Soundararajan Srinivasan and Wenlong Zhao and Shreyas Chaudhari and Ehsan Aghazadeh},
  title = {{From RAGs to rich parameters: Probing how language models utilize external knowledge over parametric information for factual queries}},
  booktitle = {WSDM Companion},
  year = {2026},
  doi = {10.1145/3779211.3793209},
}
Figure