← All questions
Retrieval & EmbeddingsMedium· BM25· TF-IDF· Information Retrieval

What does BM25 fix relative to TF-IDF?

TF-IDF suffers from two primary defects that BM25 resolves. First, in TF-IDF, term frequency enters the calculation linearly, meaning the eleventh occurrence of a term is weighted as heavily as the first. BM25 introduces saturation to handle this. Second, standard cosine normalization in TF-IDF fails to distinguish between a genuinely long document and one that is simply repetitive. BM25 uses pivoted length normalization to correct this, providing a more robust ranking mechanism.

Code playground (Python)