DEV Community

Cover image for Hybrid Search in RAG: Why Neither Keyword Search Nor Semantic Search Alone Is Good Enough
Nikhil raman K
Nikhil raman K

Posted on

Hybrid Search in RAG: Why Neither Keyword Search Nor Semantic Search Alone Is Good Enough


A Dutch customer queried an automotive assistant:
"kenteken AB-123-CD apk verlopen?"

The semantic search returned documents about
APK inspections, vehicle registration, and
automotive services.

Technically correct. Semantically relevant.
Completely useless.

The exact vehicle record with license plate
AB-123-CD ranked 20th. The customer never
saw it. The answer was wrong.

This is the failure that launched hybrid search
as the production standard in 2026.

Not because keyword search or semantic search
are broken technologies. Because each one is
precisely correct on the queries the other
one fails on — and neither one can tell you
which queries those are in advance.

This blog explains exactly how each retrieval
method works, where each one breaks, and why
hybrid search is not a compromise between them
but a genuinely superior architecture.


Table of Contents

  1. The Retrieval Problem Every RAG System Faces
  2. Keyword Search: BM25 in Precise Detail
  3. Semantic Search: Dense Vector Retrieval Explained
  4. Where Each One Fails Silently
  5. Hybrid Search: The Architecture That Combines Both
  6. Reciprocal Rank Fusion: The Fusion Mechanism
  7. The Numbers: What Benchmarks Actually Show
  8. The Domain Factor: Which Method Wins Where
  9. Reranking: The Precision Layer Above Retrieval
  10. Production Decision Framework

1. The Retrieval Problem Every RAG System Faces

Every RAG system has the same fundamental challenge:
given a user query, find the document chunks that
contain the information needed to answer it correctly.

This sounds straightforward. It is not.

The challenge is that users ask questions in two
fundamentally different ways — and the two ways
require completely different retrieval mechanisms.

Some queries are lexically specific. The user
knows the exact term, identifier, code, or name
they are looking for. "Error code E-7821."
"License plate AB-123-CD." "SKU-00471."
"Section 14(b)(iii) of the vendor agreement."

Other queries are semantically general. The user
is expressing an intent or concept without knowing
the exact terminology. "Why is my car failing
inspection?" "What does this error mean?"
"What are my rights if the product is defective?"

Keyword search retrieves the first type reliably
and misses the second type systematically.
Semantic search retrieves the second type reliably
and misses the first type in a specific and
predictable way.

Production RAG systems receive both types
in every traffic stream. A retrieval architecture
that handles only one type correctly is failing
on a significant fraction of real user queries —
silently, with no error log, while still
producing fluent confident-sounding answers.

That is the problem hybrid search solves.


2. Keyword Search: BM25 in Precise Detail

BM25 — Best Matching 25 — was published in 1994.
It remains the gold standard for sparse retrieval
and in 2025 still outperforms multi-billion-parameter
dense embedding models on a meaningful and specific
class of real-world queries.

Understanding why requires understanding precisely
what BM25 does.

BM25 scores a document against a query using three
factors: term frequency, inverse document frequency,
and document length normalization.

Term frequency measures how often a query term
appears in a document. A document mentioning
"AB-123-CD" five times scores higher than one
mentioning it once. But BM25 applies a saturation
function — the score grows rapidly with early
occurrences and then flattens. The difference
between five and fifty occurrences is much
smaller than the difference between zero and one.
This prevents documents that simply repeat
terms from gaming the score.

Inverse document frequency measures how rare
a term is across the entire document collection.
A term appearing in 10 of 10,000 documents gets
a much higher IDF weight than a term appearing
in 9,000 of 10,000. Rare terms that appear in
a query are highly discriminative — BM25 weights
them heavily. Common terms that appear everywhere
carry little signal — BM25 discounts them.

Document length normalization prevents short
documents from being unfairly penalized and long
documents from being unfairly rewarded. A term
appearing once in a 50-word document is more
significant than the same term appearing once
in a 5,000-word document. BM25 adjusts for this.

The result is a retrieval algorithm that is
exceptionally precise on exact term matching.
BM25 does not understand meaning, synonyms,
or paraphrases. "Configuration override" and
"custom settings" are completely unrelated to BM25
even though they describe the same concept.
But for a query about "BMW 320d" — BM25 finds
every document mentioning exactly those tokens
with no semantic ambiguity introduced.

