A retrieval system can sound confident and still be wrong. The hard part of building with RAG is not generating an answer, it is knowing whether that answer is supported by the sources the system retrieved. That is an evaluation problem, and it deserves the same engineering as the retrieval itself. This guide sets out how we evaluate RAG systems: what to measure, which questions to measure with, how far to trust a model as the grader, and how the results decide a release and keep watch in production.

Evaluate retrieval and generation separately

Every RAG answer passes through two systems: retrieval finds passages, and the model writes an answer from them. Each fails in its own way. Retrieval can miss the passage that holds the answer, or bury it under weaker ones. The model can ignore what it was given, add details no source contains, or answer a different question from the one asked. A single end-to-end score hides which of these happened, and so which part to fix.

Four ways a RAG answer goes wrong, and where the fix usually lives
What went wrongWhat you seeMeasured byUsually fixed in
The passage that answers the question was never retrievedAn answer from the model's general knowledge, or a refusalContext recallChunking, embeddings, query rewriting, metadata filters
The right passage was retrieved but ranked lowAn answer built on a weaker passageContext precision, rank of the first relevant passageReranking, fewer and more focused passages
The answer goes beyond its sourcesPlausible details that no retrieved passage containsGroundedness (faithfulness)Instructions, required citations, model choice
The answer is grounded but misses the questionCorrect facts that do not answer what was askedAnswer relevanceInstructions, query understanding
Four ways a RAG answer goes wrong, and where the fix usually lives

Build the evaluation set from real questions

Cherry-picked demos hide the failures that matter. We build the evaluation set from questions people actually ask: search logs, support tickets, the questions a team fields every week. It includes the awkward ones, the vague ones, and the ones the system should decline because the answer is not in its sources. Where a policy or a price has changed, it includes the question whose answer changed, because a system that still answers from the old document is the failure users notice first.

Each item records more than the question:

  • The passages, by document and section, that a correct answer needs, so retrieval can be scored without a model judging it.
  • The facts a correct answer must contain, or a reference answer when the wording matters.
  • Whether the question should be answered at all, so a polite refusal can count as a pass.
  • Its slice: the type of question and the source it depends on, so a result can be read by area as well as overall.

Keep the set versioned and frozen between releases, so that results are comparable across changes. Questions generated by a model from your documents are useful for widening coverage, but they tend to be phrased like the documents they came from, which makes retrieval look better than it is. Keep them in a separate slice, and do not let them stand in for the questions real users ask. A few hundred carefully labeled real questions usually tell you more than thousands of generated ones.

Measure retrieval with labels, not opinions

Once each question lists the passages it needs, retrieval can be measured exactly. Score it at the depth you actually use: if the model receives the top eight passages, measure the top eight.

  • Recall at k: how many of the passages the answer needs appear in the top k. If a passage is not there, no model can ground an answer in it, so this is the first number to fix.
  • Precision at k: how much of what you pass to the model is relevant. Irrelevant passages cost tokens and give the model more to misread.
  • Rank of the first relevant passage, often reported as mean reciprocal rank. Position matters: language models use information at the start and end of a long context better than information in the middle (Liu et al., 2024).

Measure groundedness and answer relevance

Groundedness, also called faithfulness, asks whether the answer's claims are supported by the retrieved passages. The reliable way to score it is claim by claim: split the answer into its individual statements and check each against the passages, then report the share that are supported. Answer relevance asks whether the answer addresses the question that was asked. Context relevance asks whether the retrieved passages were focused on it. Ragas (Es et al.) and ARES (Saad-Falcon et al.) both evaluate these three dimensions; Ragas does it without reference answers, which makes it practical from the first week of a project.

Citations make groundedness checkable

Requiring the model to cite the passage behind each statement helps twice. Users can check an answer themselves, and the evaluation can test each citation directly: does the cited passage support the sentence it is attached to? An answer with correct facts and wrong citations is still a failure, because the next person to rely on that citation will be misled.

Using a model as the judge

Scoring thousands of answers by hand does not scale, and a model judge does. Treat it as a measuring instrument that needs calibrating, not as ground truth. In a widely cited study of the approach, strong model judges agreed with human preferences more than 80% of the time, about as often as people agree with each other. The same study documented biases: a judge can favor an answer because of where it appears, prefer longer answers, and rate its own answers more kindly (Zheng et al., 2023). Agreement also varies by what is being judged. On the Ragas authors' own dataset, their faithfulness score agreed with human annotators 95% of the time, answer relevance 78%, and context relevance 70% (Es et al.).

How we keep a judge honest

  • Label a sample by hand and measure the judge's agreement with people before trusting its scores. ARES shows how a few hundred human labels can correct a judge's errors statistically.
  • Ask the judge narrow questions. "Is this claim supported by this passage?" is judged far more reliably than "Is this a good answer?"
  • Where you can, judge with a different model from the one that answered.
  • When comparing two answers, swap their order and judge again, and instruct the judge not to reward length.
  • Measure agreement again whenever the judge's model or its instructions change. A new judge is a new instrument.

Turn the scores into a release decision

Evaluation earns its keep when it decides what ships. Run the frozen set against the current system and the candidate, and compare them metric by metric and slice by slice, not on one average. A change that lifts the average while breaking every question about one product line is a regression. Set the tolerance for each metric before you see the results, so the numbers cannot be argued into a pass afterward, and read every question whose result changed. The questions that moved teach more than the score does.

Treat changes to the documents the same way as changes to the code. Re-chunking, a new embedding model, or a large batch of new documents can shift retrieval as much as a new prompt can, so they go through the same gate.

Watching it in production

Offline evaluation tells you whether a change is safe to ship. Production monitoring tells you whether quality holds under real traffic. We log each question with the passages retrieved and their scores, the answer, its citations, and the versions of the model, the instructions and the index. When something looks wrong, that record shows whether retrieval or generation was at fault.

From those logs, a sample of real answers goes through the same groundedness and relevance checks every week, alongside signals that need no judge: the share of questions the system declines, answers with uncited claims, and the feedback users give. New questions that the evaluation set does not cover, once labeled, join the next version of the set. That loop is what keeps an evaluation set from slowly drifting away from what users actually ask.

Retrieval quality, not the model, was usually the lever that mattered most.Mudassar Iqbal

Practical recommendations

  1. Measure retrieval and generation separately, so you know which one to fix.
  2. Build a versioned evaluation set from real questions, including the ones the system should decline.
  3. Label the passages each question needs, so retrieval is measured without a judge.
  4. Calibrate any model judge against people before trusting it, and again whenever it changes.
  5. Set release tolerances in advance, compare by slice, and read the questions that changed.
  6. Log sources, citations and versions with every answer, and feed new questions back into the set.

This is the practice behind our generative AI work, and the evaluation and release discipline of our AI engineering service. The same principles carry over to voice, with audio and timing added: see How to evaluate a voice agent before it takes real calls.