Detecting Hallucinations in Large Language Models via Internal Attention Divergence Signals

Gijs van Dijk
5/6/2026
cs.CL

No official code found. Best implementation: 0gf/Attention-Divergence (0 stars, last commit 2026-05-07).

Abstract

We propose a lightweight and single-pass uncertainty quantification method for detecting hallucinations in Large Language Models. The method uses attention matrices to estimate uncertainty without requiring repeated sampling or external models. Specifically, we measure the Kullback-Leibler divergence between each attention head's distribution and a uniform reference distribution, and use these features in a logistic regression probe. Across multiple datasets, task types, and model families, attention divergence is highly predictive of answer correctness and performs competitively with existing uncertainty estimation methods. We find that this signal is concentrated in middle layers and on factual tokens such as named entities and numbers, suggesting that attention dynamics provides an efficient and interpretable white-box signal of model uncertainty.

View on arXivView PDF

Code Implementations(1)

Codebase for my paper "Detecting Hallucinations in Large Language Models via Internal Attention Divergence Signals"

00Jan 30, 20265 months ago

Similar Papers

Cite this paper

@article{dijk2026detecting,
  title  = {Detecting Hallucinations in Large Language Models via Internal Attention Divergence Signals},
  author = {Gijs van Dijk},
  year   = {2026},
  eprint = {2605.05025},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.05025v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2605.05025.svg)](https://codeofpaper.com/paper/2605.05025)

Discussion