What BM25 does exceptionally well:
Product codes, error codes, license plates, ticker
symbols, API names, legal clause references, medical
terminology, patent numbers, and any query where
the exact lexical match is the correct answer.

The BEIR benchmark confirms this precisely:
On financial documents containing company names,
ticker symbols, and standardized metric labels —
BM25 outperforms text-embedding-3-large, one of the
strongest commercial embedding models available,
on every metric except Recall@20. The domain
specificity of the terminology gives BM25 a
systematic advantage that dense retrieval cannot
overcome through semantic understanding.


3. Semantic Search: Dense Vector Retrieval Explained

Semantic search — dense vector retrieval — operates
on a fundamentally different principle. Instead of
matching tokens, it matches meaning.

An embedding model encodes both the query and
every document chunk into high-dimensional vectors
— typically 384 to 3,072 dimensions depending on
the model. These vectors are positioned in a space
where semantic similarity corresponds to geometric
proximity. "Car inspection" and "vehicle MOT check"
end up near each other in this space even though
they share no tokens, because they describe the
same concept.

At query time, the query is embedded into the
same vector space. The retrieval system finds
the document chunks whose vectors are closest
to the query vector — typically using Approximate
Nearest Neighbor search with HNSW (Hierarchical
Navigable Small World) graphs for efficient
lookup across millions of vectors.

The critical property: semantic search retrieves
by intent, not by lexical match. A user who asks
"why won't my car start in cold weather" gets
documents about battery performance, fuel viscosity,
and engine cold starts — even if none of those
documents use the exact phrase "won't start in
cold weather."

What dense retrieval does exceptionally well:
Conversational queries, paraphrased questions,
concept searches, cross-lingual retrieval,
queries where users do not know the correct
technical terminology, and any task where
understanding intent matters more than
matching exact words.

Dense retrieval outperforms BM25 on BEIR datasets
by 15 to 25 percent overall
as of 2026 benchmarks.
The gap has widened significantly since 2021 as
embedding models have improved. For general-purpose
retrieval across diverse query types, semantic
search is the stronger baseline.


4. Where Each One Fails Silently

This is the section that determines whether you
understand retrieval deeply or just theoretically.

Where BM25 fails:

BM25 has zero awareness of synonyms, paraphrases,
or conceptual relationships. "Configuration override"
and "custom settings" are identical to BM25 in
their irrelevance to each other. A user asking
about "budget constraints" will not retrieve
documents about "financial limitations" through
BM25 even though those documents contain exactly
the answer they need.

This failure is predictable: any query where the
user's vocabulary does not match the document
vocabulary will underperform. In a corpus written
by domain experts queried by non-expert users —
which describes most enterprise knowledge bases
— this mismatch is frequent and systematic.

Where dense retrieval fails — and why it is
more dangerous than BM25 failure:

Dense retrieval fails on lexically specific queries
in a way that BM25 never does. When a query contains
a rare named entity, a product code, or a specific
identifier — the embedding model averages that
specific term's signal with the semantic context
of the surrounding query. The exact match signal
gets diluted.

In a 2026 production system serving three domains —
automotive, travel, and cleaning — dense-only
retrieval achieved 62 percent top-5 accuracy.
BM25-only achieved 58 percent. But 15 percent of
queries had the correct answer ranked 20th or worse
in the dense retrieval results — meaning the correct
answer existed in the corpus but was retrieved too
late to reach the LLM's context window.

This failure is silent. The LLM still receives
some context. It still generates a fluent, confident
answer. The answer is wrong, but no error fires.
This is the most dangerous class of RAG failure —
the system appears to be working while systematically
producing incorrect outputs for a predictable
class of queries.

The research from TianPan.co April 2026 states this
precisely: dense retrieval fails silently on exact
identifiers, code, and rare terms. The failure is
not logged. It is only discovered through user
complaints or manual audits — usually long after
the incorrect answers have been delivered at scale.


5. Hybrid Search: The Architecture That Combines Both

Hybrid search runs both BM25 and dense retrieval
in parallel on every query, then merges their
ranked result lists into a single unified ranking.

The architecture is straightforward at the
conceptual level:

