What happens when a user asks your RAG system about “error code E4021” and it confidently returns a paragraph about a completely different error? That moment, frustrating for users and embarrassing for builders, is usually not a generation problem. It is a retrieval problem. And it is one of the clearest reasons hybrid search has become a default design choice in serious retrieval-augmented generation systems.
Retrieval-augmented generation, or RAG, is the pattern where a language model answers a question using documents fetched from an external knowledge base. The model does not rely only on what it memorized during training. It reads retrieved passages first, then writes an answer grounded in them. The term comes from a 2020 paper by Lewis and colleagues that paired a dense retriever with a sequence-to-sequence generator, and the idea has since become the backbone of enterprise search, support bots, and internal knowledge assistants.
But here is the catch that trips up many teams: the retriever is the part that decides whether the whole system works. If the right passage never makes it into the context window, no amount of clever prompting will save the answer. Hybrid search exists to make sure that passage shows up.
What hybrid search actually means
Hybrid search runs two different retrieval methods over the same corpus and then merges their results.
The first method is lexical retrieval, usually powered by BM25. This is classic keyword matching with statistical weighting: it rewards documents that contain the query’s actual words, adjusts for how rare those words are, and normalizes for document length. BM25 descends from probabilistic ranking work from the 1990s, and a widely cited survey by Robertson and Zaragoza explains the scoring model in depth if you want the math. (Okapi BM25 ranking function)
The second method is dense retrieval, which converts the query and every document chunk into vectors using an embedding model, then finds the chunks whose vectors sit closest to the query vector. This captures meaning rather than wording, so a search for “how do I cancel my subscription” can match a passage titled “ending your plan.”
Each method has a blind spot that mirrors the other’s strength. BM25 is excellent with exact identifiers, product codes, legal citations, names, and rare acronyms, but it fails when the user phrases things differently from the document. Dense retrieval handles paraphrase and synonyms beautifully but can quietly ignore a serial number or confuse two similar-sounding entities. Hybrid search combines them so the weaknesses cancel out.
Why RAG systems need both halves

