Hallucination in depth
Where hallucinations come from in real systems
In production, most hallucinations trace back to the system around the model rather than the model alone:
- Missing context: retrieval did not find the right document, so the model filled the gap.
- Conflicting context: old and new versions of a policy both retrieved, and the model blended them.
- Pressure to answer: prompts that demand an answer and never allow "I don't know".
- Tool failures hidden from the model: an API returns an empty result and the model invents plausible data.
- Long or noisy context: the relevant fact is buried among loosely related text.
- Out-of-scope questions: users ask things the system was never designed to answer.
Example: finding the cause of invented refund rules
Example: a hypothetical e-commerce assistant occasionally tells customers they can return sale items, which the policy does not allow. Trace review shows that for these conversations, retrieval returned the general returns page but not the sale-items exception, which lived in a separate FAQ with different wording. The fixes target the cause: merge the exception into the main policy chunk, add the sale-items case to the evaluation set, add an output check that flags any return promise for orders tagged as sale items, and route such cases to a human. Faithfulness on the evaluation set is compared before and after.
Detection techniques
| Technique | How it works | Limits |
| Faithfulness scoring | A judge model checks whether each claim is supported by the supplied sources | Judge can be wrong; calibrate with human review |
| Rule checks against systems of record | Dates, amounts, IDs and statuses compared with database values | Covers structured facts only |
| Citation verification | Confirm cited passages exist and contain the claim | Requires citations in the output |
| Self-consistency | Sample several answers; disagreement signals uncertainty | Extra cost and latency |
| User feedback and escalations | Flags from users and agents reviewed weekly | Slow, incomplete |
Measuring hallucination over time
Keep a labeled set that includes answerable questions, unanswerable questions and questions with tricky near-matches. Track the share of unsupported claims, the correct-abstention rate on unanswerable questions and the false-abstention rate on answerable ones. Report by topic, since hallucinations cluster where documentation is weak. Sample production conversations for human review on a regular schedule, and add every confirmed case to the evaluation set.
Common mistakes
- Trying to fix hallucinations with prompt wording alone when retrieval is the real problem.
- Choosing a larger model and assuming the problem is gone without measuring.
- Punishing abstention in evaluations, which trains the system to guess.
- Letting generated text write directly into records, contracts or customer messages without validation or review where errors are costly.
Hallucination is reduced through grounding and RAG, checked with guardrails and structured output, and contained with human-in-the-loop review. We measure and reduce it in AI evaluation and observability and AI-powered search.