User Query
│
├──► BM25 Index ──► Sparse ranked list
│
└──► Vector Index ──► Dense ranked list
│
▼
Score Fusion (RRF)
│
▼
Unified ranked list
│
▼
Top-k chunks → LLM context
Enter fullscreen mode Exit fullscreen mode

The insight is that for any given query, at least
one of the two methods will retrieve the correct
document — and the fusion step ensures the correct
document appears in the final merged list even
if it ranked poorly in one of the individual lists.

The Dutch automotive example: BM25 retrieves
the exact vehicle record for "AB-123-CD" in
position 1 because it matches the exact token.
Dense retrieval returns it at position 20 because
the semantic embedding averages the plate number's
signal with surrounding context. After fusion,
the BM25 score elevates the correct document to
the top of the merged list. The LLM receives it.
The answer is correct.

The inverse failure is covered too: a conversational
query about "vehicle reliability concerns" where
BM25 misses it entirely — dense retrieval places
the correct documents in the top 3 and fusion
preserves that ranking.

Neither retrieval method needs to be perfect.
They only need to be complementary — which they
are by design.


6. Reciprocal Rank Fusion: The Fusion Mechanism

The most production-proven fusion method is
Reciprocal Rank Fusion (RRF). Understanding it
precisely matters because the choice of fusion
method significantly affects retrieval quality.

RRF assigns a score to each document based on
its rank in each individual result list:
RRF_score(document) = Σ 1 / (k + rank_in_list)

Where k is typically set to 60 — a value empirically
found to balance the influence of high-ranked and
lower-ranked documents across diverse query types.

A document ranked 1st in the BM25 list contributes
1/(60+1) = 0.0164 to its RRF score.
A document ranked 10th contributes 1/(60+10) = 0.0143.
A document ranked 100th contributes 1/(60+100) = 0.0063.

The key property: RRF requires no score normalization.
BM25 scores and cosine similarity scores are on
completely different scales and cannot be directly
combined through weighted addition without careful
normalization that is both fragile and dataset-dependent.
RRF sidesteps this entirely by operating on ranks
rather than raw scores. Use k=60 and it works
across score scales without tuning.

The alternative: Relative Score Fusion (RSF)
Used by Weaviate. Normalizes both score distributions
to a common range before combining. More sensitive
to the quality of each retrieval method's score
distribution. RRF is more robust as a default.
RSF can outperform RRF when scores are well-calibrated
and the relative magnitudes carry genuine signal.

The alpha parameter:
Some hybrid implementations expose an alpha parameter
controlling the blend weight between sparse and dense.
Alpha of 1.0 is pure dense retrieval. Alpha of 0.0
is pure BM25. Values between are weighted combinations.

The 2026 research frontier: dynamic alpha tuning
detecting whether an incoming query is lexically
specific or semantically general at query time
and adjusting alpha accordingly. A query containing
a product code or identifier shifts alpha toward
BM25. A conversational query shifts it toward dense.
This per-query adaptation consistently outperforms
any fixed alpha setting across mixed-intent traffic.


7. The Numbers: What Benchmarks Actually Show

The quantitative evidence is unambiguous on the
direction. The nuance is in understanding what
the numbers actually measure.

MS MARCO High-Recall Benchmark:

Hybrid retrieval achieves 80.8 percent Recall@10,
compared to 13.9 percent for dense-only and
11.9 percent for BM25-only. This represents a
580 percent relative improvement — a 5.8x
multiplicative gain — over the best single-method
approach.

BEIR Benchmark — 2026 Update:

Hybrid retrieval combining BM25 and dense vectors
still provides 2 to 5 percent NDCG gains over
dense-only retrieval, especially on out-of-domain
queries. While the marginal benefit has decreased
as dense models improve, hybrid approaches remain
the production standard.

BM25 alone achieves nDCG@10 of 43.4 on BEIR average.
Hybrid with reranking improves this to above 52.6.

Production benchmark — multilingual automotive (2026):

Dense-only accuracy: 62 percent top-5 recall.
BM25-only accuracy: 58 percent top-5 recall.
Critical failures where correct answer ranked 20th
or worse: 15 percent of all queries. Hybrid
retrieval combining BM25, dense FAISS vectors,
and cross-encoder reranking achieved 48 percent
accuracy improvement over the dense-only baseline.

OpenAI and Qdrant hybrid benchmarks:

