BM25, or Okapi BM25, is a document ranking function grounded in the probabilistic model of information retrieval and named after the Okapi retrieval system. It scores a document by combining how often each query term appears in it, how rare that term is across the collection and how long the document is. A member of the TF-IDF family, it is the default ranking method in search engines such as Apache Lucene and Elasticsearch.
In AI applications such as retrieval-augmented generation, BM25 is often paired with embedding-based semantic search in hybrid search. Because it relies on exact word matches, it does not capture synonyms or paraphrases.