Skip to content
Back to the collection

Detecting hallucinations in large language models using semantic entropy

Sebastian Farquhar, Jannik Kossen, Lorenz Kuhn, Yarin Gal

2024 · Nature

Read the paper
HN score
0
Mentions
5
Readers
5
Months
4
What’s in a score?

From the abstract

Abstract Large language model (LLM) systems, such as ChatGPT 1 or Gemini 2 , can show impressive reasoning and question-answering capabilities but often ‘hallucinate’ false outputs and unsubstantiated answers 3,4 . Answering unreliably or without the necessary information prevents adoption in diverse fields, with problems including fabrication of legal precedents 5 or untrue facts in news articles 6 and even posing a risk to human life in medical domains such as radiology 7 . Encouraging truthfulness through supervision or reinforcement has been only partially successful 8 . Researchers need a general method for detecting hallucinations in LLMs that works even with new and unseen questions to which humans might not know the answer. Here we develop new methods grounded in statistics, proposing entropy-based uncertainty estimators for LLMs to detect a subset of hallucinations—confabulations—which are arbitrary and incorrect generations. Our method addresses the fact that one idea can be expressed in many ways by computing uncertainty at the level of meaning rather than specific sequences of words. Our method works across datasets and tasks without a priori knowledge of the task, requires no task-specific data and robustly generalizes to new tasks not seen before. By detecting when a prompt is likely to produce a confabulation, our method helps users understand when they must take extra care with LLMs and opens up new possibilities for using LLMs that are otherwise prevented by their unreliability.

Metadata: Crossref. Abstracts retain their original authors’ rights.

In the conversation

Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels

5 selected excerpts · 5 total mentions

scottmu
Neutral mention · rule
I want to clarify what Ken meant by "entropy in the output token probability distributions." Whenever an LLM outputs a token, it's choosing that token out of all possible tokens. Every possible output token has a probability assigned by the model (typically a logarithm of the probability). This is a probability distribution (the output token probabilities sum to 1). Entropy is a measure of uncertainty and can quantify if a token probability distribution is certain (1 token has a 99.9% probability, and the rest share the leftover 0.1% probability) or uncertain (every token has roughly the same probability, so it's pretty much random which token is selected). Low entropy is…
Read the full comment
the former case, and high entropy is the latter. There is interesting research in the correlation of entropy with accuracy and hallucinations: - https://www.nature.com/articles/s41586-024-07421-0 - https://arxiv.org/abs/2405.19648 - https://arxiv.org/abs/2509.04492 (when only a small number of probabilities are available, which is something we frequently deal with) - https://arxiv.org/abs/2603.18940 - tons more, happy to chat about if interested
tshadley
Neutral mention · rule
The article referenced the Oxford semantic entropy study but failed to clarify that the issue greatly simplifies LLM hallucination (making most of the article outdated). When we are not sure of an answer we have two choices: say the first thing that comes to mind (like an LLM), or say "I'm not sure". LLMs aren't easily trained to say "I'm not sure" because that requires additional reasoning and introspection (which is why CoT models do better); hence hallucinations occur when training data is vague. So why not just measure uncertainty in the tokens themselves? Because there are many ways to say the same thing, so a high entropy answer may only reflect uncertainty in…
Read the full comment
synonyms-- many ways to say the same thing. The paper referenced works to eliminate semantic similarity from entropy measurements, leaving much more useful results, proving that hallucination is conceptually a simple problem. https://www.nature.com/articles/s41586-024-07421-0
Animats
Neutral mention · rule
Is that going to happen? Or are the limits of LLM technology being reached? There are basic techniques for hallucination detection being developed.[1] But they're for "closed domain question answering", which seems to be what a general search engine could find. Techniques for open-ended question answering seem to mostly involve asking the same question multiple times, perhaps in different ways, and comparing the results.[2] This sort of works, but fails when the question legitimately has multiple equally good answers. Most of these are black-box approaches - they're not going inside the LLM. (I'm not saying that better AI is impossible. Merely that this particular approach may be hitting its limit.) [1] https://www.kolena.com/blog/how-to-perform-hallucination-det... [2] https://www.nature.com/articles/s41586-024-07421-0

Keep following the thread.

More in Statistics & probability

More from the same topics.