Recall increases from approximately 0.72 on BM25-only
to approximately 0.91 on hybrid. Precision improves
from approximately 0.68 to approximately 0.87.
Hybrid retrieval balances precision and recall
in a way neither method achieves independently.

The benchmark caveat engineers must understand:

Teams that discover BM25 failure after deploying
pure vector search tend to discover it the worst
possible way — through hallucination complaints
they cannot reproduce in evaluation, because their
eval set was built from queries that already worked.
This is the retrieval equivalent of sampling bias.

Your evaluation set is almost certainly skewed
toward queries where semantic search works.
The queries where BM25 matters — exact identifiers,
rare terms, domain jargon — are precisely the
queries that generate hallucinations in production
and that standard eval sets underrepresent.
Hybrid search protects against the failure mode
your evaluation never catches.


8. The Domain Factor: Which Method Wins Where

The research reveals a counter-intuitive finding
that challenges the common assumption in the field.

On financial documents, BM25 outperforms
text-embedding-3-large — one of the strongest
commercial embedding models available in 2026 —
on every metric except Recall@20. Financial
documents contain precise domain-specific
terminology including company names, ticker symbols,
and standardized metric labels that lexical matching
captures effectively. This challenges the common
assumption that dense retrieval universally dominates.

This is not an isolated finding. The BEIR benchmark
has documented domain-specific BM25 superiority
since 2021. The pattern holds consistently:

Domains where BM25 performs strongly:
Legal documents — precise clause references,
defined terms, citation formats.
Financial documents — tickers, ratios, regulatory
references, exact numerical values.
Medical records — ICD codes, drug names,
standardized terminology.
Technical documentation — API names, error codes,
configuration parameters, command syntax.
Code search — function names, variable names,
library imports, exact syntax.

Domains where dense retrieval performs strongly:
Customer support — paraphrased questions, intent
varies from document vocabulary.
General knowledge — conceptual queries, broad topics.
Cross-lingual — query and document in different languages.
Exploratory search — user does not know exact terminology.

The production implication:

Your domain determines your optimal alpha setting
for hybrid search. Legal and financial corpora
benefit from lower alpha — more weight to BM25.
Conversational and customer-facing applications
benefit from higher alpha — more weight to dense.
General enterprise knowledge bases benefit from
the default balanced setting.

The 2026 research recommendation: tune alpha
on a held-out query set from your actual production
traffic, not on generic benchmarks. The optimal
balance is corpus-specific and query-distribution-specific.
No benchmark can tell you what your system needs.
Only your data can.


9. Reranking: The Precision Layer Above Retrieval

Hybrid retrieval maximizes recall — the probability
that the correct document is somewhere in the
top-k results. Reranking maximizes precision —
the probability that the correct document is
at the very top of those results where the LLM
will actually use it.

These are different problems requiring different
models. Conflating them is one of the most common
architectural mistakes in production RAG systems.

The retrieval stage: Hybrid BM25 plus dense ANN
with RRF fusion, fetching top-50 to top-100 candidates.
Fast. High-recall. Operating on pre-computed indices.
Sub-100ms latency for most corpus sizes.

The reranking stage: A cross-encoder model that
takes each candidate document and the original query
as a pair and scores them jointly — with full attention
between query and document rather than independent
embedding. This catches relevance that embedding
similarity misses. The top-5 to top-10 from reranking
proceed to the LLM context.

The two-stage architecture consistently outperforms
either stage alone:

The corrective RAG benchmark (arXiv:2604.01733)
found that a two-stage pipeline combining hybrid
retrieval with neural reranking achieves Recall@5
of 0.816 and MRR@3 of 0.605, outperforming all
single-stage methods by a large margin.

Biomedical QA: BM25 achieves 0.72 accuracy with
50-candidate retrieval, improving to 0.90 after
MedCPT reranking — a 25 percent gain from adding
the reranking stage alone.

The architectural principle:

Retrieval is a high-recall problem.
Reranking is a high-precision problem.
They require different models and operate
at different latency budgets.
Do not ask one to do the other's job.


10. Production Decision Framework

Use this framework to determine the right retrieval
architecture for your specific system:

Use BM25 alone when:
Your corpus is small and keyword-heavy.
Queries are consistently exact-term lookups.
Latency budget is extremely tight.
You are building a baseline to improve from.
Domain is legal, financial, or highly technical
with controlled vocabulary.

