Back to glossary

Term

Context Precision

Context Precision is a RAG evaluation metric (0–1) measuring how well the retriever ranks relevant contexts above irrelevant ones — the focus is ranking quality, not raw hit count.

Context Precision — explained in detail

Context Precision evaluates whether retrieved context chunks come back in the right order. Concretely: are the chunks actually useful for the answer near the top, or are the good hits hiding at position 5 behind noise? This matters because the LLM prioritizes top-down during generation and the context window is finite. The metric is typically computed as a position-weighted average: a relevant hit at rank 1 counts fully, the same hit at rank 5 counts less.

Example / Practical use

Top-3 hits for a query: chunk A (relevant), chunk B (irrelevant), chunk C (relevant). The score sits below 1 because an irrelevant chunk precedes a relevant one. Optimum: all relevant chunks before all irrelevant ones. In practice, the metric is used to compare reranker quality — a strong cross-encoder reranker pushes context precision up significantly without hurting recall. RAGAS and DeepEval both implement an LLM-judge variant.

Context Precision is the ordering metric for the retriever; context recall is the completeness metric (are all relevant facts present in the hits?). Together they prevent gaming: optimizing only recall leads to huge top-50 windows full of noise, optimizing only precision leads to few but incomplete hits. Faithfulness and answer relevancy cover generation quality — these four together are the standard quartet of RAG evaluation.

Entdecke mehr

Themenuebersicht