Term

BM25

BM25, often "Okapi BM25" after the 1980s-90s Okapi system where it was developed, is the ranking function that quietly powers a huge amount of keyword search. Given a query, it scores each document on how often the query terms appear (term frequency), how rare those terms are across the whole collection (inverse document frequency), and how long the document is, so a long document does not win just by repeating a word. It is decades old, has almost no moving parts, and is still the baseline that newer methods have to beat.
Reviewed by 7wData

Why it matters

In the RAG era everyone reaches for vector search first, and I keep seeing teams discover that plain BM25 was the stronger half of their retriever all along. Dense embeddings are good at meaning and bad at exact terms (product codes, names, error strings); BM25 is the opposite. The honest production answer is usually hybrid: BM25 for lexical precision, embeddings for semantic recall, the two fused. Skipping BM25 because it is “old” is how you ship a retrieval system that cannot find the document a user named by its exact title.

Where you’ll encounter it

Three contexts. A retrieval or RAG-quality conversation where the fix for “the model cannot find obvious documents” turns out to be adding BM25 back, not a bigger embedding model. A search-infrastructure setting where Elasticsearch, OpenSearch, and Lucene default to BM25 under the hood. And a benchmark discussion where BM25 is the baseline a new dense retriever is measured against, and sometimes quietly loses to.


Part of the 7wData AI Glossary. Tracking how concepts like this move in the expert conversation: daily signals at ins7ghts.com.