Attention Sinks as Internal Signals for Hallucination Detection in Large Language Models
Organizations: Department of Artificial Intelligence, Wroclaw University of Science and Technology
Abstract
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.
Figures & tables
| Dataset | GSM8K | HaluEvalQA | NQ-Open | SQuADv2 | TriviaQA | TruthfulQA | UMWP | |
|---|---|---|---|---|---|---|---|---|
| LLM | Feature | |||||||
| Llama3.2-3B | AttnScore | 0.743 0.049 | 0.737 0.015 | 0.661 0.027 | 0.637 0.027 | 0.672 0.013 | 0.667 0.041 | 0.702 0.017 |
| AttnLogDet | 0.819 0.010 | 0.817 0.012 | 0.723 0.014 | 0.739 0.009 | 0.789 0.009 | 0.771 0.048 | 0.809 0.017 | |
| AttnEigval | 0.802 0.025 | 0.817 0.014 | 0.732 0.024 | 0.738 0.027 | 0.798 0.017 | 0.765 0.030 | 0.704 0.025 | |
| LapEigval | 0.825 0.009 | 0.837 0.011 | 0.736 0.012 | 0.753 0.014 | 0.824 0.017 | 0.748 0.047 | 0.720 0.010 | |
| LookbackLens | 0.835 0.017 | 0.836 0.009 | 0.743 0.020 | 0.765 0.008 | 0.811 0.015 | 0.741 0.072 | 0.749 0.020 |
| Total Features | Total Important | ||
|---|---|---|---|
| LLM | Dataset | ||
| Llama3.2-3B | GSM8K | 6720 | 38 (1%) |
| NQ-Open | 6720 | 204 (3%) | |
| TruthfulQA | 6720 | 58 (1%) | |
| UMWP | 6720 | 228 (3%) | |
| Mistral-Nemo | GSM8K | 12800 | 82 (1%) |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Split / Subset | # Examples | Source |
|---|---|---|---|
| NQ-Open ( Kwiatkowski et al., 2019 ) | Validation | 3,610 | huggingface |
| TriviaQA † ( Joshi et al., 2017 ) | Validation | 7,983 | huggingface |
| SQuADv2 † ( Rajpurkar et al., 2018 ) | Dev ( rc.nocontext ) | 9,960 | official website |
| HaluEvalQA ( Li et al., 2023 ) | QA | 10,000 | official repository |
| TruthfulQA ( Lin et al., 2022 ) | Generation | 817 | huggingface |
| GSM8k ( Cobbe et al., 2021 ) | Test | 1,319 | huggingface |
| LLM | HuggingFace Repository |
|---|---|
| Llama3.2-3B ( AI@Meta, 2024 ) | meta-llama/Llama-3.2-3B-Instruct |
| Llama3.1-8B ( AI@Meta, 2024 ) | meta-llama/Llama-3.1-8B-Instruct |
| Mistral-Nemo ( Mistral AI Team and NVIDIA, 2024 ) | mistralai/Mistral-Nemo-Instruct-2407 |
| Phi3.5 ( Abdin and others, 2024 ) | microsoft/Phi-3.5-mini-instruct |
| Dataset | LLM | #Invalid | #Valid Total | Valid Ratio | #Non-Hallucinated | #Hallucinated | Hallucination Ratio |
|---|---|---|---|---|---|---|---|
| TriviaQA | Llama3.1-8B | 368 | 9,592 | 0.96 | 6,423 | 3,169 | 0.33 |
| TriviaQA | Llama3.2-3B | 343 | 9,617 | 0.97 | 5,092 | 4,525 | 0.47 |
| TriviaQA | Mistral-Nemo | 31 | 9,929 | 1.00 | 6,599 | 3,330 | 0.34 |
| TriviaQA | Phi3.5 | 56 | 9,904 | 0.99 | 5,294 | 4,610 | 0.47 |
| NQ-Open | Llama3.1-8B | 731 | 2,879 | 0.80 | 1,056 | 1,823 | 0.63 |
| NQ-Open | Llama3.2-3B | 888 | 2,722 | 0.75 | 1,173 | 1,549 | 0.57 |
| Dataset | GSM8K | HaluEvalQA | NQ-Open | SQuADv2 | TriviaQA | TruthfulQA | UMWP | |
|---|---|---|---|---|---|---|---|---|
| LLM | Feature | |||||||
| Llama3.2-3B | AttnEigval | 100 | 100 | 100 | 100 | 100 | 50 | 100 |
| LapEigval | 100 | 100 | 100 | 100 | 100 | 100 | 50 | |
| SinkProbe | 100 | 50 | 100 | 25 | 100 | 50 | 100 | |
| Phi3.5 | AttnEigval | 100 | 50 | 100 | 100 | 100 | 100 | 100 |
| LapEigval | 10 | 50 | 100 | 100 | 100 | 100 | 100 |
LLM Hallucination Detection
Large language model hallucination detection identifies unsupported, incorrect, or fabricated claims in model outputs and traces.
See all 198 papers