AI system design interview: detect and reduce hallucination in production
Diagnose before fixing: read traces of the reported answers and classify each one as missing knowledge, bad retrieval, unfaithful generation or fabricated specifics. Fix retrieval first when the right passage wasn't there, require citations and answer-from-context instructions, move exact values to tools, add an abstention path tested with unanswerable questions, and verify claims against sources for high-risk answers. Then track the unsupported claim rate on sampled production answers every week.
Question
Users report confident wrong answers. What do you do?
Clarify
- Which feature and which users.
- Whether the system uses retrieval or answers from the model alone.
- How costly a wrong answer is: a product FAQ vs legal or medical advice.
Diagnose by type
| Type | What the trace shows | Fix |
|---|---|---|
| Missing knowledge | No relevant document exists | Add content, or abstain |
| Bad retrieval | The right passage exists but wasn't retrieved | Hybrid search, chunking, reranking |
| Unfaithful generation | The right passage was retrieved and the answer contradicts it | Prompting, smaller context, verification |
| Fabricated specifics | Numbers, names or dates not in any source | Values from tools, citation checks |
Fixes in order
1 - Read 30 to 50 failing traces and count the types, so you fix the largest group first. 2 - Fix retrieval if the right passage was missing. 3 - Require citations and instruct the model to answer only from context. 4 - Move exact values (prices, dates, balances) to tools. 5 - Add an abstention path and test it with unanswerable questions. 6 - For high-risk answers, verify each claim against the sources before responding.
Monitor
Sample production answers weekly, check claims against sources (with an LLM judge you've validated against expert labels), and track the unsupported claim rate as a metric with an owner.
What interviewers listen for
Diagnosis by type before fixes, and a metric you'd track.
From the floor
In the citation verifier session, I explained the problem with an AI search tool pulling information from websites: the answer comes with citations, but nobody can easily verify that the cited source says what the answer claims, and in legal work an unverified citation can lead to a penalty from the judge, which is why verification is a step of its own, not something you trust the model to do.