Entropy Distribution as a Fingerprint for Hallucinations in Generative Models

Mattia Jacopo Villani, Pranav Deshpande, Akshay Seshadri, Romina Yalovetzky, Niraj KumarNeurIPS 2026

TL;DR

When Large Language Models (LLMs) make things up, they leave behind a distinct statistical fingerprint in the shape of their token-by-token uncertainty—not just in their average confidence. By framing hallucination detection as a statistical hypothesis test over this uncertainty distribution, the authors introduce a fast, single-pass method that matches the accuracy of heavyweight multi-sample detectors at a fraction of the computational cost.

What Problem Does This Paper Address?

Catching an LLM in a lie usually forces an uncomfortable engineering trade-off. On one side, you have consistency-based methods (like Semantic Entropy or SelfCheckGPT) that ask the model the same question 5+ times to see if its story changes; these work well, but multiplying your inference compute by five is painful in production. On the other side, internal-state probes inspect hidden layer activations, which are completely off-limits if you are calling a commercial API.

That leaves lightweight, single-pass heuristics like perplexity or length-normalized entropy, which simply look at next-token probabilities (logits). However, these methods squash an entire sequence of token uncertainties down into a single average number. In doing so, they throw away the distributional shape and extreme spikes of uncertainty—signals that turn out to be crucial for spotting fabrications, and they lack formal statistical guarantees on error rates.

Methods

At every step of generating an answer, an LLM outputs a probability distribution over its vocabulary. From this, we can calculate the Shannon entropy—essentially a measure of how spread out or uncertain the model’s next-token guess is.

Rather than just averaging these entropies, the authors treat hallucination detection as a formal hypothesis test.

  1. Offline Calibration: Using a reference set of faithful (non-hallucinated) responses—labeled either by an "oracle" (a human or LLM judge) or gathered in a completely unsupervised way—they pool the token entropies to build a baseline reference Cumulative Distribution Function (CDF), denoted $\widehat{F}_0$. Think of $\widehat{F}_0$ as the "normal heartbeat" of the model when it knows what it's talking about.
  2. Test-Time Scoring: For a new generation, a single forward pass yields a sequence of token entropies. The authors compute two summary numbers: the mean entropy ($\bar{h}$, capturing overall distributional shift) and the maximum entropy ($h_{\max}$, capturing sudden tail anomalies or spikes of confusion).

Both values are mapped through the reference CDF $\widehat{F}_0$ and combined via a geometric mean to produce the Calibrated Entropy Score (CES):

$$\text{CES}(\boldsymbol{h}) = \sqrt{\widehat{F}_0(\bar{h}) \cdot \widehat{F}_0(h_{\max})}$$

If CES exceeds a chosen threshold, you reject the null hypothesis and flag a hallucination. What’s novel here isn't just the score itself, but the theoretical backbone: the authors generalize the classical Dvoretzky–Kiefer–Wolfowitz (DKW) inequality to handle random-length sequences, proving finite-sample calibration guarantees and showing that false positive and false negative rates decay exponentially with generation length.

