AI Agentic Handbook
Retrieval & Search

Hybrid search

Mid levelReviewed Oct 2026In 6 interview questionsIn 5 posts

Run keyword search and meaning search side by side, then merge the two lists — each one covers what the other misses.

In plain English

Hybrid search asks two engines the same question: a keyword one (BM25), brilliant with exact words, codes and names, and a meaning one (Dense retrieval), brilliant with paraphrases. Then it merges the two result lists.

The simplest merge, Reciprocal Rank Fusion (RRF), gives each document points based on where it ranked in each list, so anything both engines liked floats to the top. It is usually the single biggest retrieval win available for the least cleverness.

Analogy

Asking both the librarian who knows the catalogue by heart and the well-read friend who knows what books are about, then starting with whatever they both suggest.

Common pitfall

Fusing two short lists quietly throws away the best part. If each leg returns only 10, a document ranked 11th by both engines — strong agreement! — is never seen at all. Retrieve 50–100 per leg, fuse, then cut: the fusion window decides your recall, not the final k.

How it actually works

Both legs retrieve independently (BM25 top 50–100, ANN top 50–100), then fuse. Reciprocal Rank Fusion scores each doc Σ 1/(k + rank) with k=60 (Cormack et al. 2009; Elasticsearch rank_constant default 60, rank_window_size default 100). RRF needs no score calibration, which is why it is the default; weighted score fusion with per-query min-max normalisation can beat it by 1–3 nDCG points once you have labels to tune α. Native support as of Oct 2026: Elasticsearch rrf retriever, OpenSearch hybrid query with a normalization search pipeline, Qdrant Query API fusion: rrf, Vespa rank profiles, Weaviate hybrid with alpha. In Postgres, run a tsvector/BM25 CTE and a pgvector CTE and fuse in SQL. Anthropic's Contextual Retrieval study reported that adding BM25 to contextual embeddings cut top-20 retrieval failures by 49%, and 67% with a reranker on top.

What I'd ship on day one

BM25 top 100 + dense top 100, RRF with k=60, cross-encoder (bge-reranker-v2-m3, 568M) on the fused top 50, 5–10 chunks to the LLM. Use the engine's native hybrid (Elasticsearch rrf retriever, OpenSearch hybrid query, Qdrant fusion: rrf) rather than fusing in application code.

Worked example

Internal wiki, 1.2M chunks. Query 'how do I rotate the PAYMENTS_API_KEY in staging'. BM25 ranks the runbook containing the exact env var at #1 but buries the general 'secret rotation' guide at #40. Dense ranks the guide #2 and the runbook #18. RRF (k=60): runbook = 1/61 + 1/78 = 0.0292; guide = 1/100 + 1/62 = 0.0261; a generic 'staging environments' page ranked #5 by dense only = 1/65 = 0.0154. Both useful docs land in the top 3; a Cross-encoder then orders them.

In the interview

State a concrete pipeline — 'BM25 top 100 plus dense top 100, RRF at k=60, cross-encoder over the fused top 50, 8 chunks to the model' — then, without being asked, say how you would know it helped: recall@50 per leg and fused, on a 300-query golden set, broken down by query class (identifier, paraphrase, multi-hop). The usual follow-up is 'why not a weighted sum?' Because the scores live on different scales; tune α only once you have labels.

BM25
  1. Rotation runbook
  2. Staging env vars
  3. PAYMENTS SDK
  4. Key mgmt policy
Dense
  1. Key mgmt policy
  2. Secret rotation guide
  3. Rotation runbook
  4. Staging envs
RRF, k=60
  1. Rotation runbook
  2. Key mgmt policy
  3. Secret rotation guide
  4. Staging env vars
Documents both legs rank highly win; each leg rescues the other's misses.

Numbers worth knowing

RRF constant
k = 60Cormack et al. 2009; Elasticsearch default rank_constant
Retrieval failures, top-20
−49% with BM25 added; −67% with rerankingAnthropic Contextual Retrieval study, 2024, vs contextual embeddings alone
Extra latency of the second leg
+5–20 mslegs run in parallel on the same cluster

How to decide

WhenDo this
No relevance labels yetUse Reciprocal Rank Fusion (RRF) k=60; it needs no tuning.
≥ 300 labelled queries and one leg is clearly strongerTry weighted Weighted score fusion with per-query min-max; keep only if it beats RRF by ≥ 1 nDCG point.
Corpus has no identifiers and queries are pure paraphraseDense-only plus reranker is acceptable — but measure the BM25 leg first; it is cheap.

Cost maths

Hybrid adds the cheaper leg: a BM25 index ~30% of text size and no per-query model cost. For 10M chunks: ~5 GB inverted index vs ~31 GB of 768-d float32 vectors. Latency cost ≈ max(leg) + fusion (< 1 ms), not the sum, if legs run in parallel. The reranker dominates: 50 pairs × ~3 ms on an L4 ≈ 150 ms.

Operating it

Time to scale up when…
  • One leg contributes < 5% of final top-10 results for a month — consider dropping or re-weighting it
  • Fused recall@50 plateaus while the reranker's top-10 precision is fine — widen rank_window_size to 200
  • Hybrid p95 > 150 ms before reranking — legs are running sequentially; parallelise
What to monitor
  • Share of final top-10 coming from each leg (or both) — alert if any leg falls below 10%
  • Recall@50 fused vs per-leg on the golden set — alert if fused < max(leg)
  • End-to-end retrieval p95 — alert above 150 ms excluding rerank

When it goes wrong

What users saw

Hybrid search on a customer-support knowledge base performed worse than dense alone after launch.

How it was caught

Offline A/B on the golden set: nDCG@10 0.58 hybrid vs 0.63 dense-only.

Root cause

The team fused with a raw weighted sum (0.5·BM25 + 0.5·cosine); BM25 scores of 8–25 swamped cosine scores of 0.2–0.9, so the result was effectively BM25-only.

Fix

Switched to RRF k=60; nDCG@10 rose to 0.69. Added a unit test asserting each leg contributes to the fused top 10 on a fixture query set.

Sources

  1. Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods — Cormack et al., 2009paper
  2. Elasticsearch reference: Reciprocal rank fusion — Elastic, 2026docs
  3. Introducing Contextual Retrieval — Anthropic, 2024blog

Check yourself

Three questions. Every option is explained once you answer.

1ConceptWhy is Reciprocal Rank Fusion the default merge for BM25 and dense legs before you have relevance labels?
2ScenarioYour hybrid stack returns the top 10 from each leg and fuses them. Recall is disappointing on queries where both engines rank the right doc around 11-15. What fixes it?
3CalculationRRF with k=60. Doc A is BM25 rank 1 and dense rank 18. Doc B is BM25 rank 40 and dense rank 2. What are the fused scores and which ranks higher?