advanced-retrieval-reranking
Skill1 starsChanged 17 days agoMITView on GitHub
Improve search relevance with hybrid retrieval, query rewriting, metadata filtering, reranking, and measurable retrieval experiments for RAG and agent tools.
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
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 15
Choose a retrieval method: Use lexical search for exact terms/identifiers, dense retrieval for semantic similarity, and hybrid fusion when …
- Distinctive: line 18
Preserve diversity and provenance: Avoid many near-duplicate chunks from one source.
- Distinctive: line 27
Use source freshness and authority as explicit ranking signals when the task requires them.
- Distinctive: line 28
Avoid scoring the same model's output with a circular metric without calibration or human spot checks.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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
Advanced Retrieval and Reranking
Goal
Improve retrieval quality through controlled experiments. Choose retrieval complexity based on observed failure patterns, not trend-following.
Workflow
- Build a query set. Include common, rare, ambiguous, multi-hop, typo-heavy, multilingual, and unanswerable queries. Label relevant documents or passages.
- Measure a baseline. Record recall@k, precision@k, MRR or nDCG as appropriate, latency, index cost, and query cost.
- Diagnose the failure. Distinguish missing corpus coverage, bad parsing, chunk-boundary loss, lexical mismatch, semantic mismatch, stale data, and ACL filtering mistakes.
- Choose a retrieval method. Use lexical search for exact terms/identifiers, dense retrieval for semantic similarity, and hybrid fusion when both matter. Keep filters server-side and authorization-aware.
- Try query transformations. Rewrite unclear queries, generate alternate queries, or decompose multi-part questions only when evaluations show benefit. Keep original query and transformations in traces.
- Rerank candidates. Retrieve a sufficiently broad candidate set, rerank with a cross-encoder or model-based ranker when useful, then pass a small evidence set to generation.
- Preserve diversity and provenance. Avoid many near-duplicate chunks from one source. Keep source IDs and exact evidence spans.
- Test failure handling. Include no-result, conflicting-source, stale-source, and permission-filtered cases.
- Ship behind an evaluation gate. Compare to the baseline on a held-out set before replacing the production strategy.
Practical considerations
- Tune top-k and chunk sizes jointly; they are not independent knobs.
- Query expansion can increase recall but also introduce drift and latency.
- Rerankers can improve ordering but cannot recover documents that initial retrieval never found.
- Metadata filters must not be removed merely to increase recall.
- Use source freshness and authority as explicit ranking signals when the task requires them.
- Avoid scoring the same model's output with a circular metric without calibration or human spot checks.
Deliverable
Summarize baseline, diagnosed error classes, experiments, metric deltas, latency/cost tradeoffs, security constraints, and the chosen configuration.
References
- Ragas metrics: https://docs.ragas.io/en/latest/concepts/metrics/available_metrics/
- Elasticsearch hybrid search: https://www.elastic.co/guide/en/elasticsearch/reference/current/rrf.html
- OpenSearch hybrid search: https://opensearch.org/docs/latest/search-plugins/hybrid-search/
In this repository28 other files it gives its agents.
- agent-architecture-designSkill
- agent-evaluationSkill
- agent-harness-engineeringSkill
- agentic-workflow-testingSkill
- agent-memory-designSkill
- browser-computer-useSkill
- durable-agent-workflowsSkill
- human-in-the-loopSkill
- mcp-developmentSkill
- mcp-server-developmentSkill
- multi-agent-orchestrationSkill
- tool-calling-designSkill
- context-engineeringSkill
- embedding-model-engineeringSkill
- llm-evaluationSkill
- llm-observabilitySkill
- model-serving-inferenceSkill
- multimodal-ai-pipelinesSkill
- prompt-engineeringSkill
- rag-engineeringSkill
- rag-pipeline-engineeringSkill
- structured-outputsSkill
- agentic-securitySkill
- security-reviewSkill
- code-reviewSkill
- debuggingSkill
- test-engineeringSkill
- example-skillSkill
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.

