retrieval-evaluation-metrics
Skill8 starsChanged 7 months agoMITView on GitHub
Measure retrieval quality with recall, precision, MRR, nDCG, and context precision and recall.
In this repository39 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rag-skillsSkill
- choosing-a-chunking-frameworkSkill
- contextual-chunk-headersSkill
- hierarchical-chunkingSkill
- semantic-chunkingSkill
- chunkingSkill
- sliding-window-chunkingSkill
- rag-for-code-documentationSkill
- rag-for-multimodal-contentSkill
- data-type-handlingSkill
- index-versioning-and-reindexingSkill
- production-rag-deploymentSkill
- deploymentSkill
- generation-evaluation-metricsSkill
- rag-evaluation-frameworksSkill
- evaluation-metricsSkill
- optimize-retrieval-latencySkill
- performance-optimizationSkill
- agentic-rag-routingSkill
- multi-agent-rag-orchestrationSkill
- rag-agentsSkill
- adaptive-retrievalSkill
- context-enrichment-windowSkill
- crag-corrective-ragSkill
- explainable-retrievalSkill
- graph-ragSkill
- hybrid-search-bm25-denseSkill
- hyde-hypothetical-document-embeddingsSkill
- hype-hypothetical-prompt-embeddingsSkill
- multi-pass-retrieval-with-rerankingSkill
- query-transformation-strategiesSkill
- raptor-hierarchical-retrievalSkill
- self-ragSkill
- retrieval-strategiesSkill
- choosing-vector-db-by-datatypeSkill
- qdrant-for-production-ragSkill
- qdrant-setup-ragSkill
- vector-databasesSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Start with recall@k across candidate k values to confirm relevant chunks are retrieved at all, then check precision and rank quality with …
- Distinctive: line 40
Use LLM-judged context precision and context recall when human relevance labels are scarce, to score whether retrieved context supports the …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
Retrieval evaluation measures whether the pipeline fetched the right chunks before the LLM ever sees them. Because generation quality is capped by retrieval quality, these metrics isolate the most common and most fixable source of bad RAG answers.
Problem Statement
Teams judge RAG only by final answer quality, which hides where the failure is. When the right chunk is never retrieved, no prompt or model change can recover, yet the pipeline is often blamed on generation instead of retrieval.
Key Concepts
- Recall@k: Fraction of relevant chunks that appear in the top k results.
- Precision@k: Fraction of the top k results that are actually relevant.
- MRR (Mean Reciprocal Rank): Rewards putting the first relevant chunk near the top.
- nDCG: Rank-aware score that weights relevant results higher when ranked earlier.
- Context precision and recall: RAGAS-style metrics that judge whether retrieved context is relevant and complete for answering the question.
Implementation Guide
Step 1: Build a Labeled Query Set
Collect representative questions and mark which document chunks are relevant to each. This golden set is the ground truth every metric compares against.
Why: Rank-based metrics are meaningless without known-relevant targets to score against.
Step 2: Measure Recall Before Precision
Start with recall@k across candidate k values to confirm relevant chunks are retrieved at all, then check precision and rank quality with MRR and nDCG.
Why: A relevant chunk that is never retrieved cannot be re-ranked into place, so recall is the ceiling for everything downstream.
Step 3: Add Reference-Free Context Metrics
Use LLM-judged context precision and context recall when human relevance labels are scarce, to score whether retrieved context supports the reference answer.
Why: Manual relevance labels are expensive; reference-free metrics scale evaluation to larger query sets.
For definitions and implementations, see RAGAS context metrics, the RAGAS paper, and scikit-learn ranking metrics.
When to Use This Skill
- Diagnosing whether bad answers come from retrieval rather than generation
- Comparing chunking strategies, embedding models, or rerankers objectively
- Setting a recall baseline before tuning downstream generation
When NOT to Use This Skill
- Retrieved context is already known to be good and answers are still wrong
- The corpus has no relevance labels and none can be produced or approximated
- The system does not retrieve (pure generative or closed-book setups)
Related Skills
- Generation Evaluation Metrics - Score the answer, not the context
- RAG Evaluation Frameworks - Tools that compute these metrics
- Multi-Pass Retrieval with Reranking - Improve rank-based scores
- Hybrid Search BM25 Dense - Improve recall
Metrics & Success Criteria
- Recall@k: High enough that relevant context is almost always present in the top k
- MRR / nDCG: Relevant chunks ranked near the top, not buried
- Context Precision: Low share of irrelevant chunks in the final context
- Stability: Metrics computed on a fixed golden set for run-to-run comparison
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

