Insights

How to Evaluate a RAG System Before Staff Rely on It

A document assistant that demos well can still fail one question in five. A small test set, two separate scores and a fixed bar for rollout turn a gut feeling into a decision.

Share:
How to Evaluate a RAG System Before Staff Rely on It

Fifty questions is enough to make a rollout decision and small enough to grade by hand in an afternoon. Each question is worth two percentage points, so a system that answers 45 correctly scores 90%. That number comes with real uncertainty: the standard error of a 90% score on 50 questions is the square root of 0.9 x 0.1 / 50, which is about 0.042, and twice that is roughly 8 points. A 90% result on 50 questions is consistent with a system whose true accuracy is anywhere from the low 80s to the high 90s. Good RAG evaluation is built around that fact. It uses a small, honest test set, scores the two halves of the system separately, and sets acceptance criteria wide enough to mean something.

This article covers the testing method only. The architecture being tested, from ingestion to cited answers, is described in private RAG over internal documents.

Why one accuracy score is not enough

A retrieval-augmented system does two jobs in sequence. First it finds passages; then a model writes an answer from them. A wrong answer can come from either step, and the fixes have nothing in common.

  • Retrieval failed. The passage that contains the answer never reached the model. The fix lives in chunking, the embedding model, the number of passages retrieved, or metadata filters.
  • Generation failed. The right passage was in the context, and the model misread it, merged it with another, or ignored it. The fix lives in the prompt, the model choice, or answer checks.

A single "correct or not" score mixes the two. A team that sees 80% and buys a larger model may be fixing a table that the chunker split in half. Scoring each step on its own tells you which lever to pull.

Building the test set from real staff questions

The test set is the most valuable artifact in the whole project, and the most common mistake is writing it from the documents instead of from the people. Questions invented by reading a policy manual tend to reuse the manual's wording, which makes retrieval look far better than it will be when a staff member types "can I carry over holiday" into a system whose source says "annual leave entitlement".

Where the questions come from

Collect wording that people already used:

  • Help desk tickets and shared-inbox emails from the last six to twelve months.
  • Questions asked in team chat channels, copied with the original spelling and shorthand.
  • Five minutes with each of four or five staff members from different roles: "What did you last have to look up, and where did you look?"

Gather 80 to 100 raw questions, then remove duplicates.

A mix that exposes weak spots

A test set made only of easy single-fact lookups will flatter any system. A useful split for 50 questions looks like this:

Question type Count What it tests
Single fact in one passage 25 Basic retrieval and reading
Answer in a table or list 8 Chunking of structured content
Needs two passages combined 7 Retrieval depth and synthesis
Not answerable from the documents 6 Willingness to say "not found"
Recent change (superseded document exists) 4 Picking the current version

The unanswerable questions matter most. A system that invents an answer when the documents are silent is more dangerous than one that sometimes misses, because staff cannot tell the invention from a real answer.

What each test case records

Each row needs a question, a short reference answer, the source document and section (or page) where the answer lives, the question type, and for unanswerable cases the expected response, usually a plain "not found in the documents". A subject expert, not the person who built the system, should write or approve the reference answers. Store the set in a spreadsheet or a CSV in version control and freeze it. Questions added later go into a new version, so scores stay comparable.

Scoring retrieval

Retrieval is the cheaper half to score because it needs no judgment once the source sections are recorded. For each question, look at the top k passages returned (k is whatever the system actually sends to the model, often 4 to 8) and ask one question: is the recorded source section among them?

The share of questions where it is present is called hit rate at k. Take an illustrative run: of the 44 answerable questions (50 minus the 6 unanswerable), the source appears in the top 5 for 37. Hit rate at 5 is 37 / 44, or 84%. The 7 misses are a short list to read by hand, and they usually cluster. If five of the seven are table questions, the fault is how tables are split, which is the subject of chunking documents for RAG. If the misses are questions that use staff shorthand, the embedding model or a keyword component is the place to look.

For the two-passage questions, a stricter version counts a hit only when both passages arrive. Some evaluation libraries compute a related score automatically. The Ragas library, for example, defines context recall as the share of claims in the reference answer that the retrieved context supports, and notes that it always requires a reference to compare against. Automated scores like this suit tracking change between runs; the hand-checked hit rate is easier to explain to approvers.

