PracticeRetrieval & RAG
Retrieval Metrics (Recall@k, MRR, NDCG)
At a glance
Whether the right passage arrived and how high it ranked are separate questions with separate fixes.
- Who this is for
- Engineers and technical readers learning the terms used in AI systems.
- Topics
- Retrieval & RAG
- Practice
In short
NDCG scores a ranked list by how useful each result is and how high it sits, from 0 to 1 against the best possible order, while recall at k asks whether the right passage arrived at all and MRR asks how high the first correct one ranked. Bigcircle recommends reading recall at the candidate depth and again at the final depth before any prompt change, because a recall of 0.6 leaves four questions in ten unanswerable whatever the prompt says. How to build LLM evals keeps those depths apart.
Key facts
Definition
Recall at k checks whether a gold passage reached the top k, mean reciprocal rank averages one over the rank of the first correct hit, and NDCG grades every result and discounts the ones lower down.
How Bigcircle does it
- Bigcircle recommends slicing recall by query type and tracking a separate exact-match rate, because embeddings blur part numbers, error codes and names that an average over prose hides.
- Track filter loss where a permission or metadata filter removed a gold passage, since an aggregate counts it as a retrieval miss and the fix is in the filter.
- On its own prospect intelligence engine, Bigcircle watches the distillation ratio of sources to grounded evidence in production, because a run where that ratio collapses is usually a retrieval problem and live traffic has no labels.
Comparison
A stack with recall at 20 of 0.95 and an MRR of 0.2 has found the right passage and buried it, which is a reranking problem, whereas weak recall at candidate depth means the passage never arrived.
Key number
Three results graded 3, 2 and 0 score an NDCG of 1.0 in that order and about 0.65 in reverse, with the same passages retrieved.
NDCG, normalised discounted cumulative gain, is a ranking metric. Each result gets a usefulness grade, results lower in the list count for less, and the total is divided by the score of the best possible order, so 1.0 means perfectly ordered. It is one of three numbers worth knowing for search inside an AI system, because retrieval fails in two unrelated ways. The passage that answers the question can be missing from the results, or it can be present and ranked too low to survive into the prompt. Those need different fixes, so they need different numbers.
Recall@k: did the passage arrive at all#
Recall@k asks whether a gold passage, one a person marked as answering the query, appeared in the top k results. It caps everything downstream, because a passage the model never sees cannot be used however good the prompt is.
Measure it at two depths. Recall at your candidate depth, often 50, says what retrieval could deliver. Recall at your final depth, often 5 after reranking, says what the model receives. The gap between them is the reranker's contribution, and the depth-50 number is the most a reranker can reach.
At a recall of 0.6, four questions in ten cannot be answered before the model runs, so any prompt change measured after that point is being compared under a ceiling nobody raised. Bigcircle recommends measuring recall before any prompt or model change for that reason.
MRR and NDCG: how high it ranked#
Mean reciprocal rank (MRR) averages 1/rank of the first correct result across queries. A hit at position one scores 1.0 and a hit at position four scores 0.25. It tells you whether the right passage will survive when the context is trimmed to the top few.
NDCG is the graded version, for when passages are not simply right or wrong but more or less useful. A worked example: three results graded 3 (answers the question), 2 (useful context) and 0 (off topic). In that order, the discounted gain is 3/log2(2) + 2/log2(3) + 0, about 4.26, which is also the best possible score, so NDCG is 1.0. Return them in reverse and the gain falls to about 2.76, an NDCG of about 0.65, though the same three passages arrived.
Two practical notes. Libraries differ on the gain: some use the grade itself, others 2^grade minus 1, which weighs the top grade far more heavily, so two NDCG numbers are comparable only on the same formula and the same cut-off. And NDCG needs graded labels, which take longer to write than yes or no. Use it when your labels carry degrees; MRR is enough when each query has one correct passage.
The rank metric and recall together diagnose what neither does alone. Recall@20 of 0.95 with an MRR of 0.2 means the system finds the right passage and buries it, which is a reranking problem. A weak recall at candidate depth means the passage never arrived, which is a chunking or search problem.
Exact-match rate and filter loss#
Two failures hide inside an averaged recall number.
Embeddings blur identifiers: part numbers, error codes, names. A corpus that retrieves well on prose can fail exactly the queries that matter most, so track a separate exact-match rate on queries that contain one. On our prospect intelligence engine, "Are they using Snowflake?" is a keyword problem, and pure vector search will happily return a passage about a different data warehouse.
Filter loss counts the cases where the gold passage was retrieved and then removed by a permission or metadata filter. In an aggregate it looks the same as a retrieval miss, and the fix is in the filter, not the embedding.
A ratio to watch in production#
Labelled metrics need a labelled set, and production traffic arrives without labels. On the prospect intelligence engine, Bigcircle's own system, we watch the distillation ratio instead: how many collected sources survive into grounded evidence. On one run it took 420 candidate sources down to the 6 that answered the question. A run where that ratio collapses is usually a retrieval problem. A short result is also the safe failure there, because a profile with too little evidence is visibly short, and one filled in without evidence is not.
Use the labelled metrics to choose and tune retrieval, and the unlabelled ratio to notice when it drifts. For a reference point on how far retrieval can move, Anthropic's contextual retrieval tests found plain embedding search missing the right passage from the top 20 in 5.7% of queries, falling to 1.9% with contextual embeddings, contextual BM25 and reranking together.