Home / Insights / Enterprise AI

How to test a RAG system when the answer is different every time

Exact-match testing on a generative system measures nothing. Four axes — retrieval recall, citation precision, refusal correctness, stability — and the run protocol that makes a score comparable across releases.

Enterprise AI · Evaluation · 2026-11-29 · 7 min read

The standard first attempt at evaluating a retrieval-augmented system is a spreadsheet of questions with one expected answer each, compared by string match. It fails immediately and for two reasons: the model will phrase a correct answer differently every run, and a large share of the questions that matter most have answers that are wrong to give.

The fix is not a better string metric. It is to stop grading the prose and start grading the four things the prose depends on.

The four axes

Build the gold set like a lawyer, not like a demo

Fifty to a hundred and twenty pairs is enough to see movement, if they are chosen deliberately. Deliberately means including the ugly cases:

Each pair stores the expected answer facts — not a sentence — plus the document ids that legitimately support them, and a label: answerable / unanswerable / superseded.

Run protocol

Turning scores into a release gate

Absolute numbers are less useful than a baseline plus a rule. Ours, expressed generically:

MetricGate
Retrieval recall (answerable)no regression below 0.95
Citation precisionno regression below 0.90
Refusal correctness (unanswerable)no regression below 0.85
Cross-run spanmust stay under 0.10

A release that improves average quality while widening the span has become less trustworthy, and in a customer-facing deployment that is a regression even if the average went up.

What this does not measure

Tone, latency, cost per answer, and whether a human would accept the reply in a real conversation. Those need a small human panel and a sampled transcript review; they are not a substitute for the four axes, and the four axes are not a substitute for them. The mistake is testing only one of the two and calling it quality.

Frequently asked

Why not just compare the answer to an expected answer?

Because a correct answer is phrased differently on every run, and because the questions that matter most — the ones with no answer in the corpus — cannot be graded by string match at all. Grade the facts and the citations instead, and measure whether the system refuses when it should.

How many test questions do I need?

Fifty to one hundred and twenty deliberately chosen pairs will show movement. The composition matters more than the count: at least a fifth unanswerable, plus superseded-document near-duplicates, multi-hop questions, table questions and realistically phrased customer questions.

Is temperature zero enough for reproducible results?

No. Sampling, batching and retrieval tie-breaking still introduce variation. Run each question three to five times, report a median with a span, and treat a widening span as a regression even when the average improves.

Related notes


Written by 双玺堂 ROBOTICS from live project work. More notes: Insights. 中文技术文章 900+ 篇:文章库.