Context precision
Context precision is a retrieval metric measuring how much retrieved context is relevant to answering a query and, in some formulations, how highly relevant items are ranked.
LLM Evaluation and Alignment, The Foundational Ideas
Context precision is a retrieval-quality metric measuring whether answer-contributing retrieved passages are ranked early in the supplied context.
- How it is used
- Diagnoses retrieval noise and ranking in retrieval-augmented generation alongside generation-quality metrics.
- How deep it goes
- Defines a rank-weighted calculation over retrieved passages, works a numerical example, and illustrates model-based relevance labeling.
- Examples
- Calculates a 0.417 score for five ranked financial research passages, two of which contribute to the answer.
- What you can do after
- Diagnose retrieval noise and choose method-specific interventions using context precision alongside other RAG metrics.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains context precision →
Build an Advanced RAG Application (From Scratch)
Context precision measures the degree to which retrieved context is relevant and highly ranked for answering a query.
- How it is used
- Evaluates whether ranked retrieval supplies relevant context for RAG generation.
- How deep it goes
- Defines relevance and ranking behavior but does not provide a scoring formula or implementation procedure.
- Examples
- Uses ranked retrieved chunks, RAGAS metrics, and a core-metrics figure as evaluation artifacts.
- What you can do after
- Evaluate retrieval configurations and track whether the best supporting context reaches the language model first.
Read how Build an Advanced RAG Application (From Scratch) explains context precision →
Also covered in
What to know first
- recallRecall is the proportion of all relevant or actual positive items that a system successfully retrieves or correctly identifies.
- context windowA context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
- similarity searchSimilarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
- precisionPrecision is the proportion of items predicted, selected, or retrieved as positive that are correct or relevant.
Related concepts
- average precisionimplements · Average precision is a ranking or classification metric that summarizes precision across the recall levels of a precision-recall curve.
- Ragaspart of · Ragas is an open-source framework and Python library for evaluating retrieval-augmented generation systems and applications.
- precisionkind of · Precision is the proportion of items predicted, selected, or retrieved as positive that are correct or relevant.
- retrieval rankingmeasures · Retrieval ranking is the ordering of candidate items according to their estimated relevance to a query.
- retrieval metrickind of · A retrieval metric measures how relevant, accurate, complete, or useful the information returned by an information-retrieval system is for a query or task.
- context recallcontrasts with · Context recall is a retrieval-quality metric measuring how completely retrieved context contains the relevant information needed to answer a query or question.
Questions about context precision
What is context precision?
Context precision is a retrieval metric measuring how much retrieved context is relevant to answering a query and, in some formulations, how highly relevant items are ranked.
Which Manning books explain context precision?
LLM Evaluation and Alignment, The Foundational Ideas and Build an Advanced RAG Application (From Scratch).
What should I know before learning context precision?
Manning books that teach context precision usually introduce recall, context window, similarity search and precision first.
What is the difference between context precision and context recall?
Context precision is a retrieval metric measuring how much retrieved context is relevant to answering a query and, in some formulations, how highly relevant items are ranked. Context recall is a retrieval-quality metric measuring how completely retrieved context contains the relevant information needed to answer a query or question.
What is context precision a kind of?
Context precision is a kind of precision. Precision is the proportion of items predicted, selected, or retrieved as positive that are correct or relevant.
What is context precision part of?
Context precision is part of Ragas. Ragas is an open-source framework and Python library for evaluating retrieval-augmented generation systems and applications.
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.

