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
- Splits the answer into claims
- Checks claims against the retrieved source
- Uses an entailment model or judge
- Checks citations and runs checks at scale
- Targets weak spots and tracks refusals
Answer it out loud in the mock interview about 1.5 min
Follow-ups to expect
- Why do models hallucinate on questions about things that do not exist?
- How would you stop fixes from making the assistant refuse too much?
Common mistakes
- Judging a long answer with a single verdict
- Testing only common questions
Learn it
Catching hallucinations: why models make things up and how to detect it
- How do you choose a chunk size for RAG?
- Your RAG app gives wrong answers. How do you find the cause?
- Design a RAG system that lets a law firm search and ask questions about 50,000 contracts.
- What are embeddings, and how are they used in search?
- How do you make a RAG system cite sources and stay grounded?
- What are hybrid search and reranking, and when do they help?
- How do you keep a RAG index up to date as documents change?
- How do metadata filters improve retrieval?
- How would you build RAG over documents full of charts and images?
- Your RAG system must handle scanned PDFs, tables and slides. How do you ingest them?
- How do you make sure users only get answers from documents they are allowed to see?
- What are query rewriting and HyDE, and when do they help?
- Your HR assistant keeps quoting last year's leave policy. How do you fix it?
- Tell me about a RAG system you built and how you measured whether it worked.
- Can you do retrieval for long documents without a vector database?
- What is RAG, and why would you use it?
- When would you use graph RAG instead of standard vector RAG?