Explain hybrid search: why combine vector search and BM25? What is RRF (Reciprocal Rank Fusion)?
sobes.tech AI
Answer from AI
Hybrid search combines the advantages of two approaches: vector search and traditional BM25 text search.
-
Vector search works well with semantics and meaning, allowing to find relevant documents by sense, even if there are no exact word matches.
-
BM25 is a classic ranking algorithm based on word frequencies and document length, suitable for exact keyword matching.
By combining them, you can achieve a more quality search that considers both semantics and exact matches.
RRF (Reciprocal Rank Fusion) is a method of combining results from multiple search systems or models. It assigns each result position a weight inversely proportional to its rank and sums these weights for the final ranking.
The RRF formula for document d:
[ score(d) = \sum_{i=1}^n \frac{1}{k + rank_i(d)} ]
where:
- ( n ) — number of systems,
- ( rank_i(d) ) — position of the document in the i-th system,
- ( k ) — a smoothing constant (usually 60).
Thus, RRF effectively combines vector search and BM25 results, improving the quality of the final ranking.