New Tool Radar

AI Concepts

How to Fuse BM25 and Vector Results with Reciprocal Rank Fusion

Merge BM25 and vector ranked lists with reciprocal rank fusion, so you can combine two retrievers without normalising their scores.

Schematic illustration with three step boxes: get two ranked lists, fuse by rank only, and send the top fused results.

BM25 scores have no fixed upper limit while cosine similarity stays between -1 and 1, so averaging the two scores directly lets whichever has bigger numbers dominate. Reciprocal rank fusion ignores the raw scores and uses only positions: each document gets 1 divided by (k plus rank) from each list, with k usually 60, and documents in both lists add both contributions. It is the default fusion in Elasticsearch, OpenSearch, Qdrant, Pinecone and Azure AI Search.

Before you start

A pipeline that can return a ranked list from BM25 and a ranked list from vector search for the same query.

Get two ranked lists for one query

Ask BM25 for its top 50 and vector search for its top 50, for the same query over the same chunks. Keep the 1-based rank of each document in each list.

Do not filter either list first: a document ranked 40th by one retriever can still win the fusion if it ranks 2nd by the other.

Fuse by rank only

For each document, add 1/(60 + rank) from each list it appears in. A document ranked 1st in BM25 and 15th in vector search gets 1/61 + 1/75, about 0.0297. Sort by the total.

Keep k at 60 unless you have a reason to change it: it is the value from the original paper and the default in most databases.

Send the top fused results onward

Take the top 10 fused documents for the model, or the top 50 to 60 if a reranker runs next. Log the fused list for one query and check by eye that documents both retrievers liked sit near the top.

If the fused list looks wrong, check the inputs first: a broken BM25 index or a stale embedding poisons the fusion, not the formula.

Practice check: fictional Maple Corner query: refund code R-441

The table below is fictional practice material, worked out by hand from the stated ranks using k = 60. It is the expected result for the practice query, not a run of any search system.

Document BM25 rank Vector rank RRF score Fused rank
Refund policy page 1 15 0.0297 1
Warranty page 4 2 0.0309 1 (tie, check order)
Shipping page 2 40 0.0261 3
FAQ page 30 1 0.0274 2

The warranty page scores 0.0309 and the refund page 0.0297, so the warranty page edges ahead even though the refund page won BM25 outright. Rank the tie by the fused score, then by the BM25 rank if scores are equal.

Expected result. UNTESTED: the RRF scores in the practice table are worked out by hand from the stated ranks, not measured by running a search system. The arithmetic is 1/(60 + rank) per list: 1/61 + 1/75 = 0.0297, 1/64 + 1/62 = 0.0309, 1/62 + 1/100 = 0.0261, 1/90 + 1/61 = 0.0274. Check the sums yourself before you trust the fused order.

Limits

  • RRF fixes the merge, not the retrievers: if both lists miss the answer chunk, fusion cannot rescue it.
  • The k value of 60 is a damping constant from the original paper, not a tuned value for your corpus.

Sources

See all