TL;DR
Retrieval-Augmented Generation (RAG) often fails even when the correct evidence is successfully retrieved. By mapping internal LLM information flow into "attribution graphs," this paper reveals that correct answers rely on deep, question-guided routing, whereas failures stem from shallow, surface-level pattern matching. Leveraging these insights, the authors develop a graph-based error detector and an on-the-fly attention intervention that boosts RAG accuracy by 9%.
What Problem Does This Paper Address?
Retrieval-Augmented Generation (RAG) is the industry standard for grounding Large Language Models (LLMs) in external knowledge bases to reduce hallucinations. However, RAG systems remain frustratingly brittle: models frequently output incorrect answers even when the exact supporting evidence is present in the retrieved context.
Why does this happen? Traditional diagnostic methods treat the LLM as a black box, evaluating only inputs and outputs, or they look at static, single-layer hidden states. These approaches fail to capture the dynamic, multi-layer journey that information takes during decoding. This paper addresses this gap by peering inside the transformer's internal circuits to see exactly how retrieved evidence is propagated, transformed, and integrated across layers.
Methods
The authors introduce a graph-based framework to analyze the internal mechanics of RAG reasoning:
- Circuit Tracing & Attribution Graphs: The authors construct token-level directed attribution graphs $G=(V,E)$. Nodes represent token activations at specific layers, and edge weights quantify their causal contribution to the final predicted token (target logit).
- Linearization via Transcoders: To make the highly non-linear transformer math tractable, they replace MLP blocks with trained transcoders and fix attention patterns. This creates a locally linearized model where attributions can be cleanly decomposed and aggregated.
- Graph-Structural Error Detection: They train a 2-layer Graph Transformer Encoder on these attribution graphs to classify whether a model's internal reasoning structure points to a correct or incorrect answer.
- Layer-Wise Routing Control (Intervention): Instead of retraining the model or re-retrieving documents, they introduce forward hooks to dynamically alter attention weights during inference. This control amplifies question-focus in early layers, suppresses premature reliance on external context, and maintains question guidance in later decoding stages.
Datasets
The authors evaluate their approach across three standard multi-hop question-answering benchmarks where answering requires composing evidence across multiple passages:
- HotpotQA
- 2WikiMultihopQA
- MuSiQue
To test the model's resilience to noise, they introduce Mix-MuSiQue, a challenging mixed-context variant where each question is deliberately paired with a blend of both supporting and distracting (non-supporting) passages.
Key Insights and Ideas
- Structural Signatures of Truth: Correct answers leave a distinct topological footprint. Their attribution graphs feature deeper propagation paths, denser cross-token connectivity, and more distributed information flow. Conversely, incorrect answers are shallow, fragmented, and bottlenecked through a few dominant nodes.
- The Mid-Layer Sweet Spot: Correct predictions allocate significantly more attribution mass to the middle layers (layers 8–18), where the model synthesizes complex representations. Failed predictions spike in early layers, indicating a superficial, knee-jerk matching of text patterns without deeper integration.
- SAEG vs. QCEG: In mixed-context environments, failures follow a pattern the authors call Surface-Aligned Evidence Grounding (SAEG)—the model gets distracted by context that superficially resembles the question and loses its grip on the actual prompt constraints. Successes rely on Question-Constrained Evidence Grounding (QCEG), where the question continuously anchors and filters the evidence throughout the network.
Key Results
- Better Error Detection: The Graph Transformer detector outperformed standard logit-based self-evaluation (asking the model "Is this answer correct?") by 11.53% on average across all benchmarks, proving that internal structural coherence is a highly reliable signal for truthfulness.
- Inference-Time Boost: Applying the layer-wise attention intervention on the challenging Mix-MuSiQue dataset raised the baseline model's accuracy from 56.5% to 61.6% (a 9% relative improvement) without changing a single model weight or requiring retraining.
Limitations and Future Work
- Hyperparameter Tuning: The intervention scales ($\alpha_{QQ}, \alpha_{ctx}, \alpha_{QIn}$) are currently static hyperparameters that require manual tuning; developing dynamic or automated scaling methods would improve flexibility.
- Model Scale: The study focused primarily on 8B parameter models (LLaMA-3 and Qwen-3). Scaling these graph-circuit analyses to larger models (e.g., 70B+) remains an open challenge.
- Computational Overhead of Graph Construction: While the inference intervention itself is lightweight, constructing the initial attribution graphs requires transcoder passes, which adds computational complexity during the diagnostic phase.
Summary updated