Skip to content
Interpretability and safety

Hallucination

Why models state wrong answers with confidence, and how to trade a few answers for a lot of trust.

Intermediate · 6 steps

Read first:Next-token predictionSampling and decoding

Step 1 of 6· Illustrative questions, odds and confidences; the SimpleQA results, singleton bound, scoring rule and entropy maths are real

in one minute

A language model writes by predicting likely next words, and nothing in that process checks whether a sentence is true. When it knows a fact well, the likely answer is the right one. When it barely knows, it still produces a fluent, confident sentence: a hallucination. Training and testing make this worse, because most benchmarks give points for right answers and nothing for “I don't know”, so guessing never scores worse. Hallucinations can be reduced, not abolished: give the model trusted sources to quote, check whether its answers agree when asked again, and let it decline when its confidence is low, accepting fewer answers in exchange for more right ones.

Why it matters for your product

A wrong answer delivered confidently costs more than no answer: a fabricated legal precedent, an invented refund policy, a plausible but false figure in a report. For most products the goal is not the most answers but the fewest confident errors. Ground answers in your own documents with citations, measure how often the system declines as well as how often it is right, and route low-confidence cases to a person. When we evaluate a system, we score a wrong answer as worse than an honest “I don't know”.

For engineersShow the maths

score = right − wrong × t / (1 − t); answer only if confidence > t

The grading Kalai and colleagues propose: state a confidence target t and charge t/(1−t) points for each wrong answer. A guess then pays only when the model is more than t sure, so honest abstention is rewarded instead of punished.

Worked example: With t = 0.9 a wrong answer costs 9 points. A guess that is 80% likely to be right is worth 0.8 × 1 − 0.2 × 9 = −1.0, so “I don't know”, worth 0, is the better reply.

H = −Σ p(c) · ln p(c), summed over clusters c of answers that mean the same

Semantic entropy: sample several answers, group those with the same meaning, and measure how spread out the groups are. Zero means every answer agrees; high values flag likely confabulation.

Worked example: Five answers 1887, 1891, 1887, 1902, 1884 form clusters with shares 0.4, 0.2, 0.2 and 0.2, so H ≈ 1.33 out of a possible 1.61; five answers that all mean “Paris” give H = 0.

calibrated: accuracy of answers given with confidence p ≈ p

A threshold on confidence only helps if the confidence means something. Check it by grouping answers by stated confidence and comparing each group's accuracy.

Worked example: If a model says 90% on 100 answers and 70 are right, it overstates its confidence by 20 points; SimpleQA found that models consistently overstate theirs.

where it stops working

These methods reduce hallucination rather than remove it. Sources can be wrong or misread, a model can be consistently wrong so that its samples agree, and a confidence threshold is only as good as the calibration behind it; GPT-4's confidence was less well calibrated after post-training than before it.

Key terms

The words you will hear

Hallucination

A fluent, plausible statement that is false or not supported by the model's sources.
Where it came from

Primary sources

  1. 01Why Language Models HallucinateKalai et al. · 2025
  2. 02Language Models (Mostly) Know What They KnowKadavath et al. · 2022
  3. 03GPT-4 Technical ReportOpenAI · 2023
  4. 04Measuring short-form factuality in large language modelsWei et al. · 2024
  5. 05Detecting hallucinations in large language models using semantic entropyFarquhar et al. · 2024
  6. 06Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksLewis et al. · 2020

Want this working on your data?

We design and build the systems these ideas power: retrieval, agents, voice and the models behind them. Start with a free discovery call.