Hallucination
Why models state wrong answers with confidence, and how to trade a few answers for a lot of trust.
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
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.
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.
The words you will hear
Hallucination
Primary sources
- 01Why Language Models HallucinateKalai et al. · 2025
- 02Language Models (Mostly) Know What They KnowKadavath et al. · 2022
- 03GPT-4 Technical ReportOpenAI · 2023
- 04Measuring short-form factuality in large language modelsWei et al. · 2024
- 05Detecting hallucinations in large language models using semantic entropyFarquhar et al. · 2024
- 06Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksLewis et al. · 2020
Connected ideas
Retrieval and search
Retrieval-augmented generation (RAG)
How a model answers from your documents, and shows you exactly where each claim came from.
ExploreObservability
Evals
How to know a change made your AI system better, before your users find out it did not.
ExploreObservability
Error bars on evals
Why 82% against 78% on 100 questions can mean nothing, and how many questions you need before it does.
ExploreTraining and alignment
RLHF: learning from human feedback
How people's choices between answers become a reward that steers a model.
ExploreWant 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.