Glossary

Precision@k

Precision@k is the fraction of the top k retrieved results that are actually relevant — capped at 1/k when only one relevant document exists.

Precision@k measures the fraction of the top k retrieved results that are actually relevant to the query — the number of relevant documents in that window, divided by k itself.

Where recall@k asks "did we find everything relevant," precision@k asks the opposite question: "of what we handed back, how much of it was actually useful." A system can have perfect recall by returning every document in the corpus — recall@k=1.0 trivially — while precision collapses toward zero, because almost everything returned is noise. The two metrics exist together specifically to prevent either kind of cheating.

How it works

The formula is:

precision@k = (relevant documents in top k) / k

Unlike recall@k, precision@k's denominator is fixed — it's always k, not the total number of relevant documents — which creates a structural ceiling worth naming honestly: if a query has exactly one relevant document anywhere in the entire corpus, precision@k can never exceed 1/k, no matter how good the retrieval system is, because at most one of the k slots can ever be filled with something relevant. Precision@10 for such a query tops out at 0.1 even for a perfect retriever — the other nine slots are mathematically guaranteed to be "irrelevant" by the query's own ground truth, whether or not they're actually useful context. This is why precision@k is only a fair comparison across systems evaluated on the same queries with the same number of gold-relevant documents.

Why it matters

Precision@k is the metric that catches a retriever that's technically finding the right documents but drowning them in noise — a failure that matters enormously for RAG, because every irrelevant chunk that makes it into the prompt competes for the model's attention and context budget with the chunk that actually contains the answer. A high recall@k paired with a low precision@k is a specific, actionable signal: the retriever is casting too wide a net, and either k should shrink or a reranker should be added to clean up the top of the list before it reaches the model.

A worked example

A query retrieves the top 5 results, and 2 of them are genuinely relevant to it.

precision@5 = 2 / 5 = 0.4

Now consider a different query where the golden dataset marks exactly 1 document in the whole corpus as relevant, and the system retrieves it correctly at rank 1 within a top-10 window. Even in this best-case outcome, precision@10 = 1/10 = 0.1 — a low-looking number that actually represents perfect retrieval, an artifact of the single-gold-document ceiling rather than a system failure. Reading precision@k without checking how many relevant documents existed per query is a common and avoidable misinterpretation.

How Miatz teaches it

Learners deliberately construct one golden query with a single relevant document and compute its precision@k ceiling by hand before touching a real eval suite — so a "disappointing" 0.1 precision score is recognized as expected structure, not treated as a bug to chase.

Learn it by doing it.

Miatz turns definitions into judgment — the free founding cohort trains you on exactly these concepts, hands-on.