Think about the queries real users type into a company knowledge base. Some are conceptual: “what is our refund policy for damaged goods?” Others are literal: “policy 7.3.2,” “SKU 44821-B,” “ISO 27001,” or a colleague’s surname. A pure vector index often does fine on the first kind and struggles on the second, because embeddings compress specific tokens into fuzzy semantic blobs. Research on combining sparse and dense retrieval signals has repeatedly shown that the two approaches retrieve different relevant documents, which is exactly why fusing them helps.
There is a second, subtler reason. Dense retrievers are trained on general-purpose data. If your corpus is full of internal jargon, part numbers, or regulatory language the embedding model never saw, its notion of similarity will be slightly off. BM25 does not care about training data. It just counts. That makes it a dependable floor beneath the fancy stuff.
In practice, teams that skip lexical search often discover the gap the hard way, through a support ticket about a query that “should have worked.” If you follow engineering case studies and product updates, this pattern shows up constantly in write-ups about retrieval quality, and it is worth reading the news coverage on search infrastructure to see how often exact-match failures drive architecture changes. (News)
Merging results: Reciprocal Rank Fusion and its alternatives
Once you have two ranked lists, you need one list. The most common method is Reciprocal Rank Fusion (RRF), introduced by Cormack, Clarke, and Büttcher in 2009. The original Reciprocal Rank Fusion paper lays out the formula: each document scores the sum of 1/(k + rank) across every list it appears in, with k typically set to 60.
Why is RRF so popular? Because it only looks at ranks, not raw scores. BM25 scores and cosine similarities live on completely different scales, and calibrating them is a headache. RRF sidesteps the whole problem. A document ranked third by BM25 and fifth by the vector search gets a strong combined score, and no normalization is required.
| Merge method | What it uses | Strength | Weakness |
|---|---|---|---|
| Reciprocal Rank Fusion | Ranks only | No score calibration needed; stable across score scales | Ignores how far apart scores are |
| Weighted score sum | Normalized scores | Tunable per retriever | Needs careful normalization |
| Concatenate and rerank | Both lists, then a cross-encoder | Highest quality | Slowest and most expensive |
| Take top-k from each | Fixed cutoff | Simple to implement | Can flood context with weak hits |
A practical middle path many teams use: fuse with RRF to get a candidate pool of 50 to 100 chunks, then run a cross-encoder reranker over that pool and keep the top 5 to 10 for the prompt. The reranker is slower but far more accurate, and because it only sees a small candidate set, the cost stays manageable. This two-stage pattern, retrieve broadly then rerank precisely, is one of the highest-leverage improvements available.
Building a hybrid pipeline step by step
If you are implementing this from scratch, the sequence below is a solid default. Adjust the numbers to your corpus, but start here rather than agonizing over parameters.
- Chunk your documents sensibly. Aim for 200 to 500 tokens per chunk with a small overlap. Chunks that split a table or a code sample in half will hurt both retrievers.
- Index each chunk twice. Once in a BM25 index and once as an embedding in a vector store. Keep a shared chunk ID so results can be joined.
- Run both queries in parallel. Latency matters, and the two searches are independent.
- Fuse with RRF, k set to 60 as a starting point.
- Rerank the top 50 candidates with a cross-encoder if latency allows.
- Pass the top 5 to 10 chunks to the generator, with source metadata attached.
- Log everything. Store which retriever surfaced each chunk so you can diagnose failures later.
Several open-source engines support both BM25 and vector search in a single query, including OpenSearch, Elasticsearch, Weaviate, and pgvector-based setups. Feature names and syntax change frequently, so check current documentation rather than trusting a blog post from two years ago. (Blog) (Elasticsearch k-nearest neighbor (kNN) search documentation)
Common mistakes that quietly break hybrid RAG
The failures here are rarely dramatic. They are small, boring, and cumulative.
Using the same chunk size for both retrievers. BM25 often does better with slightly larger chunks because it needs term context; dense retrieval often prefers tighter chunks. Some teams maintain two chunkings and map between them. That adds complexity, so only do it if your evaluation shows a real gain.
Forgetting to tune BM25’s parameters. The k1 and b values control term-frequency saturation and length normalization. Defaults are fine for general text, but short technical snippets and long legal documents behave differently.
Treating fusion as the finish line. RRF is a merger, not a ranker. Without a reranking step, you are still feeding the generator whatever the two retrievers happened to like.
Ignoring metadata filters. If a user asks about a specific product line, filtering by that field before retrieval often beats any fusion trick. Hybrid search and metadata filtering are complements, not substitutes.
Skipping evaluation entirely. This is the big one. Teams ship hybrid search, feel good about it, and never measure whether it actually beat dense-only on their traffic.
How to measure whether hybrid search is worth it
Retrieval quality is typically measured with recall@k (did the right chunk appear in the top k?), MRR (how high did the first relevant result rank?), and nDCG (does the ranking order reflect relevance grades?). Build a test set of 100 to 300 real queries with labeled relevant chunks. It takes effort, but it is the only way to know.
For end-to-end quality, frameworks such as RAGAS, introduced by Es and colleagues in 2023, measure things like faithfulness (is the answer supported by the retrieved context?) and answer relevance (does it address the question?). The RAGAS evaluation paper describes these metrics in detail and is a good starting point for building an evaluation harness.
One honest caveat: there is no single agreed benchmark for “hybrid search in RAG.” Reported gains over dense-only retrieval vary a lot by corpus and query mix. On semantic-heavy tasks, dense-only can be competitive or even better. Treat vendor claims of dramatic improvements with skepticism and measure on your own data. For broader context on how retrieval and cloud infrastructure decisions interact, the cloud section of technical blogs often covers deployment trade-offs worth knowing. (Cloud)
Practical guidance on tuning and operations
A few habits separate teams that get hybrid search working from teams that fight it forever.
Start with dense-only, then add BM25 and measure the delta. If hybrid does not help, you have learned something valuable and saved yourself operational complexity. If it does help, you know exactly how much.
Watch your index freshness. BM25 indexes and vector indexes update at different speeds depending on the engine. A document added five minutes ago may be findable by one retriever and invisible to the other. For support and incident-response use cases, that inconsistency matters.
Keep an eye on cost. Running two retrievals roughly doubles retrieval compute, though retrieval is usually cheap compared to generation. The reranker is the expensive part. Cache aggressively for repeated queries.
Finally, review failures monthly. Pull queries where the answer was wrong, check which retriever surfaced the bad chunk, and look for patterns. Often you will find one category, like part numbers with hyphens, that a small tokenizer or analyzer tweak fixes for good. Regular blog posts on search and retrieval patterns are a good way to stay current without chasing every new paper.
Conclusion
Hybrid search is not glamorous. It is two retrieval methods, a rank-fusion formula from 2009, and a reranker doing cleanup. But that unglamorous combination solves one of the most common and most damaging failure modes in RAG: the right document existing in your corpus while never reaching the model that needed it.
The recipe is straightforward. Index lexically and semantically, fuse with RRF, rerank, evaluate on your own queries, and iterate. Start simple, measure honestly, and add complexity only where the numbers justify it. Your users will not notice the architecture. They will just notice that the answers are right, including the ones with error codes in them.
Frequently asked questions
What is hybrid search in RAG?
Hybrid search in RAG means running two retrieval methods over the same documents, typically keyword-based BM25 and dense vector search, then merging their ranked results into one list. The merged list is what gets passed to the language model as context. The goal is to catch both exact-term matches and semantic paraphrases that either method alone would miss.
Why is BM25 still used alongside vector search?
BM25 excels at exact matches: product codes, error numbers, names, acronyms, and rare terms. Embedding models tend to blur those specifics into general meaning. Because BM25 needs no training and has no notion of semantics, it acts as a reliable floor under the vector retriever, especially for corpora full of internal jargon the embedding model never saw.
What is Reciprocal Rank Fusion and why is it popular?
Reciprocal Rank Fusion, from a 2009 paper by Cormack, Clarke, and Büttcher, scores each document as the sum of 1/(k + rank) across all result lists, with k usually set to 60. It is popular because it uses only ranks, not raw scores, so you never have to calibrate BM25 scores against cosine similarities. That keeps it simple to use with very different retrievers.
Does hybrid search always beat dense-only retrieval?
No. Gains vary by corpus and query type. On semantic-heavy tasks with few exact identifiers, dense-only can be competitive or better. Hybrid search tends to shine when queries mix natural language with codes, names, or rare terms. The only reliable answer comes from building a labeled test set from your own queries and measuring recall@k and nDCG.
How many chunks should I pass to the generator?
Most teams pass 5 to 10 chunks after reranking. More context raises the chance the answer is present but also increases cost, latency, and the risk of the model getting distracted by irrelevant passages. A common pattern is to fuse down to 50 candidates with RRF, rerank with a cross-encoder, and keep the top handful.
Do I need a special vector database for hybrid search?
Not necessarily. Several open-source engines support BM25 and vector search in one query, including OpenSearch, Elasticsearch, Weaviate, and pgvector-based stacks. Some teams run two separate systems and merge results in application code, which is more work but gives full control over fusion and reranking. Check current documentation, since feature support changes often.







