Detecting Hallucination in LLMs: Tracing the Topological Signatures of Impaired Context Sharing
Authors: Amir Jalilifard, Anderson Rocha, Eric Wong, Marcos Medeiros Raimundo
Organizations: Institute of Computing, Universidade Estadual de Campinas (UNICAMP), Campinas, SP, Brazil · Department of Computer and Information Science, University of Pennsylvania, Philadelphia, PA, USA
In this work, we examine the topology of information flow patterns within attention graphs to effectively distinguish hallucinated from non-hallucinated responses. We analyze the Forman-Ricci curvature to identify structural patterns indicating information bottlenecks in attention graphs. We then introduce a method that captures both semi-local and global information-flow characteristics of attention heads associated with hallucinated responses. We evaluate our approach extensively across several LLMs and established benchmarks. Empirical results demonstrate that our proposed single-pass approach provides consistent improvements over existing attention-based and multi-response baselines across two hallucination-detection benchmarks, while achieving competitive performance across diverse LLM architectures. Further analysis reveals that impaired context sharing among tokens during causal generation is strongly associated with hallucination occurrences in LLMs. In particular, hallucinated responses are consistently characterized by an over-reliance on self-attention, diffused context retrieval from earlier tokens, or information over-squashing, especially in the final transformer layer.
Figures & tables
Fig. 1 : Information over-squashing occurs when information from many tokens is funneled through only a single token that bears the burden of representing all that context. However, this central token and its predecessors receive insufficient attention from subsequent tokens, preventing effective context sharing. In this example, all the information passes through token T4 , but later, due to high self-attention on T5 , a significant amount of information from earlier tokens is lost. The line thickness and its color show the amount of information flow from previous tokens to the subsequent ones.
Fig. 2 : The difference between the mean values of Forman-Ricci curvatures per head for hallucinated and not hallucinated responses for LlaMA. For the majority of the attention heads, hallucinated responses have lower curvature values, indicating a less fluid information flow.
Fig. 3 : P-values for the per-head comparisons of the 10th percentile outgoingness scores and attention entropy across all layers for LLaMA 3.1 8B Instruct.
Fig. 4 : Feature evolution across layers and comparison between hallucinated and non- hallucinated response for LLaMA 3.1 8B Instruct.
Fig. 5 : Mean per-head self-attention differences between hallucinated and non-hallucinated responses for Phi-4.
Temp
Benchmark
Model
AUC
LapEigvals
EigenScore
Ours - setting (a)
0.1
TruthfulQA
LLaMA 3.1 8B Instruct
80.52
83.79
85.34
0.1
TruthfulQA
Phi 4
78.43
81.62
81.75
0.1
TruthfulQA
Mistral 7B Instruct v0.3
78.80
81.69
80.00
0.1
TruthfulQA
Qwen3-32B
77.36
72.17
80.17
1.0
TruthfulQA
LLaMA 3.1 8B Instruct
78.26
80.22
80.73
TABLE I : AUC Comparison Between Laplacian eigenvalues, EigenScore, and our feature set classification results. Here we show the results for setting (a) which includes our base features. The best results however, were attained using setting (c).
Benchmark
Temp
Model
q10
+ q50
+ q90
+ att_entropy
TruthfulQA
0.1
LLaMA 3.1 8B Instruct
83.10
84.05
84.15
85.34
Phi 4
79.30
80.20
80.10
81.75
Mistral 7B Instruct v0.3
77.50
78.20
78.35
80.00
Qwen3-32B
78.00
78.85
78.90
80.17
1.0
LLaMA 3.1 8B Instruct
78.50
79.60
79.50
80.73
Phi 4
82.10
82.70
82.85
84.00
TABLE II : Cumulative Feature Ablation (AUC %) across TruthfulQA and NQOPEN datasets. Features are added sequentially.
Fig. 6 : Cumulative feature set effect for Llama 3.1 8B Instruct accross NQOPEN dataset.
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Fig. 7 : The difference between the mean values of Forman-Ricci curvatures per head for hallucinated and not hallucinated responses. For the majority of the attention heads, hallucinated responses have a lower curvature values which is an indication of a less fluid information flow. This pattern is more evident accross all layers in LLaMA and Mistral. For Phi and Qwen, the last layer presents less fluid context sharing for hallucinated responses.
Fig. 8 : The p-values of the differences between the mean values of Forman-Ricci curvatures per head for hallucinated and not hallucinated responses. The heads with statistical signiuficance are highlited with red lines.
Fig. 9 : P-values for the per-head comparisons of the 10th-percentile outgoingness scores and attention entropy across all layers. LLaMA 3.1 8B Instruct exhibits the strongest separation across the majority of attention heads.
Fig. 10 : Feature average evolution across layers and comparison between hallucinated and non-hallucinated responses. Both LLaMA 3.1 Instruct and Mistral 7B Instruct shows diffused attention whereas for Phi-4 shows little to no noticeable difference in outgoingness or attention distribution between the two response types. Also, for LLaMA 3.1 Instruct and Mistral 7B Instruct, the average of 10th percentile of the outgoingness score over attention heads is higher for hallucinated response in the terminal layers. The same pattern was observed for 50th and 90th percentiles.
Fig. 11 : Mean per-head self-attention differences between hallucinated and non-hallucinated responses across the evaluated models. Unlike LLaMA 3.1 8B Instruct and Mistral 7B Instruct, Phi-4 and Qwen3-32B exhibit higher self-attention for hallucinated responses across a large proportion of layers and attention heads.
Model
Accuracy
Gwet’s AC1
LLaMA 3.1 8B Instruct
0.92
0.86
Mistral 7B Instruct v0.3
0.88
0.76
Qwen3-32B
0.87
0.82
Phi-4
0.91
0.85
Appendix
TABLE IV : The performance of the LLM-as-judge across different models’ responses.
Hallucination detection is critical for ensuring the reliability of large language models (LLMs) in context-based generation. Prior work has explored intrinsic signals available during generation, among which attention offers a direct view of grounding behavior. However, existing approaches typically rely on coarse summaries that fail to capture fine-grained instabilities in attention. Inspired by signal processing, we introduce a frequency-aware perspective on attention by analyzing its variation during generation. We model attention distributions as discrete signals and extract high-frequency components that reflect rapid local changes in attention. Our analysis reveals that hallucinated tokens are associated with high-frequency attention energy, reflecting fragmented and unstable grounding behavior. Based on this insight, we develop a lightweight hallucination detector using high-frequency attention features. Experiments on the RAGTruth and HalluRAG benchmarks show that our approach achieves performance gains over verification-based, internal-representation-based, and attention-based methods across models and tasks.
Siya Qi, Yudong Chen, Runcong Zhao +6
Department of Informatics, King’s College London, UK · Department of Statistics, University of Warwick, UK · The Alan Turing Institute, UK +1
Large language models frequently exhibit hallucinations: fluent and confident outputs that are factually incorrect or unsupported by the input context. While recent hallucination detection methods have explored various features derived from attention maps, the underlying mechanisms they exploit remain poorly understood. In this work, we propose SinkProbe, a hallucination detection method grounded in the observation that hallucinations are deeply entangled with attention sinks - tokens that accumulate disproportionate attention mass during generation - indicating a transition from distributed, input-grounded attention to compressed, prior-dominated computation. Importantly, although sink scores are computed solely from attention maps, we find that the classifier preferentially relies on sinks whose associated value vectors have large norms. Moreover, we show that previous methods implicitly depend on attention sinks by establishing their mathematical relationship to sink scores. Our findings yield a novel hallucination detection method grounded in theory that produces state-of-the-art results across popular datasets and LLMs.
Jakub Binkowski, Kamil Adamczewski, Tomasz Kajdanowicz
Department of Artificial Intelligence, Wroclaw University of Science and Technology
Large Language Models (LLMs) frequently exhibit hallucinations, presenting a major barrier to reliability in complex reasoning tasks. While traditional detection methods rely on output-based confidence metrics, these logits are often miscalibrated by modern alignment techniques. In this paper, we investigate the temporal volatility of internal attention mechanisms as an alternative diagnostic signal for hallucination that does not depend on output calibration. By introducing an unsupervised metric for attention dispersion, we show that epistemic uncertainty leaves a measurable trace within intermediate layers, where spikes in attention entropy are associated with reasoning breakdowns. We evaluate our approach on mathematical reasoning benchmarks (GSM8K and MATH-500) using the Qwen2.5 model family (1.5B and 3B parameters), finding statistically significant AUC improvements of up to +0.076 over output-based baselines across all tested conditions. These findings suggest that attention dispersion is a promising complement to traditional hallucination detection methods, requiring further investigation across broader model families and task domains.
Shardul P. More, Tanuja S. Pawar
Rajarambapu Institute of Technology Ishwarpur, Maharashtra, India