Search & IR · core
Ranking Metrics
Precision, recall, MRR, and nDCG for measuring retrieval quality.
Mental model
Precision/recall measure set quality; MRR rewards getting one right answer near the top; nDCG rewards graded relevance discounted by rank. Pick the metric that matches what users feel.
How to study Ranking Metrics
Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use Introduction to Information Retrieval (Manning et al.) — §8.4 Evaluation of ranked retrieval results to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.
Next, compare Ranking Metrics with Search Evals, Descriptive Statistics, Hypothesis Testing. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete Compute precision and recall by hand and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.
Proof of understanding
- Explain the mechanism from first principles and identify the state it reads or changes.
- Give one situation where the concept is the right choice and one where it is not.
- Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
- Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.
Where it matters
Every search/recommendation quality dashboard.
Common mistakes
- Reporting accuracy instead of rank-aware metrics
- Using nDCG without graded relevance labels
- Measuring recall without a fixed cutoff k
Learn from primary sources
Practice and explain it back
Compute precision and recall by hand
Given retrieved doc ids [1,4,2,9] and relevant ids {2,4,7}, compute precision@4 and recall@4.
Expected evidence: precision@4 = 0.5 (2 relevant in 4), recall@4 = 2/3.
Open the interactive drill →Review prompts
- When would you use MRR versus nDCG?
Build evidence
Search eval harness
A reusable harness that scores any retriever against a labelled query set.
- At least 15 labelled queries with known-good results
- Computes recall@k, MRR, and nDCG
- Can score any retriever via a common interface