Use dense retrieval alone when:
Queries are consistently conversational or paraphrased.
Your corpus contains general knowledge content.
Cross-lingual retrieval is required.
Your evaluation shows dense clearly outperforms
BM25 on your specific query distribution.
Note: dense-only is increasingly hard to justify
in production given the silent failure mode on
exact identifiers.

Use hybrid retrieval — RRF fusion — when:
Your traffic contains a mix of lexically specific
and semantically general queries.
You cannot predict which query type will arrive.
You are building for production reliability
rather than benchmark optimization.
Cost of a wrong answer exceeds cost of added
retrieval complexity.
This is the correct default for the vast majority
of production RAG systems in 2026.

Add reranking when:
Context window size forces you to limit
the LLM's context to top-3 to top-5 chunks.
Retrieval precision — not just recall — matters.
You need the highest possible answer quality
and can absorb the additional latency cost
of a cross-encoder scoring pass.

The minimum viable production stack:
Hybrid retrieval:
BM25 index (Elasticsearch or OpenSearch)

Dense ANN index (Weaviate, Qdrant, or Pinecone)
RRF fusion (k=60, no tuning required)
→ Top-50 candidates

Reranking:
Cross-encoder (Cohere Rerank or Jina Reranker)
→ Top-5 to LLM context
Total added latency over dense-only:
BM25 computation: sub-second
RRF fusion: negligible
Reranking: 100-300ms depending on model
Total recall improvement: 15 to 30 percent

The ROI is clear. Hybrid retrieval with reranking
represents the highest-return retrieval investment
available in a RAG system — more impact per
engineering hour than prompt optimization,
chunking strategy, or model selection for
the majority of production knowledge systems.


The Three Line Summary

BM25 finds what you said.
Semantic search finds what you meant.
Hybrid search finds both.

And in production, your users say things
and mean things in the same query —
sometimes in the same word.

That is why hybrid search is not a compromise.
It is the architecture that takes both
retrieval methods seriously enough to use
both of them.


Research Sources

  • Bronckers — E.V.A. Cascading Retrieval: 48% Better
    RAG Accuracy with Hybrid BM25 + Dense Vector Search.
    Medium. January 2026. Production benchmark:
    62% dense, 58% BM25, 48% improvement with hybrid.

  • From BM25 to Corrective RAG: Benchmarking Retrieval
    Strategies for Text-and-Table Documents.
    arXiv:2604.01733. April 2026.
    Two-stage hybrid plus reranking: Recall@5 0.816,
    MRR@3 0.605.

  • Hybrid Dense-Sparse Retrieval for High-Recall
    Information Retrieval. ResearchGate. January 2026.
    MS MARCO: 80.8% Recall@10 hybrid vs 13.9% dense
    vs 11.9% BM25. 5.8x multiplicative gain.

  • BEIR Benchmark Leaderboard 2025 and 2026.
    NDCG@10 Scores. Ailog RAG. April 2026.
    Hybrid provides 2-5% gains over dense-only.
    BM25 nDCG@10 43.4 improved to 52.6 via hybrid reranking.

  • Hybrid Search in Production: Why BM25 Still Wins
    on the Queries That Matter. TianPan.co. April 2026.
    Wands dataset: tuned hybrid adds 7.5% NDCG.
    Dynamic alpha tuning as 2026 frontier.

  • BM25 Retrieval: Methods and Applications.
    EmergentMind. December 2025.
    Biomedical QA: 0.72 BM25 → 0.90 with reranking.
    BEIR, TREC-DL benchmark citations.

  • Dense vs Sparse Retrieval: Mastering FAISS, BM25,
    and Hybrid Search. DEV Community. December 2025.
    Recall 0.72 BM25 → 0.91 hybrid.
    Precision 0.68 → 0.87 hybrid.

  • Hybrid Search and Re-Ranking in Production RAG.
    Towards Data Science. May 2026.
    Weaviate RSF implementation. Alpha parameter.

  • Weaviate Search Mode Benchmarking. September 2025.
    Plus 5% to plus 24% improvement over hybrid search
    across BEIR and BRIGHT benchmarks.


#AI #RAG #HybridSearch #BM25 #SemanticSearch
#LLM #MachineLearning #MLOps #AIArchitecture
#InformationRetrieval #GenerativeAI #NLP

Top comments (0)