Algorithm Search⌘K

Modeladvanced

BM25F

Also called field-weighted BM25.

Extends BM25 to documents with fields by combining weighted, field-normalized term frequencies before the saturation step.

BM25F is the form of BM25 for documents with fields, such as a title, a body and the anchor text of links to the page. For each query term it adds the term frequencies of the fields, each one multiplied by a field weight and divided by a length factor of its own field, and it applies the saturation of BM25 once to that sum. Robertson, Zaragoza and Taylor (2004) proposed it because adding the BM25 scores of the separate fields lets one term count several times at nearly full strength, which undoes the saturation. With one field of weight 1, BM25F is exactly BM25.

The machine

Fields. A document dd has fields f=1,…,Ff = 1, \ldots, F, each a list of tokens. For field ff let lf(d)l_f(d) be its length, avglf\mathrm{avgl}_f the average of lfl_f over the collection and tff(t,d)\mathrm{tf}_f(t, d) the number of occurrences of tt in that field. Each field has a weight wf≥0w_f \ge 0 and a slope bf∈[0,1]b_f \in [0, 1].

Score. The length factor of a field and the weighted pseudo-frequency of a term are

Bf(d)=1−bf+bf lf(d)avglf,tf~(t,d)=∑f=1Fwf tff(t,d)Bf(d),B_f(d) = 1 - b_f + b_f \, \frac{l_f(d)}{\mathrm{avgl}_f}, \qquad \widetilde{\mathrm{tf}}(t, d) = \sum_{f=1}^{F} w_f \, \frac{\mathrm{tf}_f(t, d)}{B_f(d)},

and the score, with natural logs, is

s(q,d)=∑t∈qIDF(t)⋅tf~(t,d) (k1+1)tf~(t,d)+k1.s(q, d) = \sum_{t \in q} \mathrm{IDF}(t) \cdot \frac{\widetilde{\mathrm{tf}}(t, d) \, (k_1 + 1)}{\widetilde{\mathrm{tf}}(t, d) + k_1}.

The idf is computed on whole documents: df(t)\mathrm{df}(t) counts the documents that contain tt in any field. Robertson and Zaragoza (2009) write the formula without the factor k1+1k_1 + 1. This page keeps it, as on the BM25 page. It multiplies every score by one constant and does not change the ranking.

One field. With F=1F = 1 and w1=1w_1 = 1, tf~=tf/B\widetilde{\mathrm{tf}} = \mathrm{tf}/B and

(tf/B)(k1+1)tf/B+k1=tf (k1+1)tf+k1B,\frac{(\mathrm{tf}/B)(k_1 + 1)}{\mathrm{tf}/B + k_1} = \frac{\mathrm{tf} \, (k_1 + 1)}{\mathrm{tf} + k_1 B},

which is the tf part of BM25. So BM25F moves the length normalization of BM25 inside each field and keeps one saturation.

Why combine before the saturation. In the two-Poisson view, a document is elite for a term or not, and every field is evidence about that one hidden event. A word in the title and the same word in the body are two observations of the same eliteness, so their counts should add before they pass through the saturating curve. With bf=0b_f = 0 for every field and integer weights, tf~\widetilde{\mathrm{tf}} is the term frequency of the document in which field ff is written out wfw_f times, so a title weight of 2 means "read the title twice".

Example. Split each document of the toy collection of the information retrieval pages into a title, its first three tokens, and a body, the rest. Every title has 3 tokens, so avgltitle=3\mathrm{avgl}_{\mathrm{title}} = 3 and Btitle=1B_{\mathrm{title}} = 1. The body of d1d_1 has 6 tokens and every other body has 7, so avglbody=6.875\mathrm{avgl}_{\mathrm{body}} = 6.875. Take wtitle=2w_{\mathrm{title}} = 2, wbody=1w_{\mathrm{body}} = 1, bf=0.75b_f = 0.75 for both fields, k1=1.2k_1 = 1.2, and the Lucene idf of the whole documents: 0.6931 for "sorted", 0.9445 for "array" and 1.2809 for "search".

  • d8d_8 = "the sorted array" + "of ids is compressed with gap encoding". Both "sorted" and "array" are in the title, so tf~=2⋅1/1=2\widetilde{\mathrm{tf}} = 2 \cdot 1/1 = 2 for each, with tf part 2⋅2.2/3.2=1.3752 \cdot 2.2/3.2 = 1.375. The score is (0.6931+0.9445)⋅1.375=2.2517(0.6931 + 0.9445) \cdot 1.375 = 2.2517.
  • d1d_1 = "binary search finds" + "a key in a sorted array". "Search" is in the title, with tf~=2\widetilde{\mathrm{tf}} = 2. "Sorted" and "array" are in the body, where Bbody=0.25+0.75⋅6/6.875=0.9045B_{\mathrm{body}} = 0.25 + 0.75 \cdot 6/6.875 = 0.9045, so tf~=1.1055\widetilde{\mathrm{tf}} = 1.1055 and the tf part is 1.1055⋅2.2/2.3055=1.05491.1055 \cdot 2.2/2.3055 = 1.0549. The score is 1.2809⋅1.375+(0.6931+0.9445)⋅1.0549=3.48881.2809 \cdot 1.375 + (0.6931 + 0.9445) \cdot 1.0549 = 3.4888.

