BM25
AI & RetrievalBest Matching 25 (keyword ranking)
Also: keyword search, lexical search
BM25 is a classic ranking function for keyword search. It scores a document by how often the query's words appear in it, adjusted so common words count for less and very long documents do not get an unfair advantage. It has been a search workhorse for decades.
On text full of exact terms (names, codes, figures, dates) BM25 often matches or beats modern embedding search, because precise words are a strong signal and embeddings can blur them. It is one half of a hybrid retrieval setup.
Related terms
Where it comes up