Information Flow Reveals When to Trust Language Models
Rui Xu (HKUST Guangzhou), Yi Chen, Jiujiu Chen, Sihong Xie
Overview
Modern AI agents increasingly rely on retrieval-augmented generation (RAG) to interface with external knowledge bases and ground their outputs in factual context. However, a persistent failure mode of RAG architectures is overconfidence in incorrect answers: even when the retrieved context is relevant, models frequently generate hallucinated or unfaithful responses while assigning them high internal confidence scores. Conventional uncertainty quantification (UQ) methods, which are typically designed for general factual question-answering, fail in RAG pipelines because they cannot verify whether the model is actually attending to the relevant context tokens or merely generating text from parametric memory.

Key moments
- 0:00 Introduction and motivation for RAG uncertainty quantification
- 2:00 Constructing information flow within model attention blocks
- 4:00 Auto-emergence algorithm for token ranking and principal flow
- 6:00 Information injectors and path contribution decomposition
- 8:00 Shapley decomposition for token-wise relevance estimation
- 10:00 Evaluation results and causal faithfulness validation
- 12:00 Audience Q&A on missing retrieval information and latency
Information Flow Reveals When to Trust Language Models
Speakers: Rui Xu (HKUST Guangzhou); Yi Chen; Jiujiu Chen; Sihong Xie
Conference: ICML
YouTube: https://slideslive.com/39083660
Overview
Modern AI agents increasingly rely on retrieval-augmented generation (RAG) to interface with external knowledge bases and ground their outputs in factual context. However, a persistent failure mode of RAG architectures is overconfidence in incorrect answers: even when the retrieved context is relevant, models frequently generate hallucinated or unfaithful responses while assigning them high internal confidence scores. Conventional uncertainty quantification (UQ) methods, which are typically designed for general factual question-answering, fail in RAG pipelines because they cannot verify whether the model is actually attending to the relevant context tokens or merely generating text from parametric memory.
This talk, presented by Rui Xu from HKUST Guangzhou at ICML, introduces a mechanistic approach to UQ for RAG systems by analyzing internal information flow across transformer layers. Rather than treating the model as a black box or relying solely on a single-layer snapshot of attention, the authors trace how individual tokens contribute to the final prediction across all attention blocks and residual connections. By quantifying both token contributions and semantic relevance, the proposed framework accurately identifies when language models should—and should not—be trusted.
The significance of this work spans both systems deployment and trustworthy machine learning. As enterprises race to deploy RAG agents for high-stakes domains like finance, legal, and healthcare, silent hallucinations present a critical bottleneck. By grounding UQ in the internal mechanics of information propagation rather than superficial output probabilities, this method provides robust protection against distribution shifts and delivers state-of-the-art performance on standard UQ metrics like AUROC and AUPRC.
Background
▶ Watch: Introduction and motivation for RAG uncertainty quantification (0:00)
Uncertainty quantification in deep learning has traditionally focused on output-space heuristics—such as token probability entropy, verbalized confidence scores, or ensemble agreement. While these techniques perform reasonably well in standard parametric settings, they degrade significantly in RAG workflows. In a RAG setup, the input sequence typically concatenates an instruction, a retrieved context, and a question. Language models can easily exhibit high output confidence while completely ignoring the retrieved context, relying instead on spurious correlations learned during pretraining.
Prior mechanistic interpretability research has attempted to characterize how tokens are processed within transformer models, but these efforts generally suffer from two major limitations. First, they typically inspect isolated snapshots (such as a single attention layer), thereby ignoring the cumulative processing dynamics across deep layer hierarchies. Second, existing methods struggle to systematically decompose the paths through which information travels from input context tokens to the final layer embedding of the last generated token.
This problem is particularly acute in systems engineering. When deploying LLMs behind API endpoints or agentic loops, infrastructure teams need low-latency, reliable signals to decide whether to trigger fallback mechanisms, request human intervention, or reject an ungrounded response. Without a principled way to measure context utilization, developers are forced to rely on heuristics that fail silently under distribution shifts.
Key Findings
▶ Watch: Auto-emergence algorithm for token ranking and principal flow (4:00)
The central discovery of this work is that tracking the fine-grained propagation of information across all transformer layers reveals whether a language model is actually reasoning over retrieved context or generating ungrounded outputs. By analyzing these internal pathways, the authors demonstrate several key findings:
- Mechanistic Faithful Tracking: Ablating the top five contribution-ranked tokens identified by the framework leads to a catastrophic drop in QA accuracy, proving that the method successfully captures the model's true reliance on context. Conversely, ablating bottom-ranked tokens yields negligible impact.
- Superior UQ Performance: When integrated into a lightweight calibrator, the measured contribution and relevance features consistently outperform baseline UQ methods across multiple models and datasets, achieving superior AUROC and AUPRC simultaneously.
- Robustness to Distribution Shifts: Because the approach is grounded in the internal mechanics of the transformer architecture rather than superficial dataset patterns, calibrators maintain stable performance when transferred across different datasets.
- Computational Feasibility: The flow-tracking and aggregation framework introduces a modest overhead of approximately 0.08 seconds per token, making it practical for real-time verification in production environments.
Technical Deep Dive
▶ Watch: Information injectors and path contribution decomposition (6:00)
The technical core of the framework revolves around constructing and analyzing the information flow within a transformer model. The prediction relies on the final layer embedding of the last input token (the target node), and the goal is to quantify how context tokens contribute to that embedding via connecting edges across all layers.
Step 1: Constructing the Contribution Matrix
To understand how input embeddings $X$ transform into output embeddings $Y$ within a single attention block, the authors define the attribution vector $A$ from token $X_j$ to $Y_i$. For a given layer, this attribution is determined by the residual connection (if $j = i$) and the output of the attention mechanism based on the projection matrices, attention weights, and value vectors.
The contribution of a token is measured by observing the change in $Y_i$ when the attribution vector $A$ is removed. This change is formalized using the Manhattan distance between $Y_i$ and its attribution-removed counterpart. Constructing this across all token pairs yields a lower-triangular contribution matrix $C$ for each layer, exploiting causal attention masks.
Step 2: The Auto-Emergence Algorithm
To scale beyond single-layer snapshots, the authors model tokens as information collectors within intermediate layers. A naive thresholding approach using a user-defined threshold $\tau$ introduces severe ambiguity: setting $\tau = 0.03$ might include all context tokens, while $\tau = 0.06$ includes only a few.
To eliminate this hyperparameter sensitivity, the authors design the auto-emergence algorithm. The algorithm starts from the final layer output of the last token and extracts its dominant self-contributions driven by strong residual connections. It creates a search pool of connected flows, iteratively selects the strongest flow, includes self-contributions from earlier layers, and assigns tokens a distinct rank. This produces a rank vector and isolates a principal information flow $P$, effectively highlighting decision-critical tokens (such as the topic word "pet" in a hotel policy context) without manual threshold tuning.
Step 3: Information Injectors and Path Decomposition
Alternatively, tokens can be viewed as information injectors that input information at the first layer and propagate it to the final prediction. To quantify this systematically without manually evaluating every exponential path in a deep network, the authors decompose and aggregate path strengths via matrix multiplication.
For an $L$-layer model, the total contribution matrix is computed as the product of layer-wise contribution matrices:
$$\mathbf{C}_{\text{total}} = \mathbf{C}_L \mathbf{C}_{L-1} \cdots \mathbf{C}_1$$
The entries of this product matrix measure the accumulated contribution from each source token at the input layer to the target token at the final layer. To avoid noise from weak paths, the authors similarly compute the contribution layout using the principal information flow matrices ($P_L$ through $P_1$).
Step 4: Relevance Estimation and UQ Calibration
Once the contribution layout is computed for the context segment across multiple generation rounds, the framework evaluates semantic relevance. It applies a ranker to assign a relevance score $R$ to the entire context given the question, and employs Shapley decomposition to derive a token-wise relevance layout.
Finally, uncertainty quantification is performed by combining two core signals:
- Rank-Biased Overlap (RBO): Measures the similarity between the contribution matrix and the relevance layout. Higher overlap correlates with higher response reliability.
- Concentration: Measures whether contributions are concentrated in a few tokens (indicating high model confidence) by normalizing the contribution layout and computing the KL divergence against a uniform distribution.
These features are fed into a lightweight calibrator to produce a calibrated confidence score for the RAG output.
Experimental Setup & Results
▶ Watch: Evaluation results and causal faithfulness validation (10:00)
The empirical evaluation encompasses rigorous benchmarking across multiple language models and datasets.
- Baselines & Evaluation Metrics: The method is evaluated against standard uncertainty quantification baselines across three distinct models and three datasets. Performance is measured using AUROC (Area Under the Receiver Operating Characteristic) and AUPRC (Area Under the Precision-Recall Curve).
- Headline Results: The proposed progressive information flow approach simultaneously achieves the highest AUROC and AUPRC across the evaluated benchmarks, demonstrating superior calibration compared to output-space confidence heuristics.
- Cross-Dataset Generalization: To test distribution shift robustness, calibrators trained on one dataset were evaluated on test sets from entirely different domains. The resulting performance remained stable, validating that the method relies on invariant structural mechanisms rather than surface-level patterns.
- Faithfulness Ablation: Ablating the top five contribution-ranked tokens on correctly predicted samples triggered a sharp drop in downstream accuracy, empirically confirming that the model's generations are mechanistically anchored to the identified context tokens.
Practical Implications
▶ Watch: Audience Q&A on missing retrieval information and latency (12:00)
For infrastructure teams, ML platform engineers, and model deployers, this work offers a principled path toward dependable RAG systems. Relying on verbalized confidence or token entropy leaves systems vulnerable to hallucination when retrieved context is ignored or misinterpreted.
- Inference Latency Tradeoff: The added latency of approximately 0.08 seconds per token provides a manageable overhead for high-value enterprise queries where correctness is paramount.
- Agentic Reliability: Autonomous AI agents that execute multi-step tool use and retrieval can leverage internal flow metrics as an automated guardrail, triggering secondary retrievals or human-in-the-loop escalations when context concentration drops.
- Model Agnosticism: Because the framework operates on attention weights, residual connections, and embedding representations, it can be retrofitted onto existing transformer architectures without retraining the underlying language model.
Key Takeaways
- Mechanistic UQ Outperforms Heuristics: Tracking information flow across all transformer layers provides a much stronger signal for RAG uncertainty quantification than output-space probability heuristics.
- Auto-Emergence Eliminates Thresholding: The proposed auto-emergence algorithm successfully ranks token importance without the hyperparameter sensitivity associated with static thresholding.
- Faithful Context Attribution: Matrix product decomposition and Shapley value attribution confirm that the model's predictions genuinely rely on the context tokens identified by the framework.
- Robustness to Distribution Shifts: Grounding uncertainty estimation in internal model mechanics ensures stable performance across different datasets and out-of-distribution contexts.
- Production-Viable Latency: With an overhead of roughly 0.08 seconds per token, the method is efficient enough for real-time deployment in latency-sensitive agentic workflows.
About the Speaker(s)
- Rui Xu (HKUST Guangzhou): Rui is from HKUST Guangzhou and is presenting work on information flow in language models and uncertainty quantification for retrieval-augmented generation systems.
Co-authors: Yi Chen, Jiujiu Chen, Sihong Xie.
Reviews
→ Top-rated talks at International Conference on Machine Learning 2026
All talks from International Conference on Machine Learning 2026