Semantic Energy: Detecting LLM Hallucination Beyond Entropy

Huan Ma, Jiadong Pan, Jing Liu, Yan Chen, Joey Tianyi Zhou +5 more
8/20/2025
cs.LG

No confident code implementation found for this paper.

Abstract

Large Language Models (LLMs) are being increasingly deployed in real-world applications, but they remain susceptible to hallucinations, which produce fluent yet incorrect responses and lead to erroneous decision-making. Uncertainty estimation is a feasible approach to detect such hallucinations. For example, semantic entropy estimates uncertainty by considering the semantic diversity across multiple sampled responses, thus identifying hallucinations. However, semantic entropy relies on post-softmax probabilities and fails to capture the model's inherent uncertainty, causing it to be ineffective in certain scenarios. To address this issue, we introduce Semantic Energy, a novel uncertainty estimation framework that leverages the inherent confidence of LLMs by operating directly on logits of penultimate layer. By combining semantic clustering with a Boltzmann-inspired energy distribution, our method better captures uncertainty in cases where semantic entropy fails. Experiments across multiple benchmarks show that Semantic Energy significantly improves hallucination detection and uncertainty estimation, offering more reliable signals for downstream applications such as hallucination detection.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{ma2025semantic,
  title  = {Semantic Energy: Detecting LLM Hallucination Beyond Entropy},
  author = {Huan Ma and Jiadong Pan and Jing Liu and Yan Chen and Joey Tianyi Zhou and Guangyu Wang and Qinghua Hu and Hua Wu and Changqing Zhang and Haifeng Wang},
  year   = {2025},
  eprint = {2508.14496},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.14496v3}
}

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/2508.14496.svg)](https://codeofpaper.com/paper/2508.14496)

Discussion