liveBook · Manning

Hybrid search

As explained in Retrieval Augmented Generation, The Foundational Ideas

Hybrid search combines dense and sparse retrieval methods to improve the range and quality of retrieved results.

An enterprise search system may need to find both an exact regulatory citation and a passage that answers a conversational question using different words. Keyword retrieval protects exact matches; dense retrieval reaches conceptually related passages. Hybrid search combines the two so neither kind of query depends on one retrieval method alone. section 2.1.6 section 2.4.1

A typical design keeps a lexical path, such as BM25 over an inverted index, alongside a path that compares query and document embeddings. At query time, both paths produce results; rank fusion can merge their lists before a more precise reranker scores the survivors. This adds infrastructure and tuning work, so it is not automatically better than a well-matched single retriever. section 2.0 section 1.5.2

Choose the starting point by the queries you expect:

  • Use keyword retrieval for precise legal terms, regulatory citations, API names, or function calls; it can be faster and less expensive than semantic search. section 2.1.6
  • Use dense retrieval when conversational queries have little vocabulary overlap with relevant documents. section 2.1.6
  • Start with hybrid retrieval when query logs are unavailable or the collection mixes technical and general documents. Check whether the added path earns its cost. section 2.1.6 section 1.5.2

Fusing an expanded query with exact matches

A HyDE-generated passage can supply an embedding for semantic search while the original query runs through BM25. Reciprocal rank fusion merges the two ranked lists. The semantic path can find relevant wording the user did not supply; the lexical path preserves matches on a part number, statute reference, or drug name. section 7.6.2

Hybrid does not always mean BM25 plus vectors. A graph-based variant routes specific entity keywords to indexed entity profiles and abstract themes to vector similarity, then synthesizes an answer from the combined context. The shared design principle is to give different query needs different retrieval paths. section 12.4.3

Table 14.3 Question-context taxonomy for RAG evaluation datasets
Class
Description
Example query
Retrieval difficulty
fact_single
Answer is one unit of information, directly stated in context
"What supply voltage should I use?"
Easiest: direct lexical/semantic match
summary
Answer requires multiple pieces from context
"Summarize the key findings."
Medium: must retrieve the broad context
reasoning
Answer must be inferred, not directly stated
"Has consumption increased over 5 years?"
Hardest: context doesn't contain the answer verbatim
unanswerable
Answer cannot be derived from the context
"Is a tomato a fruit or a vegetable?" (asked of a coffee machine patent)
Tests negative rejection

Use the question-context taxonomy to test more than direct fact lookup. Summary and reasoning questions need different context, and a benchmark dominated by single-fact questions can favor the wrong lexical-versus-semantic weighting. section 14.4

How Retrieval Augmented Generation, The Foundational Ideas covers it

How deep it goes
Explains retriever selection and rank fusion, while leaving detailed fusion implementation to a separate treatment.
Examples
Uses exact regulatory terms, part numbers, entity lookups, and a question-context taxonomy to show where retrieval paths differ.
What it assumes
Builds on keyword retrieval and embeddings, with inverted indexes and dense vectors established as retrieval foundations.
What you can do after
Evaluate/understand it by selecting an initial retriever for the query mix and testing hybrid weights across question types.
How it connects
Connects BM25, dense retrieval, HyDE, reciprocal rank fusion, reranking, and RAG evaluation.

Also explained in

Compare how 15 books explain hybrid search →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Retrieval Augmented Generation, The Foundational Ideas. The section links point to the parts of the book it draws on.