BM25 Explained: The Keyword Ranking Formula Still Powering Modern Search

BM25, short for Best Matching 25, is a decades-old document ranking formula that scores how relevant a document is to a search query based on keyword matching. It weighs three core factors: how often a search term appears in a document, how rare that term is across all documents, and the length of the document relative to the collection average. Unlike simple word-count approaches, BM25 applies diminishing returns to repeated terms and penalises longer documents to prevent them from gaining an unfair advantage. The algorithm requires no machine learning model or GPU, making it fast and efficient on standard hardware. Despite the rise of embedding-based retrieval, BM25 remains widely used for matching exact terms such as product IDs, error codes, and technical phrases, and is frequently combined with dense retrieval in hybrid search systems.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in