If you are building RAG, your answer quality is capped by your retrieval quality. This calculator turns two ID lists — what your retriever returned and what is actually relevant — into the four metrics that matter: precision, recall, F1, and mean reciprocal rank.
Why retrieval quality is the bottleneck in most RAG systems
A common pattern in RAG development is to spend significant effort on prompt engineering and model selection while treating the retrieval step as plumbing. The result is a system where the model behaves perfectly when given the right context, but the retriever frequently returns the wrong chunks — so answers are wrong not because of the model but because of what it was given to work with.
Precision and recall are the diagnostic lens for this problem. Low precision means the retrieved set is full of noise that wastes context tokens and can mislead the model. Low recall means critical information was not retrieved at all, so the model has no basis to give a correct answer regardless of prompt quality.
How it works
You paste two sets of IDs. The tool computes the overlap and derives:
- Precision = relevant retrieved ÷ total retrieved (are the results clean?).
- Recall = relevant retrieved ÷ total relevant (did you miss anything?).
- F1 = harmonic mean of precision and recall (a single balanced score).
- MRR = 1 ÷ rank of the first relevant result (does a good hit appear near the top?).
All computation is local — nothing is uploaded.
Worked example
Say a query has five relevant chunks in the corpus (IDs: 12, 34, 56, 78, 90), and your retriever returns six chunks in ranked order: 34, 99, 12, 55, 56, 88.
- Relevant retrieved: IDs 34, 12, 56 — so 3 true positives
- Precision = 3 ÷ 6 = 0.50 (half the retrieved set was irrelevant)
- Recall = 3 ÷ 5 = 0.60 (two relevant chunks, 78 and 90, were missed)
- F1 = 2 × (0.50 × 0.60) ÷ (0.50 + 0.60) = 0.545
- MRR: the first relevant result is at rank 1 (ID 34), so MRR = 1 ÷ 1 = 1.0
The MRR of 1.0 looks great, but the recall of 0.60 reveals that two important documents were never retrieved. For a multi-fact question that depends on all five chunks, the answer would be incomplete.
Which metric to focus on for your use case
| Scenario | Primary metric |
|---|---|
| Long-context model, cost is not a concern | Recall (retrieve everything relevant) |
| Tight context window, noise matters | Precision (keep retrieved set clean) |
| Only the top-k chunks feed the model | MRR (is the best chunk near the top?) |
| Balanced, general evaluation | F1 |
Tips and interpretation
In RAG, recall is usually the more dangerous failure: if the supporting passage was never retrieved, the model cannot answer correctly no matter how clever the prompt. Low precision wastes context and can distract the model, but at least the right answer is present. Watch MRR when only the top few chunks feed the model — a relevant chunk buried at rank 10 may never be used. Label your ground-truth set thoroughly: any genuinely relevant chunk you forget to list counts as a false negative and unfairly drags down recall.