FIELD NOTE / RELIABILITY NOTE
Evaluating Faithfulness in RAG Systems
A RAG system can retrieve the right document, cite the right passage, and still produce an answer that says something the evidence never said. Faithfulness evaluation isolates that failure: given the exact context available at generation time, which claims in the answer are actually supported? The engineering challenge is turning that question into a repeatable measurement system that survives ambiguous claims, noisy retrieval, judge disagreement, model changes, and production release pressure.
Start with the distinction that matters
Faithfulness is not the same as correctness. A response may be factually true because the model remembered something from pretraining, yet still be unfaithful if that fact is not supported by the context this request was allowed to use. The reverse can happen too: an answer can faithfully repeat a retrieved document that is stale or wrong. Relevance asks whether the response addresses the question; retrieval quality asks whether useful evidence was found; correctness asks whether the claim matches an accepted reference; faithfulness asks whether the answer is entailed by the supplied evidence. Keep those questions separate. Otherwise a single attractive score can hide whether the system retrieved the wrong passage, over-synthesized a good passage, or cited a source that does not support the sentence beside it.
A useful mental model is a support-policy assistant. If the retrieved policy never mentions a regional exception, a fluent answer that invents one is unfaithful even when the exception happens to be true in the wider world. The evaluator must judge the answer against the evidence this request was allowed to use.
Define the evidence contract
Before choosing a metric, write down what the system is allowed to claim. Identify the authoritative corpus, access scope, freshness rules, and the expected behavior when evidence is missing or conflicting. Then represent each answer as atomic claims rather than treating a paragraph as one indivisible unit. “The policy allows refunds within 30 days, requires original condition, and excludes clearance items” is at least three claims. A claim should be small enough to label as supported, contradicted, or not verifiable against one or more retrieved chunks. Preserve the mapping between claim, source span, document version, and retrieval rank. This makes a score actionable: a failed claim can point to missing recall, weak chunking, an over-broad synthesis step, or a citation that was attached after generation rather than produced with it.
In practice, the contract should also preserve claim-to-source provenance: the exact span, document version, access decision, and retrieval rank. That receipt turns a failed score into an engineering action instead of an argument about whether the answer felt reasonable.
Build a test set that looks like production
A handful of happy-path questions is not a faithfulness evaluation. Build slices that reflect how the system will actually be used: direct lookups, multi-hop questions, summarization, comparison, ambiguous wording, incomplete context, conflicting documents, stale versions, long contexts, and questions whose answer is absent. Add negative controls where the correct behavior is “I cannot establish that from the supplied evidence.” Include paraphrases so the evaluator does not reward memorized wording. Keep a small, hand-reviewed golden set for calibration and a larger generated or weakly supervised set for regression breadth. Record the expected evidence spans where possible, but do not force a reference answer when the product is intentionally extractive or open-ended. The important artifact is a stable question–context–answer record with versions, not a leaderboard number detached from the retrieval configuration.
A payments documentation assistant may score 0.91 on direct lookups and 0.61 on multi-hop questions that combine region, payment method, and capture timing. Keep those slices visible; the aggregate is not representative when production traffic is uneven.
Separate retrieval failure from generation failure
Faithfulness is downstream of retrieval. If the required passage never enters the context, the generator cannot produce a supported answer unless it uses outside knowledge—which may be unacceptable for the task. Measure retrieval coverage first: context recall, context precision, rank of the first supporting passage, duplicate rate, freshness, and access-filter outcomes. Then score the generated answer against the context that was actually shown to the model. A useful debugging matrix has four quadrants: good retrieval / faithful answer, good retrieval / unfaithful answer, bad retrieval / cautious refusal, and bad retrieval / confident answer. The last quadrant is the highest-risk failure. Do not “fix” it by only tuning the judge. Inspect query rewriting, chunk boundaries, metadata filters, reranking thresholds, and context truncation. Keep retrieval and generation metrics on separate release gates so ownership is clear.
A diagnostic matrix makes ownership explicit: good retrieval with an unfaithful answer is a generation problem; bad retrieval with a cautious refusal is a safe failure; bad retrieval with a confident answer is the highest-risk quadrant. Fix the retrieval path before tuning the judge.
Use claim-level attribution, not a single vibe score
A common automated approach is to decompose the response into claims, then check whether each claim can be inferred from the retrieved context. RAGAS describes faithfulness in this form: supported claims divided by total claims. DeepEval’s faithfulness metric similarly evaluates whether the actual output factually aligns with the retrieval context and returns an explanation. These are useful diagnostics, not ground truth. Claim decomposition can be inconsistent, judges can accept plausible implications too generously, and a polished answer can receive a high average while one critical claim is unsupported. Store the claims, entailment decisions, judge rationale, and per-claim confidence. Report at least mean claim support, unsupported-claim rate, and the worst critical claim—not only the average. For high-risk workflows, use deterministic checks for dates, identifiers, arithmetic, policy codes, and required fields alongside semantic judging.
For a refund answer, decompose the output into atomic claims such as the time window, item condition, and exception. Two claims may be supported while a third changes eligibility. The release decision should follow the critical claim, not the arithmetic average.
| Claim extracted from answer | Status |
|---|---|
| Okta SSO is supported. | |
| Microsoft Entra ID is supported. | |
| Google Workspace SSO is supported. | |
| Setup takes approximately 15 minutes. | |
| Administrative access is required on both sides. | |
| SSO is available on Business and Enterprise plans. | |
| The configuration is automatically rolled back on failure. |
Treat citations as a separate control surface
A citation is not proof merely because one is present. Evaluate citation correctness—does the cited passage support the claim?—and citation completeness—are the material claims covered?—separately from answer faithfulness. A response can be faithful overall but attach the wrong source to one sentence; it can also cite a real passage while adding an uncited conclusion that the passage does not entail. Prefer sentence- or claim-level citation links to document-level footers. Test whether citations survive paraphrase, multi-source synthesis, and answer reordering. Keep source identifiers, character spans or chunk IDs, document version, and access decision in the trace. The distinction between correctness and faithfulness in RAG attributions is important here: a citation may point to a true statement while failing to support the specific wording generated. Review citation behavior as part of the product contract, not as decorative formatting added after the model response.
Citation quality has two dimensions: correctness (the cited passage supports the claim) and completeness (material claims are covered). A real document attached to the wrong sentence is still a control failure, even when the answer itself is broadly correct.
Attack the boundary deliberately
Ordinary examples tell you whether the happy path works. Adversarial examples tell you whether the evidence boundary holds under pressure. Include retrieved passages with instructions such as “ignore the policy,” conflicting versions of the same rule, documents that contain plausible but unauthorized data, partial quotations, negations, tables, and distractor passages with high lexical overlap. Test prompt injection inside both user input and retrieved content. Add counterfactual pairs where one word, date, threshold, or permission changes and the answer should change with it. Also test context overflow: the relevant chunk may be retrieved but pushed out during prompt assembly. A robust system should answer from the allowed evidence, cite the source, identify conflicts, or refuse. Score not just whether the final text looks safe, but whether the trace shows the correct boundary decision and whether sensitive content stayed out of logs and prompts.
Boundary tests should include stale versions, contradictory passages, injected instructions, partial quotations, negations, tables, and context overflow. The expected behavior is evidence-first: identify the conflict, cite the source, or refuse rather than fill the gap with plausible memory.
Calibrate judges with humans and disagreement
LLM-as-a-judge is practical at scale, but it is still a model making a measurement. Give the judge a strict rubric, the question, the retrieved context, the answer, and the claim being assessed. Ask for a structured verdict—supported, contradicted, or insufficient—with a short evidence span, rather than an unconstrained 1–5 impression. Sample disagreements and difficult slices for human review. Measure agreement by slice, not only overall: judges often struggle with negation, numerical comparisons, legal or policy language, and multi-hop inferences. Maintain a human preference or validation set and periodically re-check the judge after changing the model, prompt, corpus, or domain. ARES is a useful example of combining automated evaluation with a human-annotated validation set and statistical confidence intervals. The operational rule is simple: automation expands coverage; humans calibrate what the score means.
An LLM judge should return a structured verdict with a short supporting span. Calibrate it on difficult numerical, temporal, legal, and negation cases, and keep human disagreement visible by slice rather than hiding it in one global accuracy number.
Turn scores into release gates
A release decision should name the failure it is willing to accept. Set separate thresholds for claim support, critical-claim support, citation completeness, retrieval coverage, refusal quality, latency, and cost. Use a fixed regression set plus a rotating slice of recent production-shaped cases. Compare the candidate against the last approved model, prompt, index, and reranker—not just against a global target. Store the evaluation receipt: commit or release ID, model and prompt versions, corpus snapshot, retrieval settings, judge version, sample counts, confidence intervals, failed examples, and rollback target. A small average improvement should not ship if a critical policy slice regresses. Conversely, a lower mean can be acceptable if the system correctly refuses previously dangerous cases. The gate should produce an owner and next action: repair retrieval, change chunking, tighten the answer contract, add a validator, improve citations, or defer promotion.
A release receipt should carry the model and prompt versions, corpus snapshot, retrieval settings, judge version, sample counts, failed examples, confidence intervals, and rollback target. A small mean improvement should not ship if a critical policy slice regresses.
Monitor faithfulness after deployment
Offline evaluation cannot represent every query, so production needs a privacy-safe feedback loop. Sample traces according to risk and uncertainty, not only volume. Monitor unsupported-claim rate, citation coverage, refusal rate, retrieval misses, stale-source usage, latency, token growth, and user corrections. Keep raw sensitive content out of telemetry; retain redacted claim text, source IDs, policy versions, and hashes or references needed for replay. When a failure is found, preserve the exact retrieval result and prompt assembly so it can become a regression case. Watch for distribution shift: new document templates, changed terminology, index growth, and model upgrades can change faithfulness without any code change. The goal is not a permanently perfect score. It is a system that notices when its evidence boundary is weakening, explains why, and gives the team a safe path to correct or roll back it.
After deployment, sample traces according to risk and uncertainty. Keep sensitive content out of telemetry; retain redacted claims, source IDs, policy versions, and replay references so a discovered failure can become a regression case without exposing private data.
A practical definition of done
I consider a RAG system ready for a faithfulness claim when five things are true. First, the task contract says what counts as evidence and when to refuse. Second, retrieval and generation are measured independently on representative and adversarial slices. Third, answers are decomposed into claims with source-level attribution and critical-claim checks. Fourth, automated judges have been calibrated against human-reviewed examples, with disagreement visible. Fifth, the result is tied to a release gate and an observable recovery path. The metric is then more than a dashboard tile: it is a compact explanation of how the system behaves when evidence is present, absent, conflicting, stale, or malicious. That is the standard worth carrying into production—faithful answers, explicit uncertainty, and a trace a reviewer can reconstruct later.
The practical standard is not a perfect score. It is an evidence boundary the team can state, measure, challenge, and reconstruct later—especially when the answer should have been uncertain, refused, or escalated.
FURTHER READING
Methods and research behind this note
DISCUSSION
Share a thought
Comments are powered by GitHub Discussions.