🤖 AI Hot

BM25 Beats Dense Retrieval at Scale in New RAG Study

A
Alex Chen

Every RAG tutorial from the past two years tells you the same thing: embed your documents, store the vectors, do semantic search. Dense retrieval is better because it understands meaning, not just keywords. BM25 is a legacy baseline you compare against to prove your embeddings are working. A new scaling study from arXiv (2607.26497) says that advice might be backward — at least once your document corpus gets big enough.

The paper, titled “BM25 Wins at Scale: A Scaling Study of Retrieval-Augmented Generation Paradigms,” evaluates lexical retrieval (BM25), dense retrieval (embeddings), graph-based RAG, and agentic search across varying corpus sizes. The finding that stopped me: at large scale, plain BM25 with no vector database, no graph index, and no agentic orchestration outperforms all of them on accuracy. And it does it while using roughly one ninth of the query tokens of the agentic approach.

What the Study Actually Tested

The researchers set up a controlled experiment where they varied one thing: corpus size. They ran four retrieval paradigms against document collections ranging from small (hundreds of documents) to large (tens of thousands), measuring both retrieval accuracy and computational cost.

The four paradigms:

Lexical retrieval (BM25). Classic TF-IDF variant. No training, no embeddings, no GPUs. Just term frequency and inverse document frequency with document length normalization. It’s been around since the 1990s and most practitioners treat it as the “dumb baseline” they have to beat.

Dense retrieval (embeddings). Documents and queries are both embedded into a vector space. Retrieval is nearest-neighbor search. This is what most modern RAG systems use — OpenAI embeddings, Cohere embeddings, or open-source models like bge-large.

Graph-based RAG. Documents are indexed into a knowledge graph with entities and relationships. Retrieval traverses the graph. This is what Microsoft’s GraphRAG and similar systems do. It promises better multi-hop reasoning.

Agentic search. An LLM agent iteratively formulates queries, retrieves results, evaluates them, and reformulates. The agent can decide when to stop searching and what to retrieve next. This is the most expensive paradigm — every search round costs LLM tokens.

The results: at small corpus sizes, all four perform similarly. Dense retrieval has a slight edge for queries that require semantic understanding (synonyms, paraphrases). But as the corpus grows, BM25 pulls ahead in accuracy while the other paradigms degrade or plateau. Graph RAG hits construction walls — building the graph becomes prohibitively expensive before deployment scale. Agentic search remains accurate but its cost scales with corpus size. Dense retrieval stays efficient but its precision drops.

Why BM25 Gets Better as the Corpus Grows

This result feels counterintuitive until you think about what happens when a document pool gets large.

Dense retrieval maps every document to a point in embedding space. When you have 500 documents, each one gets its own region of the space. The nearest neighbor to your query embedding is likely relevant because documents are sparse and distinct. But at 50,000 documents, the embedding space gets crowded. Multiple documents land near your query vector. The top-5 results might all be semantically similar to your query but irrelevant to what you actually need.

For example: you search “how to configure retry policy for database connections.” Dense retrieval might return documents about “retry logic in distributed systems,” “database connection pooling best practices,” and “error handling patterns” — all semantically close but none answering your specific question about retry policy configuration. BM25, which matches on the exact terms “retry,” “policy,” “database,” and “connections,” ranks the document with all four terms at the top.

At scale, lexical precision beats semantic breadth. The larger your corpus, the more semantically-similar-but-irrelevant documents exist. BM25’s “dumb” keyword matching acts as a filter that gets more valuable as the noise floor rises.

There’s also a mathematical reason. BM25’s IDF (inverse document frequency) term gets stronger as the corpus grows. Rare terms become rarer, common terms become more precisely weighted. A term that appears in 10 out of 500 documents carries less signal than a term that appears in 10 out of 50,000 documents. BM25’s scoring naturally sharpens with scale, while dense retrieval’s nearest-neighbor logic doesn’t.

What This Means for RAG Architecture

If BM25 is the strongest retriever at scale, what should you actually build?

The paper’s answer isn’t “throw away your vector database.” The practical takeaway is more nuanced.

For small to medium corpora (under 5,000 documents), dense retrieval is still fine and sometimes better for queries requiring semantic understanding. If your users search for “how do I make this faster” and the relevant document says “performance optimization techniques,” dense retrieval catches that mapping and BM25 misses it.

For large corpora (10,000+ documents), the paper recommends BM25 as the primary retriever. You can still use embeddings for reranking — retrieve the top 100 documents with BM25, then use a cross-encoder or embedding similarity to rerank the top 20. This hybrid approach gives you BM25’s precision at scale with dense retrieval’s semantic understanding in the reranking step.

The most striking finding is about agentic search. The full agentic pipeline (LLM-driven query formulation, iterative retrieval, result evaluation) achieves the highest accuracy at all scales. But replacing the agent’s internal search with BM25 — keeping everything else the same — raises the full-scale agent from 36.9 to 69.4 while using one ninth of the query tokens. The LLM agent is spending most of its tokens compensating for a weak retriever. Give it a strong lexical retriever and it needs far fewer iterations.

