Mean Average Precision (MAP)
You'll learn how to compute Mean Average Precision to evaluate retrieval quality across multiple queries and all rank positions.
What is MAP?
Mean Average Precision (MAP) extends the idea of precision to evaluate how well your retrieval system performs across many queries. Unlike single-query metrics, MAP gives you a holistic view of system performance by averaging the precision scores at each relevant result position across your entire test set.
How MAP Works
For each query:
- Compute Average Precision (AP): At each position where a relevant document appears, calculate precision at that position, then average those precision values
- Only count positions where relevant documents actually appear
- Average all AP scores across all queries to get MAP
The Intuition
Imagine grading a test where students must rank search results. You don't just check if they got one right answer—you check how well they ranked all relevant answers across all test questions. MAP rewards systems that consistently place relevant documents high in rankings.
Example
Query 1: Relevant docs at positions 1, 3, 5 → AP = (1/1 + 2/3 + 3/5) / 3 = 0.76
Query 2: Relevant docs at positions 2, 4 → AP = (1/2 + 2/4) / 2 = 0.50
MAP = (0.76 + 0.50) / 2 = 0.63
Why MAP Matters
MAP is particularly valuable because it:
- Evaluates the entire ranking, not just top-k results
- Rewards systems that rank relevant documents higher
- Provides a single score for system-wide performance comparison
Key Takeaway: MAP measures average retrieval precision across all queries and all relevant document positions, giving you a comprehensive metric for comparing RAG retrieval systems.