Hallucination Detection in RAG Apps: Grounding Checks Before Every Answer
RAG apps still hallucinate in 17 to 34 percent of queries even with retrieval. Claim-level grounding checks catch bad answers before users see them.
By Galactic News Editorial · Published 2026-11-26T13:48:31+00:00 · Updated 2026-11-26T13:48:31+00:00
Hallucination Detection in RAG Apps: Grounding Checks Before Every Answer
Retrieval-augmented generation was supposed to fix hallucination. Give the model the right documents, and it will answer from them instead of inventing facts. The evidence says otherwise. In a Stanford benchmark of commercial legal research tools, RAG systems still produced incorrect information in 17 to 34 percent of queries. Retrieval reduces hallucination. It does not remove it. This guide shows how to detect hallucinations in a RAG app before an answer reaches the user.
Why RAG Apps Still Hallucinate
Three failure modes cause most RAG hallucinations. The first is a retrieval miss: the right chunk was never returned, so the model answers from its own memory. The second is context leak: the model pulls in prior knowledge that contradicts the retrieved text. The third is generation drift: the retrieved chunk was correct, but the model rephrased it in a way that changed the meaning.
Each mode needs a different fix. A retrieval miss is a retriever problem: chunk size, embedding model or ranking. Generation drift is a generator problem: prompt, temperature or instruction following. If you only measure end-to-end quality, you cannot tell which half broke. Good hallucination detection splits the pipeline and checks each link separately.
The Four Checks That Matter
Every RAG evaluation framework splits a pipeline into the same four pieces: the question, the retrieved context, the generated answer and, optionally, a reference answer. The checks between them are the same under different names in every tool.
Grounding check, or faithfulness. Is every claim in the answer supported by the retrieved text? This is the hallucination check most teams care about first. RAGAS measures it by splitting the answer into atomic claims and verifying each against the context. The score is the share of supported claims, from 0 to 1. A score of 1.0 means nothing was fabricated.
Retrieval check, or context precision. Did the retriever bring back relevant chunks, and were the relevant ones ranked first? This catches bad chunk sizes, a weak embedding model or a missing reranker.
Relevance check, or answer relevancy. Did the answer address the question, rather than summarising whatever was retrieved? A correct but off-topic answer is still a failure.
Recall check, or context recall. Did retrieval contain everything a correct answer needs? This one needs a human-written reference answer, so it belongs in offline test sets, not live monitoring.
RAGAS, DeepEval, TruLens and Phoenix Compared
Four open-source tools cover this space. All four are free to run. You pay for the judge model calls, since most metrics use a second model as the judge.
| Tool | Core metrics | CI integration | Production monitoring | Best for |
|---|---|---|---|---|
| RAGAS | Faithfulness, answer relevancy, context precision, context recall | Via custom scripts | No, eval library only | Lightweight metrics and test-set generation |
| DeepEval | Faithfulness, hallucination score, contextual precision and recall, G-Eval | Yes, pytest plugin | Limited | Failing a build like a unit test |
| TruLens | Answer relevance, context relevance, groundedness (RAG triad) | Limited | Yes, local dashboard | Simplest RAG triad with a dashboard |
| Arize Phoenix | Hallucination, retrieval relevance, faithfulness, correctness | Yes, OpenTelemetry | Yes | Tracing plus scoring of live requests |
Most teams use more than one. A common pattern is RAGAS or DeepEval for offline evaluation and regression testing, and Arize Phoenix or LangSmith for production trace logging and drift detection.
How RAGAS Faithfulness Works
RAGAS is an open-source Python framework for evaluating RAG systems, published in the system-demonstrations track of EACL 2024. Its faithfulness metric runs a two-step judge prompt. First, break the generated response into discrete declarative statements. Second, verify whether each statement can be logically inferred from the retrieved context. The score is supported statements divided by total statements.
In RAGAS 0.4, the current release, the API looks like this:
from ragas.metrics.collections import Faithfulness
scorer = Faithfulness(llm=evaluator_llm)
result = await scorer.ascore(
user_input=question,
response=answer,
retrieved_contexts=chunks,
)
# result.value holds the 0 to 1 score
Sensible starting thresholds are faithfulness above 0.80, answer relevancy above 0.85, context precision above 0.75 and context recall above 0.80. Regulated domains such as finance and healthcare should demand 0.90 or higher on faithfulness. Scores are estimates, not ground truth: they inherit the judge model's biases and drift when the judge changes.
Grounding Checks Before Every Answer: A Live Pipeline
Offline evaluation catches regressions. Live grounding checks catch bad answers before users see them. A practical live pipeline has five steps.
- Split the draft answer into claims. Break the generated text into atomic statements, one fact each.
- Verify each claim against the retrieved chunks. Use a judge model, or a natural-language inference model for cheaper checks, to mark each claim supported or unsupported.
- Score the answer. Supported claims divided by total claims gives a live faithfulness score.
- Act on the score. Above the threshold, send the answer. Below it, either retry with tighter instructions, return only the supported claims, or say that no evidence was found.
- Log everything. Store the question, chunks, answer and score. Low-scoring cases are your next test set.
The honest "not found" matters as much as the check itself. A system that is allowed to say no evidence exists will hallucinate less than one forced to answer every question. Build that option into the prompt and into the product.
Six Controls That Prevent Hallucinated Findings
For high-stakes RAG apps, such as compliance or legal tools, six controls work together. Passage-level citations: every finding points to the exact page and passage, and no citation means no finding. Claim-level grounding checks: each claim is verified against its cited passage. Requirement-by-requirement assessment: assess one clause at a time against focused context, instead of one question over a 200-page bundle. An honest "not found" when evidence is absent. Human review of every finding, with accept, edit or reject logged. Ongoing measurement: track groundedness, context recall and reviewer override rates on a fixed test set, and re-run when models or prompts change.
Debugging a Low Score
When faithfulness drops, the fix depends on the pattern. Low faithfulness with high context recall means the retriever found the facts but the generator ignored them. Tighten the system prompt, lower the temperature, or switch to a more instruction-following generator. Low faithfulness with low context recall means retrieval missed the facts in the first place. Fix chunking, embeddings or reranking before touching the generator. Low answer relevancy with high faithfulness means the answer is true but does not address the question. Rewrite the prompt to require a direct answer.
Bottom Line
Hallucination detection in RAG apps is not one metric. It is a pipeline: split answers into claims, verify each claim against retrieved context, score the result, and act before the answer ships. RAGAS gives you the offline metrics. DeepEval wires them into CI. TruLens and Phoenix watch production. The rule that ties it together is simple: no claim without evidence, and no answer without a check.