What is context precision?
Context precision is an evaluation metric that checks whether a Retrieval-Augmented Generation retriever places the relevant chunks it fetched for a question above the irrelevant ones. Scores range from 0 to 1 and rise as relevant chunks gather at the top.
Unlike classic precision, which counts relevant items in a retrieved set and ignores order, context precision is rank-aware. Context recall instead asks whether the needed information was retrieved at all.
- Topic
- Evaluation and quality
- Also known as
- Retrieval precision, context precision@K
- Origin
- Precision in information retrieval; 2024 EACL Ragas study
How context precision works
- The question, retrieved chunks and any reference answer are gathered.
- An LLM judge or a non-LLM similarity measure decides whether each chunk is relevant.
- For each rank k, precision at k is computed: the share of relevant chunks among the top k.
- The score is the mean of precision at k over the ranks that hold relevant chunks.
In more detail
Calculation formula
Precision at k is the number of relevant chunks in the top k divided by all chunks in the top k. Context precision multiplies the precision at each rank by a 0 or 1 relevance indicator for that rank, sums the results and divides by the number of relevant items in the top K. Average precision in classic information retrieval is likewise the mean of the precision values obtained after each relevant document is retrieved; it rewards systems that rank relevant documents highly.
Commonly confused terms
| Term | How it differs |
|---|---|
| Reranking | Reranking is a technique that reorders retrieved candidates with a stronger model. Context precision is the metric that measures how good that ordering is, that is whether relevant chunks land in the top positions. |
Why context precision matters for on-premises AI
Context precision measures retrieval and reranking quality separately from answer generation. In the metric's documentation, an irrelevant chunk in second place leaves the score unchanged while moving it to first place lowers it. A low score means relevant documents were found but sit behind irrelevant ones; the reranker, chunk size or metadata filters are then reviewed. With labelled document IDs it needs no language model.
An insurer tests every new reranking setting for its policy assistant against expert-written questions and reference answers. A setting that raises context precision goes live only after answer quality metrics confirm it.
Common questions
Does context precision need a reference answer?
No. With a reference answer the chunks are compared against it; without one they are compared against the generated response. Labelled reference chunk IDs allow an ID-based version.
Does high context precision mean the answer is correct?
No. The metric judges only the retrieval step. Whether the answer rests on the retrieved context is measured separately with metrics such as faithfulness.
Related terms
Sources
- Ragas documentation, 2026
- RAGAs: Automated Evaluation of Retrieval Augmented Generation, EACL, 2024
- Common Evaluation Measures, TREC 2007 Proceedings, NIST, 2007
In the glossary: Glossary, A to D