Explainer
Retrieval metrics
Retrieval metrics such as hit@k and recall@k score the search step on its own: did it find the passages an answer needs, and how near the top did it put them?
A system that answers from documents first runs a search, which returns a ranked list of passages. Retrieval metrics compare that list with a labelled reference: the passages a person marked as needed for each question, as Husain and Shankar’s evals FAQ advises.
Illustration. A patron asks what to bring to join, whether books can be renewed and when the desk opens. The answer needs D6 (membership), D4 (renewals) and D3 (hours). The search ranks D1, D6, D3, D5, D4. Count the top three, so k is 3:
- Hit@3: 1, because a needed passage is in the top three. Averaged over questions, this is the hit rate.
- Recall@3: 2 of 3, or 67%. D4 came fifth and was missed.
When only the top few passages reach the assistant, order counts. Reciprocal rank is 1 divided by the position of the first needed passage. Here D6 came second, so it is 1/2. Mean reciprocal rank (MRR) averages it over questions. nDCG, normalized discounted cumulative gain, rewards needed passages near the top and takes graded labels such as “essential” and “useful” (BEIR paper).
When the documents hold no answer at all, the right behaviour is an answer that says so. Grading the answer checks that, not the search.
Going deeper
Ragas’s context recall “always requires a reference to compare against”; its context precision checks that relevant chunks rank above irrelevant ones, with or without a reference. TruLens’s context relevance asks whether each fetched chunk is relevant to the question. Labels can be incomplete: BEIR found systems returning passages nobody had judged, which count as misses. A good retrieval score says nothing about the answer.
In the beginner evaluations guide: Separate finding evidence from using it. Then try Follow one fact through retrieval.