BM25

BM25 is the standard keyword ranking function that scores a document by how often the query's terms appear in it, discounted by how common those terms are across the corpus and by document length.

Also known as: Okapi BM25

It refines the older TF-IDF idea with two calibrations that matter in practice: term-frequency saturation, so the tenth occurrence of a word adds far less than the second, and length normalisation, so a long document does not out-rank a short one merely by containing more words.

BM25 remains a strong baseline decades after its introduction, and it is still the keyword half of most hybrid systems. Teams that replace it wholesale with vector search often find precision on exact identifiers gets worse before anything else gets better.