Book a 30-min callBook a call

How to evaluate a RAG system: retrieval metrics, answer faithfulness and a test set

Evaluate RAG in two halves: retrieval with recall@k, MRR and nDCG, and answers with faithfulness and relevance, on a labeled test set that runs in CI.

Question cards feeding a retriever box and an answer box, each scored on its own gauge, with a loop arrow back to the questions.
Written by
BYD Tech
Published
Topic
Deep dives
Reading time
11 min read

Questions people ask

How many questions does a RAG test set need?

There is no fixed number. You need enough that every question type and important document group is covered, and enough that a real change moves the score more than run-to-run noise does. Start with the questions you can label well and grow the set from real failures.

Can I generate the test set with an LLM?

Partly. Generated questions fill gaps, but they tend to reuse the source chunk’s words, which makes retrieval look better than it is, and they rarely need two documents. Review them by hand, tag them as synthetic and keep real questions as the core of the set.

What is the difference between faithfulness and correctness?

Faithfulness checks that every claim in the answer is supported by the retrieved context. Correctness checks the answer against a reference. If retrieval returned the wrong document, an answer can be fully faithful and still wrong.

Should I track recall@k or MRR?

Both, for different reasons. Recall@k, with k set to the number of chunks in your prompt, tells you whether the model saw the answer at all. MRR tells you how high the first relevant chunk ranked, which matters when you cut the list short or rerank.

Can the same model generate the answers and grade them?

It can, but it is better not to. Zheng et al. describe a self-enhancement bias, where judges may favor their own outputs, and Anthropic’s eval guidance recommends grading with a different model. Whichever you use, check the judge against human labels on a sample.

Building something like this?