Pure dense retrieval misses your acronyms, model numbers, and SKU codes. Pure BM25 misses every paraphrase your users actually type. Every production RAG system in 2026 — Perplexity, Glean, Anthropic's Contextual Retrieval — runs hybrid: BM25 + dense + RRF fusion + MMR diversity. Bi-encoders pick a wide pool; rerankers tighten it. That stack lifts recall@10 by 10–30 points on BEIR. Here's the math, the knobs, and the production defaults.
Learning Objectives
After this lesson, you will be able to:
Compare dense (cosine on embeddings) vs sparse (BM25/TF-IDF) retrieval, and explain why hybrid search beats either alone in production
Use Reciprocal Rank Fusion (RRF) to combine results from multiple retrievers without scoring-scale headaches
Apply Maximal Marginal Relevance (MMR) to balance relevance with diversity — preventing all top-k results from being near-duplicates
Pick the right retrieval algorithm for your task — semantic similarity, keyword precision, multi-vector retrieval, or hybrid
Try it: Hybrid search side-by-side (BM25 vs Dense vs Fusion)Interactive
Open the /play/hybrid-search playground to watch BM25, dense embeddings, and RRF-fused results re-rank live as you change the query. Try "GPT-4 model" (BM25 wins on the exact identifier) then "OpenAI's flagship LLM" (dense wins on the paraphrase). Fusion is the one that wins both.
Your Reflection
Saves automatically
What’s one thing you learned? What’s still confusing?
BM25 (Robertson & Sparck Jones 1976, refined 1994) is a probabilistic ranking function. Despite being 50 years old, it's still the strongest sparse retriever and a staple of every production search system.
Why BM25 still wins: exact identifier match, robust to OOD terms, no embedding model required, ~1000x faster than dense for very large corpora when used with inverted indices.
#Reciprocal Rank Fusion (RRF): The Default Combiner
The challenge of combining dense + sparse: their scores are on different scales (cosine ∈ [-1, 1] vs BM25 ∈ [0, ∞)). RRF (Cormack 2009) sidesteps this by combining ranks, not scores:
RRF(d)=r∈R∑k+rankr(d)1(typically k=60)
Production stacks (Pinecone hybrid search, Weaviate, Vespa) implement RRF natively.
Change the query below and watch BM25, dense, and RRF-fused rankings shift side by side.
A subtle bug in pure top-k retrieval: results often duplicate each other. If your corpus has three near-identical paraphrases of the same fact, top-3 returns all three — wasting context window and starving the LLM of variety.
Before the decision rubric, let's get hands-on with BM25's parameters. Knowing how k1 and b actually behave will save you a lot of time tuning production retrieval.
Quick check
A BM25 retriever indexes a corpus where document lengths vary from 50 tokens (FAQ entries) to 5000 tokens (full articles). Long articles dominate the rankings even when shorter docs are more relevant. Which parameter should you tune?
Your RAG system retrieves documents about a specific machine learning model with version numbers (GPT-4o-2024-11-20). Dense retrieval misses some queries that include exact version numbers. Best fix?
The answer: hybrid retrieval with RRF. Dense embeddings often fail on rare exact tokens (version numbers, product IDs, unusual acronyms). BM25 handles these natively. Fusion gives you both worlds.
The whole hybrid retrieval story is one equation per piece — BM25 for sparse, cosine for dense, RRF for fusion, MMR for diversity. The playground below implements all four end-to-end on a small corpus so you can sweep parameters and watch what happens.
Tests · Verify BM25 returns docs containing 'OpenAI flagship'; verify hybrid (RRF) merges results from both retrievers; verify MMR top-4 includes more diverse docs than pure dense top-4.