> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.platelunchcollective.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BM25

> BM25 is a ranking function that scores how well a document matches a query using term frequency and how rare each term is across the collection.

*Core concept* · *AI Search Infrastructure*

## Definition

BM25 is a ranking function that scores how well a document matches a search query based on term frequency and how rare each term is across the collection. It is a refinement of TF-IDF and remains a strong baseline for lexical, keyword-based retrieval. Most sparse retrieval systems still use it or a close variant.

## Why It Matters for AI Search

BM25 is the workhorse behind the keyword half of modern hybrid retrieval. It rewards documents that use a query's exact terms, weighted so that rare, specific words count more than common ones. For content, precise terminology matters: the exact name, model number, or phrase a buyer uses is what a BM25 method matches, where a semantic method might paraphrase it away. A page that never states the specific term can lose the lexical path entirely.

## Related Terms

<CardGroup cols={2}>
  <Card title="TF-IDF" href="/ai-search-glossary/tf-idf">See also</Card>
  <Card title="Sparse retrieval" href="/ai-search-glossary/sparse-retrieval">See also</Card>
  <Card title="Keyword search" href="/ai-search-glossary/keyword-search">See also</Card>
  <Card title="Hybrid retrieval" href="/ai-search-glossary/hybrid-retrieval">See also</Card>
  <Card title="Semantic search" href="/ai-search-glossary/semantic-search">See also</Card>
</CardGroup>

## Relevant Plate Lunch Collective Services

[AI SEO](https://www.platelunchcollective.com/services/ai-seo)  [Citation-Ready Content](https://www.platelunchcollective.com/services/citation-ready-content)