Scoring the answer

Answer scoring needs judgment, so keep the rubric short enough that two graders would agree. Four pass or fail checks per answer cover most of it:

  1. Correct. The answer matches the reference on the facts that matter.
  2. Grounded. Every claim is supported by the passages the system retrieved, not by the model's general knowledge.
  3. Cited. The answer points to the right document and section.
  4. Refused when it should. For the unanswerable questions, the system says it does not know.

Grounding has an automated counterpart. Ragas scores faithfulness as the number of claims in the response supported by the retrieved context divided by the total number of claims, so an answer with two claims and one unsupported scores 0.5. Controls that push this score up are covered in reducing LLM hallucinations in document Q&A.

Using a model as the grader

Grading 50 answers by hand takes an hour or two, which gets tiresome after every change. A second language model can grade against the reference answers. The research behind this approach, Judging LLM-as-a-Judge, reported that a strong judge model reached over 80% agreement with human preferences, about the same as humans agree with each other, and also documented position, verbosity and self-enhancement biases. Use it for regression runs, keep the human-graded first run as the baseline, and re-grade a random 10 questions by hand on each run to check the judge has not drifted.

Reading the two scores together

With both scores per question, every result falls into one of four cells:

Answer correct Answer wrong
Source retrieved Working Generation problem: prompt, model, answer checks
Source not retrieved Lucky or answered from general knowledge Retrieval problem: chunking, embeddings, k

The bottom-left cell deserves attention. A correct answer without the source passage means the model answered from its training data, which will fail as soon as the question is about something specific to the company. Count those as failures of grounding even though they look right.

Tracking regressions when something changes

Every change to the system is a reason to rerun the full set: a new model, a new embedding model, a different chunk size, a new prompt, a bigger k, or a large batch of new documents. Record each run with its configuration: model files, chunking settings and prompt text.

Compare runs question by question, not only by total. A run that scores 45 both before and after a change can hide three questions that broke and three that were fixed. The three that broke are what staff will notice, because people remember the question that used to work. A simple diff table with the columns question, old result, new result and note is enough. The broader routine for testing and swapping models is in updating on-premise AI models.

Acceptance criteria before rollout

Write the bar down before the first scored run, so the result cannot shape the target. The margin arithmetic from the opening sets the floor of what a 50-question set can distinguish: differences of two or three questions are noise, and a target only means something if it is several questions away from the score you would reject.

An illustrative set of criteria for an internal policy assistant:

  • Retrieval hit rate at k of at least 85% on answerable questions (38 of 44).
  • At least 40 of 50 answers both correct and grounded.
  • At least 5 of the 6 unanswerable questions answered with "not found", and zero confident invented answers among them.
  • No answer that is wrong and cited to a real document on a question tagged as high-stakes, such as pay, safety or legal deadlines.
  • No question that passed in the previous accepted run fails without an explanation.

Adjust the numbers to the cost of a wrong answer. A tool that drafts internal summaries can launch below these levels with a visible warning; a tool that answers questions about leave entitlements or safety procedures should meet them in full. If the system misses the bar, the four-cell table says which half to fix first, and the frozen test set says when the fix has worked.

Frequently asked questions

Is 50 questions really enough to evaluate a RAG system?

For a go or no-go decision on one document collection, it usually is, because the goal is to catch systematic failures, not to measure accuracy to the nearest point. If two configurations score within a few questions of each other, 50 cannot tell them apart, and the set should be extended to 100 or more before choosing on score alone.

Who should grade the answers?

Someone who knows the subject and did not build the system. If two graders are available, have both score the same ten answers first and agree on how to handle partial answers before grading the rest.

Should the test questions ever be added to the documents or the prompt?

No. Once a question or its answer is written into the prompt or a special document, the test measures recall of the test set rather than the system. Keep the test set stored apart from the indexed collection.

How often should the test set be refreshed?

Freeze a version for comparing runs, and add a new version a few times a year using questions staff actually asked through the live system. Questions the live system failed are the most useful additions.

Ready to Modernize Your Business?

Get your AI automation roadmap in minutes, not months.

Analyze Your Workflows →