Skip to content
unlob

What is BM25?

Verified 5 August 2026

The standard lexical ranking function in information retrieval, and still extremely hard to beat on queries where the words matter. It scores a document by how often the query terms appear, discounted by how common those terms are across the corpus, with a saturation curve so the tenth occurrence of a word counts for much less than the second.

Its enduring advantage is that it is exact. A document either contains the term or it does not, which makes BM25 the correct tool for identifiers, error codes and quoted phrases — precisely the queries where semantic retrieval degrades.

BM25 is the lexical half of hybrid search almost everywhere, including here.

Common questions

What is BM25?

BM25 is a ranking function that scores documents by term frequency and inverse document frequency, with saturation so repeated terms have diminishing returns.

How does BM25 work in practice?

Its enduring advantage is that it is exact. A document either contains the term or it does not, which makes BM25 the correct tool for identifiers, error codes and quoted phrases — precisely the queries where semantic retrieval degrades.

See it working

The free tier is 10,000 requests a month with no card — enough to test any of this against your own queries.