BM25

BM25 is a classic ranking function for sparse retrieval over bag-of-words indexes. It saturates term frequency, down-weights very common terms (IDF), and length-normalizes documents—usually beating plain TF-IDF in practice.

Why it matters

  • Strong lexical baseline: exact keywords, IDs, rare proper nouns
  • Cheap and explainable compared with embedding search
  • Default first-stage retriever in many search stacks

Relation to dense retrieval

Dense retrieval catches paraphrases BM25 misses; BM25 catches literal matches embeddings blur. Hybrid search (BM25 + vectors, then fuse/rerank) is often the pragmatic RAG default. Tune $k_1$ and $b$ lightly; bigger wins usually come from better analyzers, fields, and chunking—not exotic BM25 variants.

← Back to AI Glossary