Home / Fundamentals / Evaluation
Why do LLMs hallucinate, how do you measure it, and how do you reduce it?
30-second answer
Pre-training rewards plausible continuations, and models have no built-in signal separating known from unknown facts; fine-tuning on facts the model didn't know and evaluations that grade abstentions as wrong both reward confident guessing. Measure factuality on closed-book QA scored for correct, wrong and abstained answers, faithfulness to provided context in RAG, and atomic-claim precision for long answers. Reduce it with retrieval grounding and verified citations, training and prompting that reward calibrated abstention, constrained outputs, self-consistency checks, and grading that penalizes confident errors more than abstentions.
Try answering out loud before reading on. The walkthrough below is paced for a 40-minute interview round.
0–5 min Clarify and frame
Distinguish two kinds: factuality errors (claims false about the world, closed-book) and faithfulness errors (claims unsupported by the provided context, e.g. in RAG). Framing: "Causes, measurement for each type, mitigations in training and in products."
5–15 min Core explanation: causes
- Objective: pre-training maximizes the likelihood of plausible text; a fluent, specific-sounding answer is often the most likely continuation even without knowledge.
- Knowledge limits: rare facts (seen once or never) are poorly memorized; the model can't reliably tell which facts it knows.
- Fine-tuning on unknown facts: SFT examples that state facts the model didn't know teach it to produce confident answers beyond its knowledge.
- Incentives: evaluations and preferences that score abstention as wrong (or that raters dislike "I don't know") reward guessing, much like a multiple-choice exam with no penalty for wrong answers.
- Decoding: sampling from a flat distribution picks low-probability claims; long generations compound errors.
- Context problems: retrieval returns wrong or conflicting documents; the model blends prior knowledge with context.
15–25 min Deep dive: measurement
| Type | Method | Metric |
|---|---|---|
| Closed-book factuality | Short-answer QA with verified answers, allowing abstention | Correct / incorrect / abstained; precision when answering |
| Long-form factuality | Split output into atomic claims, verify each against a source | Fraction of supported claims |
| Faithfulness (RAG) | Check each claim is entailed by retrieved context (NLI or judge) | Unsupported-claim rate; citation precision |
| Calibration | Compare confidence (probability or stated) with accuracy | Calibration error |
Key point: report errors and abstentions separately. A model that answers 70% correctly and abstains on 25% (5% wrong) is far more useful in many products than one with 75% correct and 25% wrong.
25–32 min Mitigations
Product level:
- Ground answers in retrieval; require citations and verify them programmatically or with a judge before showing.
- Instruct and allow "I don't know"; route uncertain answers to humans.
- Constrain output (extract from context, structured fields).
- Lower temperature for factual tasks.
- Self-consistency: sample several answers; disagreement signals uncertainty.
- Post-generation verification for high-stakes claims (numbers, names, dates).
Model level:
- Train abstention: SFT and preference data that reward "I'm not sure" when the model doesn't know (estimated by sampling the model's own answers).
- Avoid SFT on facts unknown to the base model.
- RL rewards that penalize confident wrong answers more than abstentions.
- Retrieval-aware training: cite, and ignore irrelevant context.
32–37 min Production example
A support assistant invented refund amounts in ~4% of answers. Analysis showed most cases were questions whose policy wasn't in the retrieved context. The team added a retrieval-confidence check that triggered "let me connect you to an agent", a citation verifier that blocked answers whose numbers didn't appear in cited passages, and preference data that favoured abstention. Unsupported claims fell below 0.5%, with abstention rising from 3% to 9%, which they accepted.
37–40 min Likely follow-ups
- Can hallucination be eliminated? Not fully for open-ended generation; it can be reduced and made visible.
- Do reasoning models hallucinate less? They're often better on reasoning-heavy factual tasks but can still fabricate, sometimes with elaborate justification.
- How do you detect it at runtime without a reference? Self-consistency, retrieval entailment checks, token-probability signals; none is perfect.
What interviewers listen for
- Factuality vs faithfulness.
- Incentive-based explanation, not just "models are probabilistic".
- Measurement with abstention, and layered mitigations.
Red flags
- "Lower the temperature" as the main fix.
- Measuring only accuracy without abstentions.