Baraa Said العربية Send a message

How to tell if your RAG system is right: a practical evaluation guide

A RAG system can sound confident and still be wrong. Evaluating it means checking two things separately: did retrieval find the right passages, and did the answer stay faithful to them. Here is the test set, the metrics and the routine I use, without expensive tooling.

A checklist of answers, some marked correct and one marked wrong

What RAG evaluation actually measures

Retrieval-augmented generation (RAG) answers a question in two steps: it retrieves passages from your documents, then a language model writes an answer from them. Each step fails in its own way, so evaluate them separately:

  • Retrieval quality: did the system find the passages that contain the answer?
  • Answer quality: did the model use those passages faithfully, and did it answer the question that was asked?

If you only score the final answer, you can't tell which half broke.

A wrong answer built on the right passages is a prompt or model problem. A wrong answer built on the wrong passages is a search problem, and no prompt will fix it.

Start with a small, honest test set

You don't need thousands of examples. Fifty to a hundred real questions beat a large synthetic set, as long as they come from the people who will use the system. For each question, write down:

  1. The question in the user's own words, spelling mistakes and dialect included.
  2. The document or passage that holds the answer.
  3. A short reference answer.

Then add a handful of questions the system should refuse, because your documents don't cover them.

That last group matters more than it looks. A system that always answers will score well until a customer asks something it doesn't know, and then it invents.

The four metrics worth tracking

The open-source RAGAS framework popularised a useful vocabulary for this. These four cover most of what goes wrong:

  • Context recall: did retrieval find the passage with the answer? When it's low, look at chunking, weak embeddings or missing keyword search.
  • Context precision: were the top results relevant, or mostly noise? When it's low, you are returning too many results or have no reranker.
  • Faithfulness: is every claim in the answer supported by the retrieved text? When it's low, the model is filling gaps from memory.
  • Answer relevance: does the answer address what was asked? When it's low, look for prompt drift or answers that run too long.

Faithfulness is the one I watch most. It is measured by splitting an answer into individual claims and checking each claim against the retrieved passages.

An answer that is 90% supported still contains an invention. In customer service, that one invented price or policy is the part that gets screenshotted.

Test retrieval like a search engine

Retrieval is a search problem, so borrow search metrics:

  • Hit rate at k: how often the right passage appears in the top k results, where k is usually between 3 and 10.
  • Mean reciprocal rank (MRR): how high the first right passage appears in the list.

Position matters. In the paper Lost in the Middle, researchers at Stanford showed that language models use information at the start and end of a long context much better than information buried in the middle. Getting the right passage into the top three is worth more than getting it somewhere in the top twenty.

Using a model as the judge

Grading hundreds of answers by hand doesn't scale, so most teams use a strong language model as a judge. You give it the question, the retrieved passages and the answer, and ask for a verdict on each metric. It works if you follow three rules:

  • Grade one thing at a time. "Is this claim supported by this passage?" is far more reliable than "rate this answer from 1 to 10".
  • Ask for evidence. Make the judge quote the passage that supports each claim. A verdict without a quote is a guess.
  • Check the judge. Grade 30 to 50 items by hand and compare. If you and the judge disagree often, fix the rubric before you trust the numbers.

Arabic needs its own test set

If your users write in Arabic, an English test set tells you very little. Arabic questions arrive in Modern Standard Arabic, in dialect, in Arabizi (Arabic written in Latin letters) and mixed with English. Each of these breaks retrieval in a different way, so the test set should contain all of them. I go into the details in building a RAG chatbot that understands Arabic.

A routine that keeps working

  1. Run the test set on every change to the prompt, the model, the chunking or the embeddings. A change that fixes one question often breaks three others.
  2. Read the failures, not just the scores. Ten wrong answers read carefully teach you more than a dashboard does.
  3. Turn real mistakes into test cases. Every time a user hits a wrong answer in production, add that question to the set.

This is how I approach Faheem, the Arabic assistant that businesses train on their own documents. It is also the habit I rely on when grading model output day to day: decide what "correct" means before you look at the answer.

Write to me.

Hiring for an AI or full-stack role, or need a system built? One message is enough. I reply within one business day.

Send a message