Define recall@k in the embedding retrieval context
Recall@k is the share of a query's relevant documents found in the top-k, averaged over queries. Many RAG evals use the hit form: the share of queries with at least one relevant document in the top-k.
Picture asking a librarian for any book about World War II and watching them grab the top 10 from the shelf. Recall@10 asks one question: did at least one actual WW2 book make it into those 10? If yes, the librarian got credit for the query. Recall@10 across many queries is the fraction of times the librarian got credit. (That is the hit form many RAG evals use. The textbook form asks what share of all the WW2 books made it into the 10.) The blind spot: the metric doesn't care whether the WW2 book was the first one handed over or buried at position 10. It only cares that it showed up somewhere in the pile.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Recall@k is the metric you'll encounter first in any retrieval evaluation and the metric you'll outgrow last. It's clean, easy to compute, and easy to compare across systems. It's also incomplete in ways that matter for production decisions.
Its two main blind spots are rank ignorance and the index confound, and companion metrics fill the gaps.
Definition and calculation
Recall@k starts with a labeled evaluation set. Each entry in the set is a pair: a query, and a list of document IDs that are known to be relevant to that query. The labels typically come from human annotation or search logs (click-through as a weak signal). They can also come from strong LLM graders run over a candidate pool.
For each query, run the retrieval system and take the top-k results. Compare the top-k document IDs to the labeled relevant IDs. In the textbook IR form, the query scores the fraction of its labeled relevant IDs found in the top-k. In the hit form that many RAG evals use, the query scores 1 (hit) if at least one labeled relevant ID is in the top-k, 0 (miss) otherwise. The two match when each query has one relevant ID.
Recall@k is the mean of these per query scores across the evaluation set. A hit-form recall@10 of 0.85 across 100 queries means 85 queries had at least one relevant doc in their top-10 retrieval.
The metric has clean operational meaning. For a RAG pipeline that passes k=10 chunks to the LLM, recall@10 directly answers 'in what fraction of queries will the LLM see relevant context?'. That framing is what makes recall@k the right starting metric for most retrieval evals.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- BEIR benchmarks all report NDCG@10 as the primary metric, but recall@k breakouts are also published for downstream analysis.
- MTEB's retrieval category reports NDCG@10 in the headline; per-task recall@k is available in the detailed breakdown.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does measuring recall@k on an HNSW index confound embedding quality and index quality?
HNSW's recall against an exact baseline is < 1 and depends on parameters like ef_search, M, and the data distribution. If model A produces vectors that HNSW handles well and model B produces vectors that HNSW handles poorly, model A can score higher on production HNSW even if model B has better intrinsic embeddings. The way to separate is to measure both against an exact (flat) index.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Confusing recall@k with precision@k. Recall@k asks 'what share of the relevant docs made it in?' (the hit form asks 'did at least one?'). Precision@k asks 'how many of the top-k are relevant?' They measure different things and can move in opposite directions.
60 second bullets to scan on the way to the call.
Recall@k as the share of a query's relevant docs in the top-k, and the hit form (at least one relevant doc in the top-k)
Calculation walk-through (query loop, hit/miss decision, mean)
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.