LIVE·The trends shaping tomorrow's world.
AI

Precision@K, Recall@K and MRR Explained

What Precision@K, Recall@K and Mean Reciprocal Rank measure, how to compute each step by step, how they differ from MAP and nDCG, and which to use for RAG.

Precision@K is the share of the top K results that are relevant. Recall@K is the share of all relevant documents that made it into the top K. Mean Reciprocal Rank (MRR) averages, across queries, 1 divided by the rank of the first relevant result. Precision@K tells you how clean the top of the list is, Recall@K tells you how much you missed, and MRR tells you how quickly a user (or a language model) hits the first useful result.

Why ranked retrieval needs its own metrics

Classic precision and recall were defined for sets. NIST's TREC evaluation guide puts them like this [1]:

  • Recall = relevant items retrieved ÷ relevant items in the collection: "the ability of a system to present all relevant items."
  • Precision = relevant items retrieved ÷ total items retrieved: "the ability of a system to present only relevant items."

TREC notes these "are set-based measures," evaluating "an unordered set of retrieved documents" [1]. Search engines and RAG retrievers return ordered lists, and order matters: a relevant document at rank 1 is worth more than one at rank 50. The fix is to cut the list at a rank K and compute the metrics on the top K. Cambridge's IR lecture notes point out that web search, where recall is hard to measure, often uses "precision at top k, e.g., k = 10," or measures that reward getting rank 1 right more than rank 10 [6].

In a RAG system, K has a concrete meaning: it's how many chunks you pass to the language model.

The setup for our examples

Every metric below needs relevance judgments: for each test query, a list of which documents are relevant. TREC calls these qrels. You build them by hand-labeling, from user clicks, or with an LLM judge (see RAG evaluation using RAGAS).

Our illustrative query has four relevant documents in the whole collection. The retriever returns ten results. Results at ranks 2, 3 and 6 are relevant; the fourth relevant document isn't in the top ten.

Rank

1

2

3

4

5

6

7

8

9

10

Relevant?

No

Yes

Yes

No

No

Yes

No

No

No

No

The diagram for this article shows the same list.

Precision@K

Precision@K = (relevant results in the top K) ÷ K

trec_eval, NIST's standard evaluation tool, describes it as "precision measured at various doc level cutoffs in the ranking" [2].

Worked example (illustrative):

K

Relevant in top K

Precision@K

1

0

0 ÷ 1 = 0.00

3

2

2 ÷ 3 = 0.67

5

2

2 ÷ 5 = 0.40

10

3

3 ÷ 10 = 0.30

Things to know:

  • Short lists count as misses. If the system returns fewer than K results, trec_eval assumes "nonrelevant docs fill in the rest." Its example: 15 documents retrieved, 4 relevant, gives P@20 = 4 ÷ 20 = 0.2 [2].
  • It ignores order within the top K. A relevant document at rank 1 and one at rank K count the same.
  • It doesn't average well across queries. trec_eval warns that P@20 "has very different expected characteristics if there [are] 300 total relevant docs for a topic as opposed to 10" [2]. A query with only two relevant documents can never score above 0.2 at K = 10.
  • It doesn't need to know every relevant document, only whether the top K are relevant. That makes it practical for large collections.

Use it when what matters is the quality of what the user (or model) actually sees, and wasted slots are costly.

Recall@K

Recall@K = (relevant results in the top K) ÷ (total relevant documents for the query)

trec_eval defines it as "relevant retrieved / relevant" measured at document cutoffs, and also notes it "does not average well" [3].

Worked example (illustrative), with four relevant documents in total:

K

Relevant in top K

Recall@K

3

2

2 ÷ 4 = 0.50

5

2

2 ÷ 4 = 0.50

10

3

3 ÷ 4 = 0.75

Things to know:

  • You need the denominator. Recall requires knowing how many relevant documents exist, which is hard in large collections. Large test collections such as TREC-COVID judge a pool of candidates drawn from existing systems, and BEIR's authors showed the catch: documents nobody judged are treated as nonrelevant, and the TREC-COVID pool was still biased toward lexical approaches, which penalizes systems that find relevant documents the pool missed [7]. In their TREC-COVID analysis, manually judging those unseen top-10 "holes" raised nDCG@10 scores for every model they checked, by different amounts [7].
  • It never decreases as K grows. Recall@10 is always at least Recall@5.
  • Precision and recall pull in opposite directions. TREC's guide notes that as recall rises, precision typically falls, because retrieving more relevant documents also brings in more nonrelevant ones [1].

