For the complete documentation index, see llms.txt. Every page on this site is also served as Markdown: append `.md` to any URL, or send `Accept: text/markdown`.
Skip to content

Glossary term

BM25

BM25 (Best Matching 25) is a ranking function that scores how well a document matches a search by its exact words: how often each query term appears, how rare the term is across all documents, and how long the document is. AI retrieval pairs it with embeddings because it catches exact names and codes.

7 days free · card required

Same subject, one exact string: who gets linked
  • what is GPTBot

    Answers
    66
    attensira.com linked
    12
    Top ChatGPT source by influence (citations)
    developers.openai.com (39 of 798)
  • list of AI crawler user agents

    Answers
    60
    attensira.com linked
    0
    Top ChatGPT source by influence (citations)
    github.com (42 of 643)
Analyst agentAnalyst · reads this workspace's answersattensira.com workspace, read over the Attensira MCP · · n=126 ChatGPT and Perplexity answers, 30 days
Karl-Gustav KallasmaaKarl-Gustav Kallasmaa, Founder & CEO

Last updated

Key facts

Where do exact words still win?

On questions built around one exact identifier. The table above holds two questions we track for attensira.com, about the same subject, read over the Attensira MCP for the 30 days to 4 October 2026. We have a page about GPTBot whose title and first sentence contain the exact string "GPTBot". The first question names that string; the second describes the same territory in general words. Our page was linked in 12 of 66 answers to the first and in none of 60 to the second.

The sources follow the same line. For "what is GPTBot", the most influential source in ChatGPT's answers was developers.openai.com, OpenAI's own page about the crawler, whose name is the query. For the generic question it was github.com, in a long tail where no site held more than 10% of the citations.

We do not know how ChatGPT retrieves pages, and two questions prove nothing on their own. But the pattern is the one BM25 exists to produce: a question built around one exact identifier rewards the pages that contain it literally. A generic question rewards whichever pages are most broadly relevant, and there are hundreds of those.

What is BM25?

BM25, short for Best Matching 25, is a ranking function for keyword search. Given a query, it scores each document from three ingredients:

  1. Term frequency. How often each query word appears in the document, with diminishing returns. The second occurrence adds less than the first, and the twentieth adds almost nothing.
  2. Inverse document frequency. How rare the word is across the whole collection. A match on "GPTBot" counts for far more than a match on "the" or "crawler".
  3. Document length. A match in a short document counts for more than the same match buried in a very long one.

It is a refinement of TF-IDF, developed in information-retrieval research in the 1990s, and is still the default keyword scorer in widely used search libraries. Anthropic's contextual retrieval write-up describes it simply: a ranking function that uses lexical matching to find precise word or phrase matches, especially effective for unique identifiers and technical terms.

Why do AI systems still use BM25?

Because embeddings are good at meaning and bad at exactness. Anthropic's example is a search for "Error code TS-999". An embedding model may return pages about error codes in general and miss the one page containing that code. BM25 finds it.

So many retrieval pipelines run both and merge the results:

  • BM25 finds the top chunks by exact match;
  • vector search finds the top chunks by meaning;
  • the two lists are combined and deduplicated, often with rank fusion, and a reranking step may reorder them before the model reads them.

Anthropic measured the effect on its benchmarks. With context added to each chunk, embeddings alone cut the top-20 retrieval failure rate from 5.7% to 3.7%. Adding BM25 cut it to 2.9%. Adding a reranker cut it to 1.9%.

