Browse AI Foundation

What Is BM25? The Classic Keyword Ranking Algorithm Still Used in AI Search

Long before embeddings, this formula was how search engines ranked keyword matches — and it's still the workhorse behind the keyword half of most hybrid search systems.

A formula for keyword relevance

BM25 is a ranking formula that scores how relevant a document is to a keyword query, based on how often the query's terms appear in the document, weighted so that rare, distinctive words count for more than common ones, and adjusted so extremely long documents don't get an unfair advantage just from length.

Why it's survived the shift to embeddings

Despite predating modern embeddings by decades, BM25 remains fast, cheap to compute, and highly reliable for exact-term matching — exactly the case where semantic search can actually underperform. That combination is why it hasn't been fully retired.

Its role in modern retrieval systems

BM25 is typically the "keyword" half of a hybrid search system today, running alongside semantic search rather than instead of it — each covering the specific cases where the other tends to fall short.

Frequently Asked Questions

What is BM25?

A classic ranking formula that scores document relevance to a keyword query, weighting rare distinctive terms more heavily than common ones — still widely used as the keyword-matching half of modern hybrid search systems.

Is BM25 still relevant now that embeddings exist?

Yes — it remains fast, cheap, and highly reliable for exact-term matching, which is precisely where semantic search can underperform, so it's still commonly paired with embeddings in hybrid search.

Keep Exploring