Use it when missing a relevant document is the expensive failure. That's usually the case in RAG: if a fact isn't in the top K chunks, the model can't use it.

MRR (Mean Reciprocal Rank)

First, the reciprocal rank (RR) for one query: 1 divided by the rank of the first relevant result, and 0 if no relevant result is retrieved. trec_eval implements exactly this: it scans down the list, stops at the first relevant document, and records 1 ÷ its rank [4]. In our example, the first relevant result is at rank 2:

RR = 1 ÷ 2 = 0.5

MRR is the mean of RR over all test queries. trec_eval describes reciprocal rank as "most useful for tasks in which there is only one relevant doc, or the user only wants one relevant doc" [4].

Worked example (illustrative), four queries, MRR@10:

Query

Rank of first relevant result

Reciprocal rank

A (our example)

2

1 ÷ 2 = 0.50

B

1

1 ÷ 1 = 1.00

C

4

1 ÷ 4 = 0.25

D

none in top 10

0

MRR = (0.50 + 1.00 + 0.25 + 0) ÷ 4 = 1.75 ÷ 4 = 0.4375

Things to know:

  • Only the first hit counts. A list with relevant documents at ranks 1, 2 and 3 scores the same RR (1.0) as a list with only rank 1 relevant.
  • It's steep at the top. Moving the first hit from rank 2 to 1 adds 0.5; moving it from 10 to 9 adds about 0.011.
  • "MRR@10" means a cutoff. Results beyond rank 10 count as not found. ColBERT's authors, for example, report MRR@10 on the MS MARCO passage-ranking dataset built from Bing queries [8].

Use it when users need one good answer: navigational search, question answering, "find the policy document."

The metrics side by side


Precision@K

Recall@K

MRR

Question it answers

How much of the top K is useful?

How much of the useful stuff is in the top K?

How soon does the first useful result appear?

Formula (one query)

relevant in top K ÷ K

relevant in top K ÷ all relevant

1 ÷ rank of first relevant (0 if none)

Order-sensitive within top K

No

No

Yes, for the first hit only

Needs total relevant count

No

Yes

No

Multiple relevant docs

Counts them

Counts them

Ignores all but the first

Our example

P@3 = 0.67, P@10 = 0.30

R@3 = 0.50, R@10 = 0.75

RR = 0.5

Best for

What the user sees

Coverage; RAG context

Single-answer tasks

Related metrics you'll meet

Average precision (AP) and MAP. AP averages the precision at each rank where a relevant document appears, counting relevant documents that were never retrieved as precision 0 [1]. TREC's guide says it "rewards systems that retrieve relevant documents quickly" [1]. For our example:

AP = (1/2 + 2/3 + 3/6 + 0) ÷ 4 = (0.500 + 0.667 + 0.500 + 0) ÷ 4 ≈ 0.417

MAP is the mean of AP over queries [6]. TREC's own example, relevant documents at ranks 1, 2, 4 and 7, gives precisions 1, 1, 0.75 and 0.57, for an AP of 0.83 [1].

R-precision. Precision at rank R, where R is the number of relevant documents for the query [1]. In our example R = 4, and two of the top four are relevant, so R-precision = 2 ÷ 4 = 0.5.

nDCG. Normalized Discounted Cumulative Gain handles graded relevance (for example, 0 = irrelevant, 1 = partly, 2 = highly relevant) and discounts gains further down the list; trec_eval computes it following Järvelin and Kekäläinen's 2002 definition, using the graded values in the qrels as gains [5]. BEIR reports nDCG@10 for all its datasets [7]. Use it when "somewhat relevant" and "exactly right" need different credit.

RAG frameworks borrow these ideas. RAGAS's context precision, for instance, is the average of Precision@k taken at the ranks where relevant chunks appear (as defined in its documentation as of November 2026), much like AP restricted to the retrieved list [9].

