Hybrid Retrieval and Reranking
Neither keywords nor vectors win alone. Production systems fuse both — then let a heavier model re-order the shortlist.
- Fuse keyword and semantic results with Reciprocal Rank Fusion
- Add a cross-encoder reranker and measure its lift
- Apply query rewriting and expansion techniques
- Justify each pipeline stage with measured evidence
Open the full Week 4 study material → Complete lesson: concepts in depth, the full lab with all code, and troubleshooting.
Concepts
1. Why hybrid wins
BM25 nails exact terms, codes, and names; embeddings nail paraphrase and synonymy. Real query traffic contains both. Fusing the two result lists covers each system's blind spots.
2. Reciprocal Rank Fusion
RRF combines ranked lists using only positions — no score normalization headaches. Simple, robust, and the default answer in production. You'll implement it in a dozen lines.
3. Cross-encoder reranking
Bi-encoders (embeddings) score query and document independently — fast but shallow. A cross-encoder reads them together — slow but precise. The pattern: retrieve 50 candidates cheaply, rerank the top handful expensively.
4. Query understanding
Users write bad queries. Rewriting, expansion, and HyDE (embedding a hypothetical answer instead of the question) reshape queries before retrieval ever runs.
Lab — live session
- Implement RRF over your BM25 + vector retrievers
- Add a cross-encoder reranker (sentence-transformers) on the top 20 candidates
- Measure the lift of each stage separately: baseline → hybrid → +rerank
- Test query rewriting on your worst-performing queries
A staged pipeline where every component earns its place with numbers: hybrid must beat both parents, reranking must beat plain hybrid.
Reading
Watch
Reflection — bring answers to the next session
- Why is rank fusion more robust than score fusion across different retrievers?
- Reranking added latency. For your capstone's users, is the quality lift worth it?
- Where in your pipeline would query rewriting help most — and how would you prove it?
Challenge 4: Beat the Baseline — This week has a hard, numeric win condition: your hybrid pipeline must beat BOTH pure BM25 and pure vector search on your own metrics. No participation trophies.