Skip to content

Precision@k

Precision@k asks: what fraction of the first k results were relevant? The denominator is the requested value of k, not a smaller number of results that happened to be returned.1

Precision@k = relevant results in the first k / k

A search returns three passages. One answers the question and two do not.

Precision@3 = 1 relevant result / 3 results = 0.33

High precision keeps distracting evidence out of the model’s context. It does not tell you whether the retriever missed other relevant passages.

This book calculates Precision@k only when the retriever returned at least k results. If a query returns fewer results, either use a valid smaller k and label it clearly or record the run as incomplete. Dividing by the shorter returned list while still calling the metric Precision@k changes the denominator and makes runs harder to compare.

Always state k, the relevance-labeling method, and how ties or duplicate passages are handled. Compare precision with Recall@k; optimizing only one can hide a weak retrieval system.

  1. Google for Developers, Precision@k. Microsoft gives the same retrieval-oriented definition in its RAG information-retrieval guidance.