Hybrid Search
What it is
Hybrid search combines dense retrieval (semantic similarity via embeddings) and sparse retrieval (exact term matching via BM25 or TF-IDF) into a unified ranking. The complementary strengths of each method—semantic understanding for dense, keyword precision for sparse—improve overall effectiveness on diverse queries.
[illustrate: Venn diagram showing dense and sparse candidate sets; fusion strategy (RRF, weighted sum) combining ranks; final reranked results]
How it works
-
Parallel retrieval:
- Run dense retrieval (ANN index over embeddings) → top-k candidates
- Run sparse retrieval (inverted index BM25) → top-k candidates
- Union or merge candidate sets
-
Score fusion:
- Reciprocal Rank Fusion (RRF): Combine ranks without explicit scores
score = Σ 1 / (k + rank) - Weighted sum: Normalize and blend scores
final_score = α × dense_score + (1-α) × sparse_score - Learning to rank: Train a model to combine multiple signal scores
- Reciprocal Rank Fusion (RRF): Combine ranks without explicit scores
-
Reranking (optional):
- Apply cross-encoder or fine-tuned ranker on merged candidate set
Example
Query: "Python data science libraries"
Dense retrieval (ANN):
1. pandas_tutorial (similarity: 0.89)
2. sklearn_intro (similarity: 0.86)
3. random_article (similarity: 0.65)
Sparse retrieval (BM25):
1. "Python data science" blog (BM25: 45.2)
2. official numpy docs (BM25: 38.1)
3. random_article (BM25: 12.0)
After fusion:
1. pandas_tutorial (combined high)
2. sklearn_intro (combined high)
3. "Python data science" blog (BM25 boost)
Variants and history
Hybrid retrieval gained traction around 2020–2021 as dense methods matured. Early fusion strategies (RRF, simple weighted sum) were practical before learned fusion. Modern approaches include learned reranking, multi-vector representations (ColBERT), and lexical-semantic interpolation (SPLADE). Industry systems (Elasticsearch, Weaviate, Pinecone) now offer hybrid search as a standard feature.
When to use it
Choose hybrid search when:
- You want robustness across diverse query types
- Exact keyword matching and semantic understanding both matter
- Your query distribution is heterogeneous
- You have compute resources for dual indexing
- Reranking budgets allow top-100 to top-1000 fusion
Hybrid search adds indexing and query overhead versus single-method approaches but typically outperforms either method alone on real-world queries.