Precision@k
Precision@k is the proportion of the top k items in a ranked list that are relevant to the query or task.
Retrieval Augmented Generation, The Foundational Ideas
Precision@k is the proportion of the top k retrieved results that are relevant to the query.
- How it is used
- Measures the relevant fraction of top-k retrieval results when assessing noise in a RAG context.
- How deep it goes
- Defines and calculates the fraction, then identifies its blind spots in ranking and generation utility.
- Examples
- Uses a five-document compliance query and a jacket search to contrast relevance counts with ranking and diversity.
- What you can do after
- Evaluate/understand it by calculating top-k precision and recognizing when coverage, ranking, or diversity needs another metric.
Read how Retrieval Augmented Generation, The Foundational Ideas explains Precision@k →
AI Model Evaluation
A ranking metric measuring the proportion of relevant items among the top K retrieved or recommended items.
- How it is used
- Evaluates whether ranked recommendations surface relevant items near the top before deployment to a user-facing product.
- How deep it goes
- Defines and computes the metric through a movie example, but stops short of treating relevance or offline scores as complete product evaluation.
- Examples
- Uses five recommended shows with three relevant items and a Python movie-rating evaluation using a threshold of 4 or higher.
- What you can do after
- Apply it via an offline ranking pipeline to compare recommendation changes and identify top-result relevance across user segments.
LLM Evaluation and Alignment, The Foundational Ideas
Precision@k is the proportion of relevant results among the first k results in a ranked retrieval list.
- How it is used
- Evaluates whether retrieved documents above the context-window cutoff are relevant enough to influence RAG generation.
- How deep it goes
- Defines the formula and works through top-three and top-five calculations, but does not provide implementation code.
- Examples
- Uses a five-document financial research ranking with relevant earnings and risk-factors documents at ranks three and four.
- What you can do after
- Evaluate retrieval quality by calculating the relevant-document share within a chosen context cutoff.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains Precision@k →
Also covered in
- LLM Customization and Fine-TuningIn early access (MEAP)
- Build an Advanced RAG Application (From Scratch)In early access (MEAP)
- Outlier Detection in Python
What to know first
- context windowA context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- precisionPrecision is the proportion of items predicted, selected, or retrieved as positive that are correct or relevant.
- retrieval-augmented generationRetrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
Related concepts
- precisionkind of · Precision is the proportion of items predicted, selected, or retrieved as positive that are correct or relevant.
- rank-aware metrickind of · A rank-aware metric quantitatively evaluates the quality of an ordered list relative to desired relevance or preference while accounting for item positions.
- relevancemeasures · Relevance is the degree to which information, a result, or a response pertains to a query, task, purpose, or information need.
- Retrievermeasures · A retriever is a software component that searches or queries an information source and returns items relevant to a query for use by downstream processes.
- irrelevant recommendation rateequivalent to · Irrelevant recommendation rate is the proportion of recommended items that are not relevant to the user.
- normalized discounted cumulative gaincontrasts with · Normalized discounted cumulative gain is a ranking metric that discounts graded relevance by item position and normalizes the result against the ideal ranking.
Questions about Precision@k
What is Precision@k?
Precision@k is the proportion of the top k items in a ranked list that are relevant to the query or task.
Which Manning books explain Precision@k?
Retrieval Augmented Generation, The Foundational Ideas, AI Model Evaluation and LLM Evaluation and Alignment, The Foundational Ideas.
What should I know before learning Precision@k?
Manning books that teach Precision@k usually introduce context window, language model, precision and retrieval-augmented generation first.
What is the difference between Precision@k and normalized discounted cumulative gain?
Precision@k is the proportion of the top k items in a ranked list that are relevant to the query or task. Normalized discounted cumulative gain is a ranking metric that discounts graded relevance by item position and normalizes the result against the ideal ranking.
What is Precision@k a kind of?
Precision@k is a kind of precision. Precision is the proportion of items predicted, selected, or retrieved as positive that are correct or relevant.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


