Hybrid search combines BM25 keyword search and vector similarity search into a single system. It is the recommended approach for production because it reliably outperforms either method alone — their failure modes are complementary, so combining them covers both gaps.
Keyword search fails at synonyms and paraphrasing. Vector search fails at exact identifier lookup. Hybrid search fails at neither. A query for "car crash prevention" finds documents using that exact phrase (keyword) and documents about "automobile safety" (vector).
Parallel query — The query runs simultaneously against a BM25 inverted index and a vector ANN index. Each returns a ranked list of results.
Rank fusion — The two ranked lists are merged. The most common algorithm is Reciprocal Rank Fusion (RRF): each document scores based on its rank in each list. Documents near the top of both lists score highest.
Optional re-ranking — A cross-encoder re-ranker scores the top-k candidates more precisely by considering the query and each candidate together. Slow but accurate — run only over a small candidate set (50-100 results).
RRF only uses rank positions, not raw scores. This means you don't need to normalize BM25 scores and cosine similarity scores onto the same scale — they're on completely different scales, and any normalization introduces bias. RRF sidesteps this problem entirely.
A document that appears near the top of both ranked lists gets the highest combined score. A document that appears in only one list still contributes. This makes hybrid search robust to any individual system's failures.
More weight on keyword search. Better when users search by exact names, codes, identifiers, or precise phrases.
More weight on vector search. Better when users ask natural language questions or describe what they want without knowing exact terminology.
Always tune alpha empirically on real queries with human-judged relevance. Do not guess.
Ask the AI assistant about hybrid search, Reciprocal Rank Fusion, re-ranking, or how to tune search systems.