Dense cosine retrieval misses exact SKUs, error codes, and rare proper nouns; sparse lexical search misses paraphrases. Hybrid search fuses both—the production pattern previewed by Vol. 12 hybrid embeddings. Metadata filters (next) and re-ranking refine the fused list further.
Learning Objectives
By the end of this lesson, students should be able to:
- Define hybrid search as combining sparse and dense candidate lists.
- Apply rank fusion methods such as Reciprocal Rank Fusion (RRF).
- Explain when hybrid beats either channel alone.
- Sketch a dual-index architecture (BM25 + vector).
- Tune fusion weights / k with offline eval, not vibes.
- Connect hybrid first-stage recall to cross-encoder re-ranking.
Hybrid search retrieves using more than one relevance signal—typically lexical/sparse (e.g., BM25) and dense embedding similarity—then merges rankings into a single candidate list for the LLM or a re-ranker.
Why Fuse?
| Query type | Dense alone | Sparse alone | Hybrid |
|---|---|---|---|
| Paraphrase FAQ | Strong | Weak | Strong |
| Exact error code | Weak | Strong | Strong |
| Mixed intent | Partial | Partial | Best chance |
Weighted score
- α·dense + (1-α)·sparse
- Needs score scaling
- Fragile across corpora
RRF
- Fuse by ranks
- Scale-free
- Strong default
Cascade
- Sparse → dense filter
- Or union then re-rank
- Latency tradeoffs
Code: Reciprocal Rank Fusion
Strengths
- Covers lexical + semantic failures
- RRF is simple and robust
- Plays well with re-rankers
Tradeoffs
- Two indexes to operate
- More candidates → cost
- Fusion params need eval
“Averaging raw BM25 and cosine scores is fine.” Different scales and distributions make naive averages dominate one channel. Prefer rank fusion (RRF) or carefully calibrated normalization—always validate on labeled queries.
Knowledge Check
- Short Answer: What two signals does hybrid search usually fuse? Answer: Sparse/lexical and dense/embedding scores.
- True/False: Dense search alone always finds exact error codes. Answer: False.
- Multiple Choice: RRF fuses by: (a) ranks, (b) CSS colors, (c) GPU temp. Answer: (a).
- Short Answer: Why is naive score averaging risky? Answer: Incompatible scales let one channel dominate.
- True/False: Hybrid can increase candidate set size before re-rank. Answer: True.
- Multiple Choice: Vol. 12 precursor topic: (a) hybrid embeddings, (b) only PCA, (c) printers. Answer: (a).
- Short Answer: Name a sparse retriever. Answer: BM25 (or learned sparse).
- True/False: Fusion weights should be set without eval. Answer: False.
- Multiple Choice: Next lecture: (a) Metadata, (b) Vol. 1 only, (c) DNS. Answer: (a).
- Short Answer: What often follows hybrid fusion in production? Answer: Cross-encoder re-ranking and/or metadata filters.
Key Takeaways
- Hybrid search covers lexical and semantic failure modes.
- Prefer RRF or calibrated fusion over raw score mixes.
- Eval fusion on your query mix; expect dual-index ops.
- Next: Metadata.
Lab: Build dense + toy TF overlap lists; compare RRF vs dense-only recall@10 on ID-heavy vs paraphrase queries.
Discussion: Is a second index worth it for a 5k-doc internal wiki?
Recap: Hybrid search is the practical default for many RAG corpora. Continue with Metadata.