On q1 = "sorted array search":

rank document BM25F BM25 on whole documents sum of field scores
1 d1d_1 3.4888 3.0283 4.2894
2 d8d_8 2.2517 1.6292 3.2752
3 d2d_2 1.8857 1.8893 1.8857
4 d7d_7 1.7613 1.2743 2.5619
5 d4d_4 0.6880 0.6896 0.6880

The rank column is for BM25F. Document d8d_8 moves above d2d_2, because its query terms are in its title, while those of d2d_2 are in its body. The last column adds wfw_f times a BM25 score computed on each field alone. It ranks d7d_7, whose only query term is "search" in the title, above d2d_2. In the field sum, one title occurrence of "search" adds 2⋅1.2809⋅1=2.56192 \cdot 1.2809 \cdot 1 = 2.5619, twice the full weight of a single occurrence. In BM25F it adds 1.2809⋅1.375=1.76131.2809 \cdot 1.375 = 1.7613, still below the bound 1.2809⋅2.21.2809 \cdot 2.2. On q2 = "posting list merge" BM25F gives d4d_4 3.3089, d3d_3 and d5d_5 2.2090 (in id order) and d2d_2 1.7613, while the field sum puts d2d_2 (2.5619) above d3d_3 and d5d_5 (2.2090) only because "merge" is in its title.

What it counts

  • Parameters. k1k_1, and a weight wfw_f and a slope bfb_f for each field: 2F+12F + 1 numbers, tuned on judged queries. Short fields such as titles vary little in length and often get a different bfb_f from the body.
  • Statistics. NN and df(t)\mathrm{df}(t) over whole documents, lf(d)l_f(d) for each document and field, and avglf\mathrm{avgl}_f for each field.
  • Index. Either one posting list for each term and field, merged at query time, or one list for each term whose postings hold a frequency for each field. Scoring costs O(∑t∈qdf(t))O(\sum_{t \in q} \mathrm{df}(t)) postings, as for BM25.
  • Bound. The contribution of a term is below IDF(t)(k1+1)\mathrm{IDF}(t)(k_1 + 1) whatever the fields hold, the same bound as in BM25, so the pruning methods of BM25 such as WAND apply.

Relation to other models

  • BM25. BM25F with one field of weight 1 is BM25. With several fields and wf=1w_f = 1, bf=bb_f = b, it differs from BM25 on the whole document only in that each field is normalized by its own average length.
  • Pivoted length normalization. Each BfB_f is a pivoted normalization of one field, with pivot avglf\mathrm{avgl}_f and slope bfb_f.
  • Linear combination of field scores. Adding wfw_f times the BM25 score of each field is the obvious alternative. Each field then has its own saturation, so a term in FF fields can add up to ∑fwf\sum_f w_f times the bound of one field. Robertson, Zaragoza and Taylor (2004) show that this rewards a term spread over fields too much compared with a term repeated in one field.
  • Anchor text. The text of links that point to a page is a field of the page in web search, and BM25F is a usual way to weight it against the title and the body; see anchor text indexing.
  • Learning to rank. BM25F scores, and the scores of single fields, are standard features of learning to rank. The field weights can also be learned directly from judgments.

Known results in the model

  • Saturation is kept. For any fields, weights and lengths, the contribution of a term is an increasing function of tf~\widetilde{\mathrm{tf}} with the limit IDF(t)(k1+1)\mathrm{IDF}(t)(k_1 + 1). The field sum has no such single bound.
  • Weights as repetition. With all bf=0b_f = 0 and integer weights, BM25F equals BM25 with b=0b = 0 on the document with each field repeated wfw_f times (Robertson, Zaragoza and Taylor 2004).
  • One idf for each term. The idf is a property of the term in the whole collection, not of a field, because eliteness belongs to the document. A field sum often uses the idf of each field, which is one more way in which it differs from BM25F.
  • Use. Search engines that index fields, such as Lucene and the engines built on it, offer queries over several fields that combine the field frequencies before the saturation in this way.

References

  1. Stephen Robertson, Hugo Zaragoza and Michael Taylor, Simple BM25 extension to multiple weighted fields, Proceedings of CIKM 2004, 42 to 49, why a linear combination of the BM25 scores of the fields breaks the saturation of term frequency, and the combination of weighted field frequencies before the saturation
  2. Stephen Robertson and Hugo Zaragoza, The probabilistic relevance framework, BM25 and beyond, Foundations and Trends in Information Retrieval 3(4), 333 to 389, 2009, the BM25F formula with per-field weights and per-field length normalization, and eliteness as a property of the whole document
  3. Stefan Buettcher, Charles L. A. Clarke and Gordon V. Cormack, Information Retrieval, Implementing and Evaluating Search Engines, MIT Press, 2010, Chapter 8 (probabilistic retrieval, BM25 and its extension to fields)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/E7EQCD/text.yaml