BM25 — AI Glossary

BM25 is the dominant sparse-retrieval algorithm and the default scoring function in Elasticsearch, Lucene, OpenSearch, and most Postgres full-text setups. It ranks documents against a query by combining term frequency and inverse document frequency with two tuning parameters: k1 controls how quickly term frequency saturates, and b controls length normalization — penalizing long documents that repeat a term mechanically.