Retrieval Evaluation

RAG interview question · Hard difficulty

How do you evaluate retrieval quality in RAG?hard

Status
✓
Type
scenario
Topic
retrieval-evaluation
Frequency
common
Tags
retrieval, evaluation, recall-at-k, hit-rate, MRR
Answer

Measure whether the retriever returns relevant evidence for each query before judging the generated answer.

Explanation

Use metrics like recall@k, precision@k, MRR, nDCG, hit rate, and human relevance labels. Recall@k checks whether the answer-containing chunk appears anywhere in the top-k results — if it's absent, the LLM has no reliable source to answer from regardless of how good generation is. Precision@k checks how many of the retrieved chunks are actually relevant (3 relevant out of 5 retrieved = precision@5 of 0.6) — low precision means the context is noisy even if the right chunk is in there somewhere. MRR (Mean Reciprocal Rank) checks how high the first correct result ranks — a correct chunk at rank 1 is far more useful than one buried at rank 8. Hit rate is the simplest of these: it just checks whether at least one relevant document was retrieved at all, which makes it useful for coarse, high-level monitoring even though it says nothing about ranking quality. Separate retrieval evaluation from answer evaluation to locate failures.

Follow-upWhy can answer quality be poor even when retrieval looks good?
Follow-upWhen would hit rate be a good enough signal, and when would you need recall@k or MRR instead?