Real search quality rarely comes from dense or sparse alone. Hybrid embeddings / hybrid retrieval fuse both—typically retrieving candidates from each channel then merging scores (RRF, weighted sums) before optional cross-encoder reranking.
This is the default architecture sketch for production RAG: recall from multiple views, then precision from ranking models covered next.
Learning Objectives
By the end of this lesson, students should be able to:
- Define hybrid retrieval as combining lexical and dense candidate sets/scores.
- Apply Reciprocal Rank Fusion (RRF) as a strong default merger.
- Explain score normalization challenges when blending BM25 with cosine.
- Sketch a hybrid RAG retrieve → fuse → rerank pipeline.
- Choose fusion hyperparameters with offline IR metrics (nDCG, recall@k).
- Recognize ops cost: two indexes, two query paths, one fusion layer.
Hybrid retrieval combines sparse (lexical) and dense (semantic) signals—either by mixing vector representations, running parallel retrievers, or fusing ranked lists—so that systems capture both exact term matches and paraphrastic relevance.
Fusion Patterns
User text in.
BM25 + dense top-k.
RRF / weighted scores.
Optional cross-encoder.
| Method | Idea | Notes |
|---|---|---|
| Weighted score sum | α·dense + (1-α)·sparse | Needs calibration |
| RRF | Sum 1/(k+rank) | Rank-based; robust |
| Cascade | Sparse filter → dense | Latency tricks |
Why Fuse?
- Complementary error modes
- Better recall@k upstream of LLM
- Fewer “wrong neighbor” contexts
Engineering
- Two indexes to maintain
- Timeouts / partial failure
- Per-tenant α tuning
Eval
- Hold-out query sets
- Slice by query type
- Measure end-to-end RAG too
Code: Reciprocal Rank Fusion Sketch
Benefits
- Higher robust recall
- Handles mixed query intents
- RRF needs little calibration
Costs
- Extra infra & latency
- Tuning still required
- Failure modes multiply
“Averaging raw BM25 and cosine scores is fine.” The scales differ wildly. Prefer rank fusion (RRF) or carefully normalized scores; otherwise one channel dominates by accident.
Knowledge Check
- Short Answer: What two channels does hybrid retrieval usually combine? Answer: Sparse/lexical and dense/semantic.
- True/False: RRF merges lists using ranks rather than raw scores. Answer: True.
- Multiple Choice: A common RRF constant k is about: (a) 60, (b) 0, (c) 10^9. Answer: (a).
- Short Answer: Why is raw score addition risky? Answer: Incompatible scales; one retriever can dominate.
- True/False: Hybrid always removes the need for reranking. Answer: False.
- Multiple Choice: Hybrid helps most when errors are: (a) identical, (b) complementary, (c) nonexistent. Answer: (b).
- Short Answer: Name one offline metric for tuning fusion. Answer: nDCG, recall@k, MRR, etc.
- Short Answer: What follows fusion in many stacks? Answer: Cross-encoder (or LLM) reranking of top-n.
- Multiple Choice: Maintaining BM25 + vector DB is: (a) zero ops, (b) real engineering cost, (c) illegal. Answer: (b).
- True/False: Slice evaluation by query type (SKU vs paraphrase) matters for α/RRF choices. Answer: True.
Key Takeaways
- Hybrid retrieval fuses lexical and semantic candidates.
- RRF is a robust default when scores are incomparable.
- Normalize carefully if using weighted score mixes.
- Eval by query slice; expect extra operational complexity.
- Next: Cross Encoder for precise reranking.
Lab: Implement RRF on two fake top-10 lists; change k and observe reordering.
Case study: Support desk RAG with SKU queries + “how do I…” queries—design hybrid weights.
Recap: Hybrid fusion captures both keywords and meaning. Continue with Cross Encoder.