Skip to main content

How would you detect hallucinations in a production RAG application?

RAG · Pro 1

Short answer

Check each claim in the answer against the retrieved passages. Split the answer into single claims, then judge each as supported or not with an entailment model or a judge model, and flag unsupported ones. Check that citations exist and support the claim. Run cheap checks on every answer, deeper judge reviews on a sample, and track rates by topic.

Deeper answer

Before detection, I would find where the system hallucinates: rare topics and questions with false premises are the usual culprits, so the test set must include them. Prevention helps most: answer only from sources, say when they do not cover the question, and cite passages.

Self-consistency, sampling several answers and comparing, works without a source but costs several times as much, so I keep it for spot checks. I also track refusal rates, because stricter checks can make the assistant refuse too often.

What a strong answer covers

Answer it out loud in the mock interview about 1.5 min

Follow-ups to expect

Common mistakes

Learn it

Catching hallucinations: why models make things up and how to detect it

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.