The Cost Argument No One Talks About

The accuracy numbers matter, but the cost numbers matter more for anyone running RAG in production.

Dense retrieval requires running an embedding model on every document. If you have 50,000 documents and each embedding call costs $0.0001 (OpenAI’s text-embedding-3-small pricing), that’s $5 to embed your corpus. Not bad. But now re-embed everything when your chunking strategy changes. And when a new embedding model drops. And when you want to experiment with different chunk sizes. Each re-embedding is another $5 plus engineering time.

Graph RAG requires entity extraction, relationship extraction, and graph construction. For a corpus of 50,000 documents, the paper reports this as a “construction wall” — the preprocessing cost exceeds what’s practical before the system reaches deployment scale. Graph RAG is promising for curated knowledge bases but not for the “dump everything in and search” use case that most teams actually have.

BM25 requires zero preprocessing beyond tokenization. You index once with an inverted index (Elasticsearch, Lucene, or even sqlite-vec with FTS5) and you’re done. No embedding calls. No graph construction. No LLM tokens spent on retrieval decisions. The index stays valid as you add documents — BM25 doesn’t need re-indexing when your retrieval strategy changes.

For the team running RAG on a budget, this is the difference between a $50/month search pipeline and a $500/month one. If BM25 gives you 90% of the accuracy at 10% of the cost, the product decision writes itself.

When BM25 Still Fails

BM25 has known failure modes, and the paper doesn’t pretend otherwise.

Synonym and paraphrase handling. If a user asks about “car maintenance” and your documents only say “vehicle upkeep,” BM25 returns nothing. Dense retrieval catches this. The hybrid approach (BM25 retrieval + embedding reranking) addresses most of these cases.

Multilingual retrieval. BM25’s token matching breaks down when queries and documents are in different languages. Dense multilingual embeddings (like Cohere’s embed-multilingual) handle cross-lingual retrieval natively.

Long-form queries. If users paste entire paragraphs as queries, BM25’s term frequency weighting can get confused by the noise. Dense retrieval’s semantic compression handles long queries better.

Domain-specific jargon. In legal, medical, or highly technical domains, exact keyword matching can miss documents that use different but equivalent terminology. Dense retrieval trained on domain-specific data usually wins here.

These failures aren’t reasons to avoid BM25 — they’re reasons to know when to supplement it. For most enterprise knowledge bases (internal docs, support tickets, meeting notes), the vocabulary is controlled enough that BM25 works well. People within an organization tend to use the same terms for the same things. The synonym problem is more acute for public-facing search where users bring unpredictable vocabulary.

The paper’s recommendation isn’t that BM25 replaces everything. It’s that BM25 should be the default starting point for large-scale retrieval, with dense and agentic methods added where they provide measurable gains over the baseline. Right now, most teams do the opposite — they start with embeddings and add BM25 as an afterthought.

Practical Migration Path

If you’re running a RAG system and this paper has you second-guessing your architecture, here’s what a migration looks like.

Step 1: Add BM25 as a parallel retriever. Don’t rip out your vector database. Add an inverted index (Elasticsearch, Typesense, or Meilisearch) alongside it. Run both retrievers and compare results on real queries.

Step 2: Switch to hybrid with BM25-first. Use BM25 for initial retrieval (top 100), then use your existing embeddings for reranking (top 20). This is the configuration the paper found most cost-effective. You keep your vector database for reranking, so the migration is additive rather than destructive.

Step 3: Measure, don’t guess. Run A/B tests on retrieval quality with your actual user queries. The paper’s results are averaged across benchmarks — your specific domain might benefit more or less from lexical retrieval. Measure recall@k and precision@k on a representative query set.

Step 4: Consider dropping embeddings for retrieval entirely. If your corpus is large (50,000+), your queries are keyword-heavy, and your reranker handles semantic matching well enough, you might not need dense retrieval at all. This is the aggressive path and only makes sense if your measurements support it.

I’ve seen teams go through this exact progression. They start with a vector DB because every tutorial tells them to. Their corpus grows from 500 to 5,000 to 50,000 documents. Retrieval quality degrades but nobody notices because they’re not measuring it. Then someone runs a systematic eval, discovers BM25 beats their embeddings pipeline by 15 points on recall@10, and they’re faced with the choice: fix the embeddings architecture or simplify to lexical. The teams that simplify are happier six months later.

The paper is on arXiv (2607.26497) with benchmarks and methodology details. If you’re maintaining a RAG pipeline that’s grown beyond the proof-of-concept stage, it’s worth the read — if only to validate whether your retrieval choices still hold at your current scale. The research community spent five years treating BM25 as obsolete. This paper suggests it was just warming up. Sometimes the boring old algorithm is boring because it works, not because nobody tried to improve it.

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen