🎓 Learning corner
Ranking and retrieval metrics
Use these metrics when a system returns an ordered list: search results, similar documents, recommendations, or ranked answers.
Background
Search, recommendations, semantic retrieval, and question answering often return a ranked list. For those tasks, we care not only whether the right item appears, but how far down the list users must look.
| Question | Correct result appears at... | Recall@1 credit | MRR@10 credit |
|---|---|---|---|
| Q1 | Rank 1 | 1 | 1.00 |
| Q2 | Rank 2 | 0 | 0.50 |
| Q3 | Rank 12 | 0 | 0.00 |
| Q4 | Rank 1 | 1 | 1.00 |
| Q5 | Rank 5 | 0 | 0.20 |
Recall@1
Only checks the first result. Here, 2 out of 5 top results are correct, so Recall@1 is 40%.
MRR@10
Gives partial credit when the first correct result appears within the top 10. Here, the average is 0.54.
⚔️ Spearman
Spearman is used when the exact score matters less than the order. It asks whether two ranked lists place the same items in a similar order.
| Spearman value | Plain meaning |
|---|---|
| +1 | The two rankings perfectly agree. |
| Around 0 | There is no clear relationship between the rankings. |
| -1 | The two rankings are exactly reversed. |
🥇 Mean Reciprocal Rank
Mean Reciprocal Rank, or MRR, gives more credit when the first correct result appears higher in the list. Rank 1 gets full credit. Rank 2 gets half credit. Rank 3 gets one-third credit.
MRR@10 uses the same idea but only checks the top 10 results. If the first correct result appears below rank 10, it receives no credit for that query.