“Hybrid Retrieval in RAG: Why BM25 + Vector Search Needs Reciprocal Rank Fusion”
How Hybrid Retrieval Works in RAG
Most RAG systems start with vector search, which retrieves documents by semantic meaning. But exact keywords sometimes matter too: product codes, names, acronyms, and technical terms that embeddings can blur.
Hybrid retrieval runs two retrievers in parallel and merges their results:
- Vector search: matches meaning
- BM25: matches exact keywords
The scoring problem: BM25 might return a score like 12, while vector search returns a cosine similarity like 0.86. These scales are incompatible, so you can’t simply add them.
The fix: Reciprocal Rank Fusion (RRF). RRF ignores raw scores and uses only rank positions:
Score = Σ 1 / (k + rank), with k = 60 by default
Example:
- Keyword ranking: A (#1), B (#2), C (#3)
- Vector ranking: C (#1), A (#2), D (#3)
- Doc A = 1/61 + 1/62 ≈ 0.0325
- Doc C = 1/63 + 1/61 ≈ 0.0323
A edges out C because it ranked highly in both lists, though the margin is small.
Takeaway: A document that consistently appears near the top across retrievers is likely relevant. RRF is simple, needs no score normalization, and is supported natively in many search platforms. Many production systems also add a re-ranker afterward for extra precision.
Caveats: RRF discards score magnitude, k is tunable, and hybrid search adds complexity, so test it against your own data.