Configuration (Anthropic's tests)Top-20 retrieval failure rate
Baseline embeddings5.7%
Contextual embeddings3.7%
Contextual embeddings plus contextual BM252.9%
The above plus reranking1.9%

What does BM25 mean for how you write pages?

Exact strings are findable; paraphrases are not. If a buyer will search for a product name, a model number, an error code, a plan name or a standard, that string must appear on your page as plain text, ideally in the heading and the first sentence of the passage that answers it.

  • Write "GPTBot", not only "OpenAI's training crawler".
  • Write the version number, not only "the latest release".
  • Keep names consistent. A product called three different things on three pages splits its matches three ways.
  • Put the identifier near the answer, because retrieval works on chunks, and a chunk without the word cannot match it.

Does the exact string win on every engine?

No. All 12 links to our GPTBot page came from ChatGPT: 12 of its 33 answers. Perplexity linked us in none of its 33, though its most influential source was the same exact-match page ChatGPT leaned on, OpenAI's own GPTBot documentation. Containing the string gets a page into the race; it does not decide it.

ChatGPT answers linking attensira.com
12/33
n=33 answers
Perplexity answers linking attensira.com
0/33
n=33 answers
Perplexity citations to developers.openai.com
25/321
its most influential source, n=321 citations
attensira.com workspace, read over the Attensira MCP on 2026-10-04 · n=66 answers to this question, 30 days · to

What are the objections to writing for BM25?

"Keyword matching is old SEO." Keyword stuffing is old SEO, and BM25's saturation curve is one reason it stopped working. Using the exact name of the thing you are explaining is just precision.

"AI understands synonyms now." Meaning-based retrieval does. That is why hybrid systems keep a lexical half for the cases where meaning is not enough.

"So we should repeat our keyword everywhere." The second mention adds less than the first. Once, in the right sentence, does most of the work.

How does Attensira use this?

Attensira tracks the exact phrasings your buyers use, including names, codes and product terms, and reads which pages each engine cites for each phrasing. When a precise question goes to a competitor's page, the crew checks whether your page states the exact term where the answer lives, fixes it, and ships the change after your approval. The free audit lets you phrase its eight questions with your own exact terms and shows, per engine, whether each answer named you.

Questions about BM25

What is BM25?
BM25 is a ranking function used in keyword search. It scores a document for a query by how often the query's words appear in it, how rare those words are across the collection, and how long the document is, with diminishing returns for repeating a word.
What does BM25 stand for?
Best Matching 25. Anthropic describes it as a ranking function that uses lexical matching to find precise word or phrase matches, and notes it is particularly effective for queries containing unique identifiers or technical terms.
How does BM25 relate to TF-IDF?
It builds on it. TF-IDF weighs a word by how often it appears in a document and how rare it is in the collection. BM25 adds a correction for document length and a saturation curve, so a word repeated twenty times does not count twenty times as much as once.
Why not just use embeddings?
Because meaning-based vectors can miss exact matches. Anthropic's example is a search for 'Error code TS-999': an embedding model may find pages about error codes in general and miss the one with that exact string, which BM25 finds. Hybrid systems run both.
Is hybrid retrieval actually better?
In Anthropic's published experiments, yes. Adding contextual BM25 to contextual embeddings cut the top-20 retrieval failure rate from 5.7% to 2.9%, against 3.7% for contextual embeddings alone, a 49% reduction from the baseline.

Where do these facts come from?

2 sources, 4 statements: each statement with the page it came from and the day it was checked.

  1. Anthropic reports that combining contextual embeddings with contextual BM25 reduced the top-20-chunk retrieval failure rate by 49%, from 5.7% to 2.9%, compared with a 35% reduction from contextual embeddings alone.

    anthropic.com · retrieved

  2. Anthropic reports that contextual embeddings alone reduced the top-20-chunk retrieval failure rate by 35%, from 5.7% to 3.7%, and that adding a reranking step to contextual embeddings plus contextual BM25 reduced it by 67%, from 5.7% to 1.9%.

    anthropic.com · retrieved

  3. In the attensira.com workspace, read over the Attensira MCP on 4 October 2026, in the 30 days to 4 October 2026 attensira.com was linked in 12 of 66 ChatGPT and Perplexity answers to 'what is GPTBot' (12 of 33 on ChatGPT, 0 of 33 on Perplexity) and in 0 of 60 answers to 'list of AI crawler user agents'.

    attensira.com · retrieved

  4. In the attensira.com workspace, read over the Attensira MCP on 4 October 2026, the most influential ChatGPT source (ranked by citation share and position, not by count) in the 30 days to 4 October 2026 was developers.openai.com (39 of 798 citations) for 'what is GPTBot' and github.com (42 of 643) for 'list of AI crawler user agents', where no domain held more than 10% of the 643 citations; on Perplexity, developers.openai.com was the most influential source for 'what is GPTBot', with 25 of 321 citations.

    attensira.com · retrieved

Want whatever it takes to win the answer?

7 days free · card required