Choosing metrics for a RAG retriever

  1. Lead with Recall@K at your actual K. If you pass 5 chunks to the model, Recall@5 tells you how often the needed facts get through. Missing context is the failure the model can't recover from.
  2. Add MRR or nDCG for ordering. Models may not use every position equally well, and a reranker exists to move the best chunk up. MRR shows whether it does.
  3. Watch Precision@K for cost and noise. Low precision means paying for tokens that don't help and giving the model distractors.
  4. Report several K values. Recall@5, @10 and @20 together show whether a bigger K or a better ranker would help more.
  5. Average over many queries and segment them. Look at exact-identifier queries separately from natural-language ones; semantic and keyword search fail on different kinds.
  6. Pair with end-to-end checks. Retrieval metrics don't tell you whether the final answer was right; combine them with answer-level evaluation such as RAGAS.

A quick comparison workflow

  • Freeze a test set of real queries with relevance judgments.
  • Run the baseline (say, vector search), then the candidate (say, hybrid search plus reranking).
  • Compute Recall@K, MRR and nDCG@K for both with a standard tool such as trec_eval, so definitions match.
  • Look at the queries where the candidate lost, not just the averages.

Limitations

  • Metrics depend on judgments. Incomplete or biased labels skew every number, as BEIR's analysis of unjudged documents showed [7].
  • Binary relevance is crude. Precision, recall and MRR treat a document as relevant or not; nDCG is the usual fix.
  • Averages hide failures. An MRR of 0.6 can mean many easy queries and a cluster of complete misses.
  • Definitions vary in edge cases. Tools differ on how they treat short lists or ties. trec_eval pads short lists with nonrelevant documents for P@K, but its set_P measure doesn't [2]. State which tool and settings you used.

Frequently asked questions

What is a good Precision@K?

It depends on how many relevant documents exist per query. If a query has only two relevant documents, the best possible Precision@10 is 0.2. Compare systems on the same test set rather than against a universal target.

What's the difference between MRR and MAP?

MRR looks only at the first relevant result per query [4]. MAP averages precision at every relevant result, so it rewards ranking all relevant documents high [1]. Use MRR for single-answer tasks and MAP when every relevant document matters.

Why does Recall@K need the total number of relevant documents?

Because recall is a fraction of all relevant documents [1][3]. If you don't know the total, you can't compute the denominator. In practice, test collections judge a pool of candidates gathered from several systems, which gives an estimate that can miss some relevant documents [7].

Should K match the number of chunks I send to the LLM?

Yes, at least for your headline metric. Recall at the K you actually use is the closest retrieval metric to "did the model get the facts it needed." Report a larger K as well to see whether reranking could help.

Is MRR the same as reciprocal rank?

Reciprocal rank is the score for one query. MRR is the mean of those scores across a set of queries.

Sources

  1. National Institute of Standards and Technology. "Common Evaluation Measures." TREC 2007 proceedings appendix. https://trec.nist.gov/pubs/trec16/appendices/measures.pdf
  2. NIST. trec_eval source, m_P.c (Precision at cutoffs). GitHub. Accessed November 2026. https://github.com/usnistgov/trec_eval/blob/main/m_P.c
  3. NIST. trec_eval source, m_recall.c (Recall at cutoffs). GitHub. Accessed November 2026. https://github.com/usnistgov/trec_eval/blob/main/m_recall.c
  4. NIST. trec_eval source, m_recip_rank.c (Reciprocal rank). GitHub. Accessed November 2026. https://github.com/usnistgov/trec_eval/blob/main/m_recip_rank.c
  5. NIST. trec_eval source, m_ndcg_cut.c (nDCG at cutoffs). GitHub. Accessed November 2026. https://github.com/usnistgov/trec_eval/blob/main/m_ndcg_cut.c
  6. Teufel, S. "Lecture 5: Evaluation." Information Retrieval, Computer Science Tripos Part II, University of Cambridge, 2014–15. https://www.cl.cam.ac.uk/teaching/1415/InfoRtrv/lecture5.pdf
  7. Thakur, N. et al. "BEIR: A Heterogeneous Benchmark for Zero-shot Evaluation of Information Retrieval Models." arXiv:2104.08663, 2021. https://arxiv.org/abs/2104.08663
  8. Khattab, O. and Zaharia, M. "ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT." SIGIR 2020. https://arxiv.org/abs/2004.12832
  9. Ragas. "Context Precision." Accessed November 2026. https://docs.ragas.io/en/stable/concepts/metrics/available_metrics/context_precision/