Figure 1: Calibrated Entropy Score (CES) hallucination detection. A single forward pass produces token distributions p(t), from which entropies h(t) are computed. Two summary statistics (the mean entropy ¯h and the maximum entropy hmaxare mapped through the calibrated CDF bF0 and combined via a geometric mean. The reference CDF, bF0, is estimated offline from an oracle-labeled calibration set (dashed path; Algorithm 1).

Datasets

The authors evaluate their approach across 8 existing question-answering benchmarks (no new datasets are introduced):

  • Reading comprehension & QA: SQuAD, CoQA, BioASQ, TriviaQA, NQ-Open, and DROP.
  • Math word problems: GSM8K and SVAMP.

These are tested across 10 instruction-tuned models (yielding 80 model–dataset pairs), spanning open-weight models (Llama-2 7B/13B, Llama-3 8B, Llama-3.2 1B, Mistral-7B, Falcon-7B) and commercial API models (GPT-4.1, GPT-4.1-mini, GPT-4.1-nano, GPT-4o-mini), with ground-truth faithfulness judged by GPT-4.1-nano.

Key Insights and Ideas

  • Hallucinations change the shape of uncertainty, not just the average: What if hallucinations just raise average entropy? To test this, the authors subtracted the mean from every entropy sequence to remove any average shift. Even after mean-centering, two-sample Kolmogorov–Smirnov tests found statistically significant differences in the shape of the distributions in 80 out of 80 experiments ($\alpha = 0.05$).
Figure 2: Entropy distributions differ between faithful and hallucinated generations. (a) Empirical CDFs for the median-effect-size experiment, with dKS annotated. (b) Distribution of dKS distances across 80 experiments; 72/80 are significant at α=0.05, with the distributional difference being more marked for API models. (c) Mean-centred shape signal: 80/80 experiments exhibit significant residual distributional differences after removing the location shift.
  • You don't actually need labels to calibrate: Because CES relies on a smooth CDF, it is surprisingly tough against "contaminated" calibration data. The unsupervised variant—which simply builds $\widehat{F}_0$ from raw, unlabeled model outputs, hallucinations and all—performs virtually identically to the supervised version (often differing only in the third decimal place of AUROC).
  • Calibration transfers across domains: The "faithful fingerprint" belongs more to the model than the task. Calibrating $\widehat{F}_0$ on just 100 random examples from unrelated datasets leaves detection performance essentially unchanged on unseen target datasets.

Key Results

  • Top-tier accuracy at single-pass cost: Across 80 experiments and 16 baselines, unsupervised CES wins 66.8% (854/1,279) of pairwise AUROC comparisons. In a Friedman/Nemenyi rank analysis, CES achieves an average rank of 6.29, landing squarely in the top statistical clique alongside expensive multi-pass methods like Kernel Language Entropy (rank 6.16), while beating SelfCheckGPT (80.0% win rate) and Semantic Entropy (72.2% win rate).
  • Best-in-class for single-pass: Unsupervised CES outperforms all single-pass, non-querying baselines (like Perplexity and Length-Normalized Entropy) in 43/80 experiments while adding formal statistical guarantees.
  • Tiny data requirements: Calibration converges rapidly—using just 2% of the calibration pool (~10 samples in practice) gets CES within 0.01 AUROC of full-dataset calibration.

Limitations and Future Work

  • Confident misconceptions: If a model was trained on bad data and hallucinates with total confidence, its entropy distribution won't budge ($d_{KS}(F_0, F_1) = 0$), and no entropy-based test will catch it.
  • Short answers: Like any statistical test, power drops when sample sizes are tiny; CES struggles on very short generations ($m < 10$ tokens).
  • API constraints & assumptions: CES requires access to token-level logits (or top-$k$ log-probs), which some closed APIs restrict. Furthermore, the theoretical proofs assume token entropies are conditionally independent and identically distributed (i.i.d.), and experiments focused on greedy decoding for short-answer QA. Extending the math to explicitly model sequential dependencies, stochastic sampling, and long-form text remains open for future work.

Summary updated

Abstract

Large Language Models (LLMs) often generate factually incorrect outputs, commonly termed hallucinations, that undermine trust and limit deployment in high-stakes settings. Existing hallucination detection methods typically require multiple forward passes, or access to model internals. In this work, we provide theoretical foundations and empirical evidence that key summaries of token-level entropy distribution serve as a fingerprint of hallucination, carrying useful signals beyond conventional measures such as perplexity or length-normalised entropy. We formalize hallucination detection as a statistical hypothesis test and propose the **C**alibrated **E**ntropy **S**core (**CES**), a lightweight algorithm that, after calibration, requires only a single forward pass and black-box access to token logits. CES combines the mean signal with the maximum signal of the generated entropy through a calibrated reference CDF, producing scores that are comparable across models and tasks. We establish finite-sample calibration guarantees via a novel random-length Dvoretzky–Kiefer–Wolfowitz inequality, and also prove that CES detects hallucinations with probability converging to one exponentially fast in the generation length. Across eight QA benchmarks and ten generator models spanning open-source and API access models, CES achieves the highest detection performance among all single-pass black-box methods while providing formal error guarantees that existing heuristics lack. Remarkably, CES is statistically indistinguishable from multi-sample methods that require far greater computational cost, closing the gap between lightweight and expensive detection and making it suitable for real-time, large-scale deployment.
BibTeX
@inproceedings{villani2026entropy,
  author = {Mattia Jacopo Villani and Pranav Deshpande and Akshay Seshadri and Romina Yalovetzky and Niraj Kumar},
  title = {{Entropy Distribution as a Fingerprint for Hallucinations in Generative Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=yeXKhJ9iy3},
}
Figure