Short answer

Write real questions, mark the correct document for each and record its rank before and after a change. Recall@5 shows how often it appears in the top five. MRR shows how close to the top it appears.

1. Write a small question set#

Start with 20 to 50 questions from real use, then grow the set. Include exact terms, natural wording and questions with no answer in the documents.

  • Each question has a known correct document or passage
  • Questions were written before looking at the new results
  • Easy and hard cases are both included
  • The set is saved so that it can be reused

2. Change one thing#

Compare one change at a time, such as chunk size, fusion weight or reranking. If several settings change together, you cannot tell which one helped.

3. Record the rank#

Run each question and write the rank of the first correct result. Leave it empty if the result is missing. Save this example as results.csv.

Worked example
question,baseline,changed
q1,1,1
q2,3,2
q3,,4
q4,2,1
q5,6,
What we measured in MESA

For a worked example of question rules, scoring and disclosure, see how we built benchmark v2.

4. Calculate Recall@5 and MRR#

Each example question has one correct document, so Recall@5 is the share of questions answered in the top five. A result after rank five counts as a miss.

Worked example
import csv

K = 5
rows = list(csv.DictReader(open("results.csv", encoding="utf-8")))
for column in ("baseline", "changed"):
    ranks = [int(row[column]) if row[column] else None for row in rows]
    hits = [rank for rank in ranks if rank and rank <= K]
    recall = len(hits) / len(ranks)
    mrr = sum(1 / rank for rank in hits) / len(ranks)
    print(f"{column}: Recall@{K}={recall:.2f} MRR@{K}={mrr:.2f}")

Run it with python3 evaluate.py:

Worked example
baseline: Recall@5=0.60 MRR@5=0.37
changed: Recall@5=0.80 MRR@5=0.55

5. Read the result carefully#

QuestionBaselineChangedWhat happened
q232Moved up
q3Missing4Newly found
q421Moved up
q56MissingStill outside the top five

The change improves both metrics in this illustrative data. Five questions are too few to prove a real improvement, so inspect failures and repeat on a larger set.

Do not tune on your final test set

Keep some questions aside. If you repeatedly tune against the same questions, the score can improve without real search improving.

What usually goes wrong?#

What you seeCauseFix
ValueError: invalid literal for int() with base 10A cell holds text instead of a rankUse a whole number, or leave the cell empty for a miss
KeyError: 'baseline'Column names differ, for example BaselineUse the exact header question,baseline,changed
Scores change between two identical runsTies are broken by something random, such as generated IDsBuild the index twice and compare the ordered results before you trust a small gain

The last case happened to us. Two fresh MESA stores built from the same documents scored 48/112 and 52/112 on Hit@5 before a tie-break fix (benchmark v2 dev, Tier M, models off). Read why two identical search runs differed.

Search evaluation questions#

What is a good MRR score?
There is no universal threshold. Compare systems on the same questions and documents.
Recall or MRR: which matters more?
Recall shows whether the evidence was found. MRR shows how high it ranked. RAG systems usually need both.
Should I use nDCG?
Use nDCG when results have graded relevance. See the evaluation lesson.

Sources#

  1. MESA Learn · Evaluate retrieval
  2. MESA · Retrieval evaluation methodology