AI Agentic Handbook
Evaluation & Metrics

Context precision

Senior levelReviewed Oct 2026In 1 interview question

Of the chunks you gave the model, are the useful ones at the top? Noise sitting above the evidence costs more than noise below it.

In plain English

Context precision looks at the chunks you placed in the prompt and asks whether the useful ones come first. Evidence near the top scores well; evidence buried under five irrelevant chunks scores badly, even though it is technically present.

It captures something real: the order you assemble context in changes the answer, not just the token bill.

Analogy

A briefing pack for a meeting: far better if the two pages that matter are on top, rather than at pages 7 and 9 behind five pages of background.

Common pitfall

The cheapest way to raise this score is to send one chunk, which is why it must never be read alone. Context recall and multi-hop accuracy collapse while the number goes up — always report the pair.

How it actually works

Ragas definition: context precision@K = Σ_{k=1..K} (precision@k × v_k) / (number of relevant items in the top K), where v_k = 1 if the chunk at rank k is relevant. It is average precision over the assembled context, so each relevant chunk is credited with the precision at its position. Relevance is judged per chunk by an LLM against the question and a reference answer (or, reference-free, against the generated answer). It diagnoses the reranker and context assembly, complementing context recall (did we include all needed evidence?) and Faithfulness (did generation stick to it?). Because modern models handle a few distractors well on single-hop questions, low context precision costs more in tokens and in multi-hop accuracy than in single-fact accuracy; prioritise it accordingly.

What I'd ship on day one

Ragas context_precision (reference-based when the golden set has reference answers), computed on the assembled context, not the first-stage list; reported with context recall and faithfulness as a triad, per slice.

Worked example

Insurance claims assistant, question: 'Was the roof claim filed within the policy's reporting window?'. Five chunks: (1) reporting-window clause ✓, (2) roof-material exclusions ✗, (3) claim filing timestamp ✓, (4) adjuster bio ✗, (5) generic FAQ ✗. precision@1 = 1, precision@3 = 2/3. Context precision = (1 + 0.667) / 2 = 0.83. Swapping chunks 2 and 3 gives (1 + 1) / 2 = 1.0; dropping 4 and 5 does not change the score but saves ~900 tokens.

In the interview

Lay out the three-way split, which is the answer they are after: context precision says whether the reranker and assembler put the evidence first, context recall says whether it was found at all, and faithfulness says whether generation used it. You look at all three before touching the prompt. Expect 'why not plain precision@k?' Because it ignores order — and order is precisely what the reranker controls.

RankChunkRelevantprecision@k (if relevant)
1Reporting-window clause✓1/1 = 1.00
2Roof exclusions✗—
3Filing timestamp✓2/3 = 0.67
4Adjuster bio✗—
5Generic FAQ✗—
Context precision(1.00 + 0.67) / 2 = 0.83
Average precision at each relevant rank; one swap would make it 1.0

Numbers worth knowing

Healthy range
≥ 0.755–8 chunk contexts after a cross-encoder reranker
Typical without reranker
0.45–0.65bi-encoder top-8 straight into the prompt
Judge calls per item
one per chunk8 chunks = 8 small-model calls, ~$0.002 total

How to decide

WhenDo this
Context precision low, context recall highImprove reranker or reorder; consider fewer chunks
Both lowFirst-stage retrieval problem: fix before tuning order
Both high, faithfulness lowGeneration problem: prompt, model or decoding

Cost maths

Golden-set run: 500 items × 8 chunks × ~600 tokens judge input at $0.80/M (illustrative) ≈ $1.90 per run. Cheap enough for every PR tier.

Operating it

Time to scale up when…
  • Context precision < 0.6 on any major slice
  • Multi-hop slice accuracy trails single-hop by > 10 points while context recall is fine
  • Prompt tokens per answer growing without a quality gain
What to monitor
  • Context precision, context recall and faithfulness nightly; alert on any > 0.05 drop
  • Average rank of first relevant chunk in assembled context; alert if > 2

When it goes wrong

What users saw

Legal research answers became vaguer after a switch to larger chunks, with no drop in retrieval recall

How it was caught

Eval triad: context recall flat at 0.88, context precision 0.79 → 0.52, answer correctness −7 points on multi-hop questions

Root cause

1,500-token chunks each contained one relevant paragraph and several irrelevant ones; the judge marked most chunks partially irrelevant and the model hedged

Fix

Back to 400-token chunks with parent-section expansion only for the top 2; context precision returned to 0.77

Sources

  1. Ragas: Automated Evaluation of Retrieval Augmented Generation — Es et al., 2023paper
  2. Introduction to Information Retrieval (ch. 8, Evaluation) — Manning, Raghavan & Schütze, 2008book

Check yourself

Three questions. Every option is explained once you answer.

1ConceptTwo 8-chunk contexts each hold 2 relevant chunks. Which scores higher on context precision?
2ScenarioContext precision 0.5, context recall 0.9, faithfulness healthy. What is the right next step?
3CalculationTop 4 context chunks, relevance [1, 0, 1, 0]. What is context precision@4?