Evals & Observability·Question 23 of 83Intermediate

Which retrieval metrics would you use - recall@k, MRR, nDCG - and when does each matter?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

  • Recall@k - fraction of queries where a relevant chunk appears in the top k. The primary RAG metric, because the generator sees the whole top-k window: for RAG it usually doesn't matter whether the gold chunk is rank 1 or rank 7 if k = 10 and all of it goes into the prompt. Set k to what you actually stuff into context. Recall@k is your end-to-end ceiling - track it before anything else.
  • MRR (mean reciprocal rank) - average of 1/rank of the first relevant result. Matters when rank 1 is special: single-chunk prompting, UI showing one top citation, or models that attend disproportionately to the top/beginning of context. Ignores everything after the first hit, so it's wrong for multi-evidence questions.
  • nDCG@k - discounted cumulative gain, normalized: rewards putting more relevant items higher, supports graded relevance (perfect/partial/marginal) rather than binary. The right metric when multiple chunks have different degrees of usefulness and ordering inside the window matters - e.g., you retrieve 50, rerank, and keep 10; nDCG@10 is the natural reranker metric. Costs more to label (graded judgments).
Full worked answer with diagram
  • Recall@k - fraction of queries where a relevant chunk appears in the top k. The primary RAG metric, because the generator sees the whole top-k window: for RAG it usually doesn't matter whether the gold chunk is rank 1 or rank 7 if k = 10 and all of it goes into the prompt. Set k to what you actually stuff into context. Recall@k is your end-to-end ceiling - track it before anything else.
  • MRR (mean reciprocal rank) - average of 1/rank of the first relevant result. Matters when rank 1 is special: single-chunk prompting, UI showing one top citation, or models that attend disproportionately to the top/beginning of context. Ignores everything after the first hit, so it's wrong for multi-evidence questions.
  • nDCG@k - discounted cumulative gain, normalized: rewards putting more relevant items higher, supports graded relevance (perfect/partial/marginal) rather than binary. The right metric when multiple chunks have different degrees of usefulness and ordering inside the window matters - e.g., you retrieve 50, rerank, and keep 10; nDCG@10 is the natural reranker metric. Costs more to label (graded judgments).

Practical guidance: for a RAG pipeline, report recall@k for the retriever (binary labels, cheap) and nDCG@k or MRR for the reranker, and watch precision@k / context precision too - irrelevant chunks in the window aren't free, they dilute attention, add tokens, and seed hallucinations. A retriever tuned for recall alone will happily pad the context with noise.

Going further: follow-up territory

Also name the labelling caveat: all of these are computed against judged relevance, and un-judged retrieved chunks are typically treated as irrelevant - which penalises a new retriever that finds genuinely relevant chunks your labels missed (the classic pooling problem from IR). Audit a sample of "misses" by hand before concluding a new embedder is worse.

Worth sketching. Placing each metric at the stage it belongs to stops the usual muddle of quoting one number for the whole pipeline.

flowchart LR
    Q["Query"] --> R["Retrieve top-50"]
    R --> K["Rerank to top-10"]
    K --> P["Context window"]
    R -.-> M1["recall@50:<br/>did the gold chunk survive?"]
    K -.-> M2["nDCG@10 or MRR:<br/>is the order right?"]
    P -.-> M3["precision@k:<br/>noise dilutes attention"]

What a good answer covers

  • Recall@k - fraction of queries where a relevant chunk appears in the top k
  • MRR (mean reciprocal rank) - average of 1/rank of the first relevant result
  • nDCG@k - discounted cumulative gain, normalized
  • Practical guidance: for a RAG pipeline, report recall@k for the retriever (binary labels, cheap) and…
  • A retriever tuned for recall alone will happily pad the context with noise

Key terms: Recall@k · MRR (mean reciprocal rank) · nDCG@k · recall@k for the retriever · precision@k / context precision

Interviewer follow-ups to expect

  1. Your new embedder improves nDCG but end-to-end answers get worse - what mechanisms could explain that?

  2. Why might recall@5 matter more than recall@20 even though your context fits 20 chunks?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep