New Tool Radar

AI Concepts

How to Measure RAG Retrieval Recall at Top-K

Measure whether the right chunk is in the top results at all, before blaming the model for a wrong answer.

Schematic illustration with three step boxes: build a test set, run each question, and count recall at each k.

When a RAG answer is wrong, the cause is often retrieval, not generation: the right chunk never reached the model. Recall at k measures exactly that: for how many test questions does the chunk holding the answer appear in the top k results. Measure it before you change the model, the prompt, or the chunk size, because each of those fixes a different failure.

Before you start

A test set of questions with the source chunk noted for each, and a way to run retrieval and see the ranked chunk list.

Build a test set with known answers

Write 20 questions that your documents can answer, and for each one note the chunk that holds the answer. Use questions your readers actually ask, not questions written to be easy for the retriever.

Include a few hard ones: paraphrases that share no words with the source, and questions about rare terms such as product codes. Easy questions hide retrieval problems.

Run each question and record the rank

For each question, run retrieval and write down the rank of the answer chunk, or mark it as missing if it is not in the top 10. Do not judge the generated answer yet: this test is about retrieval only.

Keep the retrieval settings fixed while you measure. Changing the chunk size halfway through makes the numbers meaningless.

Count recall at each k

Compute recall at 1, 3, 5 and 10: the share of questions whose answer chunk appears in the top k. If recall at 10 is low, the retriever is the problem. If recall at 10 is high but recall at 1 is low, the ranking is the problem and a reranker may help.

Write the numbers down with the date and the settings used. Without that record you cannot tell whether a later change helped or hurt.

Practice check: fictional Maple Corner help centre, 20 questions

The table below is fictional practice material, worked out by hand from the stated ranks. It is the expected result for the practice set, not a run of any retrieval system.

k Questions with answer in top k Recall Reading
1 9 of 20 45% Ranking is weak
3 14 of 20 70% Better, still gaps
5 17 of 20 85% Most answers found
10 19 of 20 95% Retrieval works, ranking lags

Recall at 10 is 95 percent but recall at 1 is only 45 percent, so the retriever finds the answers and the ranking buries them. A reranker is the next fix, not a bigger model.

Expected result. UNTESTED: the recall numbers in the practice table are worked out by hand, not measured by running a retriever. Build your own 20-question test set, record the rank of each answer chunk, and compute recall at 1, 3, 5 and 10.

Limits

  • Recall says nothing about whether the model uses the chunk correctly once it has it.
  • A test set written by the same person who wrote the documents flatters the retriever; use real user questions where you can.

Sources

See all