Unveiling Knowledge Utilization Mechanisms in LLM-based Retrieval-Augmented Generation

Yuhao Wang, Ruiyang Ren, Yucheng Wang, Wayne Xin Zhao, Jing Liu, Hua Wu, Haifeng WangSIGIR 2025

Abstract

Retrieval-Augmented Generation (RAG) has become a cornerstone for enhancing Large Language Models (LLMs) with external knowledge. However, the internal mechanisms governing how models reconcile retrieved information with their internal parametric memory remain poorly understood. This paper investigates these processes through a multi-level analysis, identifying a four-stage "knowledge stream"—Refinement, Elicitation, Expression, and Contestation—and discovering specific neurons that control knowledge source prioritization. Our findings provide a roadmap for more interpretable and controllable RAG systems.

Introduction

While RAG is the industry standard for reducing hallucinations and providing LLMs with up-to-date information, the internal "mechanics" of how a model integrates this external data remain a black box. We know RAG works, but we don't fully understand how the model decides to prioritize a retrieved passage over its own parametric knowledge, especially when they conflict. This lack of interpretability makes it difficult to build RAG systems that are truly reliable and controllable. This research aims to demystify these internal mechanics by tracking information flow across layers and identifying the specific neural modules responsible for knowledge integration.

The Four Stages of Knowledge Utilization

The researchers hypothesize that knowledge utilization in RAG is not a single step but a structured four-stage progression across the model's layers:

  1. Refinement: The model comprehends and distills essential information from the external context.
  2. Elicitation: The refined context begins to shape the internal representation of the user's query.
  3. Expression: External knowledge starts to dominate the influence on the final answer generation.
  4. Contestation: A final "tug-of-war" occurs between internal and external knowledge to determine the output.
The four stages of the knowledge utilization process in RAG: Refinement, Elicitation, Expression, and Contestation.

Macroscopic Analysis: The Knowledge Stream

To track this process, the authors employed a macroscopic analytical approach, measuring "information flow" across Transformer layers in models like LLaMA-3 and Qwen-2.5. They used attention-based metrics to see how much "key" tokens (potential answers) pay attention to the context, query, and answer prompt, alongside saliency-based flow using gradients to identify which input tokens most heavily influence final predictions.

Information flow ($IF_a$) across layers for LLaMA-3 models under Gold and Fake passage conditions, illustrating the shift from context comprehension to answer expression.

As shown in the layer-wise analysis, the model transitions from focusing on the context ($IF^{KC}$) in early layers to expressing the answer ($IF^{KA}$) in later layers. A key finding is that the model performs "relevance discrimination" early, during the Elicitation stage. If a passage is deemed irrelevant, the knowledge stream effectively "shuts down" before reaching the expression stage. Furthermore, Logit Lens analysis revealed that Multi-Layer Perceptron (MLP) layers act as a "consistency check," being significantly more sensitive to the factual correctness of external knowledge than Multi-Head Attention (MHA) layers.

Microscopic Analysis: Knowledge-Specific Neurons

Beyond layer-wise trends, the study identifies specific "knowledge-specific neurons" using a novel metric called Knowledge Activation Probability Entropy (KAPE). By calculating the entropy of neuron activations across internal versus external knowledge tasks, the researchers identified neurons that specialize in one source.

This discovery allows for "controllable knowledge" through neuron deactivation. In LLaMA-3-8B, deactivating "External Knowledge" (EK) neurons when provided with a gold document caused a significant drop in accuracy (Average F1 fell by ~11.36 points). Conversely, when the model was given "noisy" or irrelevant documents, deactivating those same EK neurons actually improved performance (Average F1 rose by +0.78), as it forced the model to rely on its correct internal knowledge instead of the distractor text.

Conclusion

This work provides a foundational understanding of the internal dynamics of RAG. By identifying the four stages of knowledge utilization and the specific neurons involved, it opens the door for developing more nuanced, controllable RAG architectures. Future work will explore these mechanisms in more complex scenarios, such as long-form reasoning, to create systems that can balance parametric and contextual knowledge dynamically.

Summary updated

BibTeX
@inproceedings{wang2025unveiling,
  author = {Yuhao Wang and Ruiyang Ren and Yucheng Wang and Wayne Xin Zhao and Jing Liu and Hua Wu and Haifeng Wang},
  title = {{Unveiling Knowledge Utilization Mechanisms in LLM-based Retrieval-Augmented Generation}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2025},
}
Figure