Lesson 22 / 27
Reducing Hallucination
Apply grounding, constraints and verification.
Make the truth easy to find and the lie easy to catch
Hallucinations cannot be removed entirely, only reduced and caught. Practical measures: ground answers in supplied sources (RAG) and require quotes or citations; instruct the model to abstain when the context is insufficient; use low temperature for factual tasks; constrain output to schemas or allowed values; verify with code or a second pass (check that cited passages really contain the claim, run generated code and tests, validate numbers); and show uncertainty and sources in the UI so users can check. For high-stakes areas such as medicine, law or finance keep a human in the loop.
Quick check: Which measure helps catch a hallucinated citation?
- Removing the system prompt
- Raising the temperature
- Using shorter words
- Checking in code that the cited passage contains the claim
Answer
Checking in code that the cited passage contains the claim — Automated verification against the source catches unsupported claims.