Retrieval & Reranking
Advanced retrieval and reranking for RAG: BM25, dense retrieval, cross-encoder reranking, and hybrid search strategies.
Last updated
4. Retrieval — Hybrid Search, Reranking & Query Understanding
4. Retrieval — Hybrid Search, Reranking & Query Understanding
Why Hybrid Search (Vector + Keyword)
Vector search captures semantic similarity ("car" matches "automobile"). Keyword search (BM25) captures exact terms ("error code E-4502" won't match semantically but BM25 finds it instantly). Production systems need both.
| Search Type | Wins When | Fails When |
|---|---|---|
| Dense (vector) | Semantic queries, paraphrases, conceptual search | Exact term matching (product codes, error codes, names) |
| Sparse (BM25) | Exact keywords, rare terms, technical identifiers | Paraphrased queries, conceptual similarity |
| Hybrid (fusion) | Most real-world queries (mix of concept + specific terms) | Simple queries where one method suffices (adds latency) |
Reciprocal Rank Fusion (RRF)
The standard way to merge results from multiple retrievers: