Hybrid Search: BM25 and Dense Retrieval Combined › Hybrid Search: BM25 and Dense Retrieval Combined

Michael BrenndoerferJanuary 29, 20263 min read
Language AI HandbookAll chapters
Part 44 of 67Retrieval-Augmented Generation
Chapter 342Hybrid Search: BM25 and Dense Retrieval Combined › Hybrid Search: BM25 and Dense Retrieval Combined
Reading section 1 of 10 · Hybrid Search: BM25 and Dense Retrieval Combined · 3 minSection 1 of 10 · 3 min

Book contents

Section 1 of 10 · 3 min read

Hybrid Search: BM25 and Dense Retrieval Combined › Hybrid Search: BM25 and Dense Retrieval CombinedOne section · Sections in this chapter1 / 10 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

When you type a query into a search system, two fundamentally different engines could be working to find your answer. The first is a classical keyword matcher: it looks for documents that contain the exact words you typed, using statistical signals like term frequency to rank results. The second is a semantic engine: it converts your query and every document into dense vectors, then finds documents whose meaning is closest to yours, even if they share no words in common. Both approaches have real strengths, and both have real weaknesses. Hybrid search combines them.

The insight behind hybrid search is simple but powerful: keyword matching and semantic retrieval fail in complementary ways. A keyword system finds the document containing "myocardial infarction" when you search for "heart attack" only if someone mapped those synonyms in advance. A semantic system finds semantically related documents but can miss the one where a specific product code like "AB-1042-X" appears verbatim. Neither system alone is reliable. Together, they cover each other's blind spots.

Think of the two systems as two specialists working the same library. The first specialist has memorized the exact text of every document and can instantly point you to any document containing your precise phrase. The second specialist has deeply internalized the meaning of every document and can point you to conceptually related material even when no shared vocabulary exists. Asking both specialists independently, then combining their recommendations, consistently produces better results than relying on either alone.

This complementarity is not accidental. It shows a deep asymmetry in what the two systems learn. Keyword systems learn statistics over the literal surface form of text: which strings appear, how often, and in which documents. Semantic systems learn geometry: how to map meaning into a high-dimensional space so that similar meanings end up nearby. These are orthogonal views of the same text, and relevance is a combination of both. A document that addresses your query's exact phrasing is often relevant. A document that addresses your query's underlying concept is also often relevant. A document that does both is very likely the best answer. Hybrid retrieval finds all three types.

This chapter explains how to build hybrid retrieval systems. We will examine BM25, the classical ranking function that anchors the keyword half, and dense retrieval, the vector-based approach that gives the semantic half. We will then study the two main fusion strategies: reciprocal rank fusion, which combines ranked lists without needing to understand the underlying scores, and weighted score combination, which blends the scores directly. Throughout, we ground the math in intuition and the intuition in working code.

As we saw in the chapter on Dense Retrieval and Embedding Models, dense retrieval converts documents and queries into high-dimensional vectors using models like bi-encoders trained with contrastive objectives. As we saw in Vector Similarity Search and the HNSW and IVF Index chapters, those vectors can be searched efficiently at scale using approximate nearest neighbor indices. This chapter builds directly on that foundation, adding the classical retrieval side and then fusing the two into a single, more powerful system. In the next chapter on Reranking, we will add another stage that takes the hybrid retrieval output and re-scores it with a heavier cross-encoder model.