Before launch, test every RAG answer as an evidence chain: user question → permitted documents → retrieved passages → material claims → citations → customer-visible behaviour. Build a labelled set that includes answerable, ambiguous, unanswerable, conflicting, access-controlled and adversarial questions. Score retrieval separately from the generated answer, set your own hard failure gates, and record latency and token use without allowing a good average to hide a dangerous case. Ship only when the release candidate passes every hard gate and meets the team’s declared quality and operational thresholds on both the full set and its highest-risk slice.
The important change is to stop asking only, “Does this answer look right?” A fluent answer can conceal a retrieval failure. A correct sentence can cite the wrong passage. A safe fallback can mask a broken index. The test protocol must show where the evidence chain broke and whether the failure is acceptable for the intended customer experience.
Use the Evidence-Chain Release Gate
The Evidence-Chain Release Gate has four layers. Each layer answers a different release question and has a different owner.
- Corpus and permission layer: Was the expected document indexed, current and available to this user? This separates content and access-control defects from model behaviour.
- Retrieval layer: Did the system place the expected supporting passage in the context actually sent for answer generation? Inspect the retrieved text, not only document identifiers.
- Answer and citation layer: Is every material claim supported by that context, and does each citation lead to the supporting passage rather than merely a related document?
- Product behaviour layer: For missing, conflicting, sensitive or malicious inputs, did the experience follow the specified fallback or escalation path? Were latency and token use inside the team’s declared release limits?
A test fails at the earliest broken layer. If a current, permitted passage was never retrieved, classify the case as a retrieval failure even if the answer generator later guessed correctly. If the passage was present but the response contradicted it, classify it as an answer failure. This rule makes remediation specific: corpus fixes do not become prompt rewrites, and prompt defects do not become indexing projects.
This protocol is deliberately narrower than a general AI-agent evaluation. It concerns document-search answers, their evidence and the customer-facing behaviour around them.
Build a labelled evaluation set before choosing thresholds
Start with real question shapes from the intended workflow, but remove personal, confidential or otherwise unsuitable information before placing examples in a reusable test fixture. Add designed edge cases rather than relying on common questions alone.
Use one row per test case with these fields:
| Field | What to record |
|---|---|
| Case ID | Stable identifier retained across releases |
| Query | Exact customer-visible input |
| User context | Role, tenant, locale or entitlement relevant to access |
| Answerability | Answerable, ambiguous, unanswerable or conflicting |
| Risk tier | Team-defined consequence tier, with the reason |
| Expected source | Document version and the smallest supporting passage |
| Disallowed sources | Documents or tenant data this user must not receive |
| Required behaviour | Answer, clarify, refuse, state uncertainty or escalate |
| Required content | Essential points the response must preserve |
| Prohibited content | Claims, disclosures or instructions that must not appear |
| Retrieval result | Retrieved passages in the order supplied to the model |
| Response and citations | Exact visible output and citation targets |
| Operations | End-to-end latency, model calls, input/output tokens and errors |
| Verdict | Pass/fail, earliest failed layer, severity and defect owner |
Cover at least these six case families:
- Directly answerable: one passage clearly supports the response.
- Multi-document: the answer requires compatible evidence from more than one source.
- Ambiguous: the input lacks a product, date, region or other required qualifier.
- Unanswerable: the corpus does not contain the requested fact.
- Conflicting or stale: two versions disagree, so precedence and freshness rules matter.
- Permission and adversarial: the question requests another user’s information, attempts to override instructions or asks the system to treat retrieved text as executable direction.
Do not turn those families into equal quotas by habit. Weight the set according to the risks and traffic shapes the product team has actually defined. Keep a separate high-risk slice so its outcomes remain visible even when the full set grows.
Score retrieval, support and citations separately
Use a compact ordinal rubric for diagnosis, then apply hard gates before any aggregate score. The following 0–2 scale is a reusable starting point, not a universal benchmark.
| Dimension | 0 | 1 | 2 |
|---|---|---|---|
| Retrieval coverage | Expected evidence absent | Partially useful evidence or expected passage buried in supplied context | Expected supporting passage present and usable |
| Answer support | A material claim is contradicted or unsupported | Core answer is supported but qualification or material detail is weak | Every material claim is supported by supplied evidence |
| Citation correctness | Citation is absent, inaccessible or does not support the claim | Correct document but imprecise or incomplete target | Citation resolves to the exact supporting passage or clearly scoped source |
Record the following as pass/fail checks rather than averaging them:
- no content from a disallowed source appears in retrieval, answer or citation;
- an unanswerable case follows its specified fallback instead of presenting an unsupported answer;
- an ambiguous case requests the missing qualifier when the specification requires it;
- retrieved instructions cannot change the product’s governing rules;
- the answer and citation expose only content the current user may access;
- the release stays within the product team’s declared latency, token-use and error limits.
Why hard gates? An access breach or unsupported high-consequence answer should not disappear inside a strong mean score. The team should define which conditions are release blockers, and write that policy before looking at candidate results.
A useful release policy has three parts:
- Hard gates: zero tolerance conditions for this product and risk tier.
- Quality floors: minimum acceptable scores for each dimension, stated for the full set and high-risk slice.
- Operational ceilings: explicit limits for end-to-end latency, token use, model calls, timeout rate or cost unit selected by the team.
Leave threshold fields blank until product, engineering and risk owners approve them. Copying another system’s numbers would imply comparable users, documents and consequences when none has been established.
Example: a fictional warranty-document test case
This is a constructed walkthrough, not a customer case, executed test or claimed result.
Imagine a customer-facing search experience for a fictional device manual and warranty. The test query is: “Does the standard warranty cover a screen cracked by a drop?” The labelled fixture identifies an accidental-damage exclusion as the expected passage. The required behaviour is to state that the standard warranty does not cover that event, cite the exclusion and avoid inventing an alternative plan.
The evaluator now walks the chain:
- Corpus and permission: confirm that the current warranty version is indexed and permitted for this visitor. If it is missing, stop and label a corpus failure.
- Retrieval: inspect the exact chunks sent to generation. Suppose the context contains a generic “defects are covered” section but not the accidental-damage exclusion. That hypothetical candidate receives retrieval coverage 0. Even if its final answer happens to say “not covered”, it fails because the system did not retrieve evidence for that conclusion.
- Answer support: in a second hypothetical candidate, suppose both sections are present, but the answer says a dropped device is covered. Retrieval coverage can be 2 while answer support is 0. The defect belongs in answer construction or instruction handling, not indexing.
- Citation: in a third candidate, suppose the answer is supported but links only to the warranty cover page. Citation correctness is 1 if the team’s rubric requires a precise target.
- Product behaviour: record observed latency and token use in the fixture’s chosen units, then compare them with approved limits. Do not estimate missing measurements.
Under a declared rule that any unsupported material claim is a hard failure, either of the first two hypothetical candidates would produce HOLD. The third would also be HOLD if exact citation targeting is a release gate; otherwise it becomes a tracked defect subject to the approved quality floor. The example does not establish a universal threshold. It demonstrates how the same visible topic can fail at different layers and therefore require different fixes.
Turn the rubric into an executable test harness
A spreadsheet is sufficient to design the protocol, but repeatable release decisions need a harness that preserves inputs and outputs.
- Freeze the candidate. Record the corpus snapshot, document versions, chunking settings, retrieval configuration, model identifier, system instructions and application release. A score without a reproducible configuration cannot support regression diagnosis.
- Load labelled cases. Validate that every case has an answerability label, expected behaviour, risk tier and source expectation where one exists. Unanswerable cases should not be forced to name an expected passage.
- Run through the production path. Use the same authentication, retrieval, reranking, generation, citation and fallback path intended for customers. A direct model call does not test the product chain.
- Capture the trace. Store query, effective user permissions, retrieved passages and ranks, final context, visible response, citation destinations, timings, token counts, errors and fallback events. Redact or restrict traces according to the product’s data-handling requirements.
- Apply deterministic checks first. Verify source permissions, citation resolution, required fallback states, response structure and measurement completeness in code where possible.
- Perform labelled review. Human reviewers compare material claims with supplied passages and apply the same rubric. Record the reason, not only the score. Resolve disagreements under a documented review rule.
- Aggregate without hiding slices. Report counts and scores by case family and risk tier. Show hard-gate failures individually. Treat missing measurements as incomplete tests, not passes.
- Compare with the accepted baseline. Re-run the unchanged set against the candidate. Add every confirmed production defect to the regression set after removing unsuitable data.
- Make and record the release decision. Name the approver, candidate, thresholds, exceptions and expiry of any temporary exception.
For teams that need help implementing this path, CodeAustral’s AI Integration & Applied AI Workflows service describes support for RAG over first-party content, evaluation harnesses, guardrails, fallbacks, cost controls and latency controls.
Use a ship, hold or rollback decision table
| Decision | Required condition | Action |
|---|---|---|
| Ship | Every hard gate passes; approved quality floors and operational ceilings pass for both the full set and required slices; all measurements are complete | Release the frozen candidate and retain its scorecard as the baseline |
| Hold | A pre-launch hard gate fails, a threshold is missed, evidence is incomplete or an exception lacks approval | Assign the earliest failed layer, fix it and rerun the affected cases plus the full regression set required by policy |
| Rollback | A released candidate regresses against the accepted baseline or violates a production release gate | Restore the previously accepted configuration through the product’s rollback procedure, preserve traces and open a regression case |
Before approving Ship, use this checklist:
- [ ] Corpus snapshot and configuration are reproducible.
- [ ] Each test has answerability, risk and required-behaviour labels.
- [ ] Expected passages are version-specific where applicable.
- [ ] Retrieval and answer failures are classified separately.
- [ ] Citations were opened and checked against material claims.
- [ ] Unanswerable, ambiguous, conflicting, permission and adversarial cases are present.
- [ ] Hard gates and thresholds were approved before candidate review.
- [ ] High-risk results are visible separately from aggregate results.
- [ ] Latency and token use came from observed runs; missing values did not pass.
- [ ] The rollback target and responsible owner are named.
Limitations
A labelled evaluation set samples a product’s question space; it cannot prove that every future query will behave correctly. Its value depends on the quality, freshness and representativeness of its cases.
Human judgements about materiality, partial support and acceptable clarification can differ. A written rubric, reviewer notes and an escalation rule reduce inconsistency but do not remove it.
Offline tests also do not reproduce every production condition. Concurrent load, provider errors, document updates, permission changes and unfamiliar user phrasing can expose failures absent from a controlled run. Pre-launch evaluation should therefore be paired with production monitoring, customer feedback paths and a tested rollback procedure.
Latency and token use are configuration- and workload-dependent. This guide intentionally provides fields, not supposedly universal limits. Teams must measure their own end-to-end path and choose ceilings consistent with their product requirements.
Finally, a citation is not proof by itself. It must resolve to accessible evidence that supports the nearby claim. Review the relationship between claim and passage, not merely the presence of a link.
FAQ
How many RAG test questions are enough before launch?
There is no defensible universal count in the supplied evidence. Begin with coverage: each important workflow, risk tier and failure family needs labelled cases. Expand the set when new document types, permissions, locales or confirmed defects appear. Release confidence should depend on passing declared gates, not reaching an arbitrary row count.
Should we use an LLM to grade RAG answers?
It can assist a workflow, but do not make an unvalidated automated judgement the sole release authority. Keep deterministic permission, citation and fallback checks separate. Compare any automated grader with labelled human decisions for the actual rubric, preserve its reasoning inputs and route uncertain or high-risk cases to review.
What is the difference between retrieval relevance and answer groundedness?
Retrieval relevance asks whether the context contains the evidence needed for the query. Answer support asks whether the response’s material claims follow from that supplied evidence. A system can retrieve the right passage and still answer incorrectly, or retrieve the wrong passage and accidentally produce a plausible sentence. Score both.
How should unanswerable questions pass?
Define the required behaviour in advance. Depending on the product, passing may mean stating that the available documents do not answer the question, asking for a qualifier or offering an approved escalation. The response should not convert missing evidence into a confident claim.
When should a RAG regression block release?
Block when it violates a hard gate or pushes a declared quality or operational measure beyond its approved boundary. Evaluate the relevant risk slice as well as the overall set. If the team has not stated the boundary and owner in advance, the release decision is not ready.
