1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →
How can you detect hallucinations in LLM outputs?
30-second answerSay your answer out loud first, then reveal.
| Method | Needs | How | Limits |
|---|---|---|---|
| Groundedness / faithfulness check | Source context | Claim extraction → entailment check per claim | Context itself may be wrong |
| Citation verification | Citations | Check cited passage supports the sentence | Model may cite loosely |
| Self-consistency | Multiple samples | Disagreement across samples suggests hallucination | Costly; consistent errors pass |
| External verification | Tools / KB | Look up facts, run calculations | Coverage of tools |
| Uncertainty signals | Logprobs | Low-confidence tokens on key facts | Not always calibrated or available |
| Field validation | Source systems | Check IDs, dates, amounts exist and match | Structured data only |
Production pattern for RAG: generate → groundedness check → if unsupported claims are found: regenerate with stricter instructions, remove those claims, or abstain / escalate.
Measure it: "unsupported claim rate" on the eval set and sampled production traffic, as a key metric.
Related
PreviousHow do content moderation classifiers work in LLM apps, and how do you set their thresholds?
You understood something today that you didn't yesterday.