Malhar Ujawane

Blog

Explainer·(updated October 31, 2026)

What is reciprocal rank fusion? RRF for hybrid search

Reciprocal rank fusion (RRF) merges ranked lists by summing 1/(k + rank) for each document. Why k = 60, why it beats adding scores, with runnable Python.

What is reciprocal rank fusion? RRF for hybrid search

Reciprocal rank fusion (RRF) is a way to merge several ranked result lists into one: each document gets 1 / (k + rank) from every list it appears in, the contributions are summed, and documents are sorted by that total. It uses only positions, never raw scores, so it can combine a BM25 list and a vector search list whose scores live on completely different scales. The constant k is usually 60.

RRF comes from a two-page SIGIR 2009 paper by Gordon Cormack, Charles Clarke (University of Waterloo) and Stefan Büttcher (Google): Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods. It is now the default fusion step in hybrid search, including the rrf retriever in Elasticsearch.

How does reciprocal rank fusion work?

Given a set of documents D and a set of rankings R, the paper defines:

RRFscore(d) = sum over rankings r in R of  1 / (k + r(d))

r(d) is the 1-based position of document d in ranking r. A document missing from a list gets nothing from that list. Sort by the sum and you have the fused ranking.

That’s all of it. No training, no score normalization, no weights to tune. The authors say they came up with RRF “to serve as a baseline” while looking for an unsupervised fusion method, then found it “almost invariably improved on the best of the combined results”.

Why is k = 60?

The paper says k = 60 “was fixed during a pilot investigation and not altered during subsequent validation”. Their pilot table, combining 30 configurations of the Wumpus search engine on TREC data, shows MAP rising from 0.2072 at k = 0 to about 0.214 for k between 50 and 90, and they conclude k = 60 “was near-optimal, but that the choice was not critical”.

What k does is set how much more rank 1 is worth than rank 10. The authors chose the reciprocal form because “while highly-ranked documents are more important, the importance of lower-ranked documents does not vanish”, and they say the constant “mitigates the impact of high rankings by outlier systems”. A small k makes the fused list follow whichever system ranked a document first; a large k flattens the curve until only the number of lists a document appears in matters.

Elasticsearch exposes it as rank_constant, default 60, alongside rank_window_size, which caps how many results from each child retriever take part.

What does RRF look like in code?

This script fuses a BM25 list and a vector list for one query. The scores are made up, but they have the real shapes: BM25 is unbounded and spread out, cosine similarity sits in a narrow band below 1. It compares RRF against the naive approach of adding raw scores.

# rrf.py: reciprocal rank fusion vs naive score addition. Python 3 stdlib only.
# Two result lists for one query, as (doc_id, raw_score). The scores are made up
# but have the real shapes: BM25 is unbounded, cosine similarity sits in a narrow band.
bm25 = [("faq-refunds", 14.2), ("err-4012", 11.8), ("policy-2019", 9.1), ("blog-sale", 3.0)]
vector = [("refund-howto", 0.83), ("faq-refunds", 0.81), ("returns", 0.79), ("err-4012", 0.62)]

def rrf(*rankings, k=60):
    scores = {}
    for ranking in rankings:
        for rank, (doc, _) in enumerate(ranking, start=1):
            scores[doc] = scores.get(doc, 0.0) + 1.0 / (k + rank)
    return sorted(scores.items(), key=lambda x: x[1], reverse=True)

def raw_sum(*rankings):
    scores = {}
    for ranking in rankings:
        for doc, s in ranking:
            scores[doc] = scores.get(doc, 0.0) + s
    return sorted(scores.items(), key=lambda x: x[1], reverse=True)

def show(name, fused):
    print(f"{name:<14}" + "  ".join(f"{d}({s:.4f})" for d, s in fused))

show("raw sum", raw_sum(bm25, vector))
show("RRF k=60", rrf(bm25, vector))
show("RRF k=1", rrf(bm25, vector, k=1))
print()
print("weight of rank 1 vs rank 10:")
for k in (1, 10, 60, 1000):
    print(f"  k={k:<5} 1/(k+1)={1/(k+1):.4f}  1/(k+10)={1/(k+10):.4f}  ratio={(k+10)/(k+1):.2f}x")

Output (Python 3.14.5):

raw sum       faq-refunds(15.0100)  err-4012(12.4200)  policy-2019(9.1000)  blog-sale(3.0000)  refund-howto(0.8300)  returns(0.7900)
RRF k=60      faq-refunds(0.0325)  err-4012(0.0318)  refund-howto(0.0164)  policy-2019(0.0159)  returns(0.0159)  blog-sale(0.0156)
RRF k=1       faq-refunds(0.8333)  err-4012(0.5333)  refund-howto(0.5000)  policy-2019(0.2500)  returns(0.2500)  blog-sale(0.2000)
weight of rank 1 vs rank 10:
  k=1     1/(k+1)=0.5000  1/(k+10)=0.0909  ratio=5.50x
  k=10    1/(k+1)=0.0909  1/(k+10)=0.0500  ratio=1.82x
  k=60    1/(k+1)=0.0164  1/(k+10)=0.0143  ratio=1.15x
  k=1000  1/(k+1)=0.0010  1/(k+10)=0.0010  ratio=1.01x

Raw sums are broken. refund-howto is the vector retriever’s best hit, and adding raw scores puts it fifth, behind blog-sale, which BM25 ranked last. BM25’s numbers are simply bigger, so the vector side barely counts. This is the most common bug I’d look for in a homemade hybrid search.

RRF rewards agreement. faq-refunds and err-4012 appear in both lists, so they collect two contributions and lead. Then come the single-list documents, ordered by their best rank: the vector top hit refund-howto is third.

k sets the tie-breaking. At k = 60, rank 1 is worth only 1.15 times rank 10, so appearing in two lists beats being first in one. At k = 1, rank 1 is worth 5.5 times rank 10 and the fused list leans on whichever retriever put a document first.

RRF vs score normalization: which should I use?

The alternative to RRF is to normalize each list’s scores to a common range and take a weighted sum. Weaviate offers both: rankedFusion (rank-based, like RRF) and relativeScoreFusion, which rescales each list so the top score is 1 and the bottom is 0 before combining. According to the Weaviate hybrid search docs, relativeScoreFusion became the default in v1.24, with rankedFusion the default through v1.23, and the alpha parameter weights vector against keyword (default 0.75).

Score fusion keeps more information: a document that is far ahead in one list stays far ahead. It also inherits the problems of the scores. Min-max scaling is sensitive to outliers and to how many results you fetched. RRF throws that information away and gets stability in return. Without a labeled query set to tune weights against, I’d pick RRF. With one, try both and measure.

Where is RRF used?

Anywhere you have more than one ranked list for the same query:

  • Hybrid search, combining BM25 and dense vectors. This is the main use in RAG; see hybrid RAG.
  • Multi-query retrieval, where an LLM rewrites one question into several and you search with each. Fusing the lists rewards documents that several rewrites agree on. HyDE and query rewriting covers the rewriting side.
  • Multiple embedding models or indexes, for example one per language or one per field.
  • Meta-search, the setting the 2009 paper tested: fusing the submissions of different TREC systems.

The paper’s evidence is worth knowing. Across pilot runs and TREC submissions, RRF beat Condorcet Fuse, CombMNZ and the best individual system “by 4% to 5% on average”, and beat Condorcet in all 7 sign-tested comparisons. It also beat every previously reported method on the LETOR 3 learning-to-rank benchmark when used as a meta-learner.

Where does RRF break?

  • It ignores confidence. A BM25 hit with a huge margin and a barely-there one at the same rank count the same. If one retriever is much better for your data, RRF dilutes it. Weighted RRF (multiplying each list’s contribution) is a common patch.
  • Garbage lists still vote. Every list adds to the sum. A noisy retriever’s top results get the same weight as a good retriever’s, which is why I keep the number of fused lists small.
  • Window size changes results. Fusing the top 10 from each list and fusing the top 100 give different rankings, because more documents pick up second contributions. Fix the window (rank_window_size in Elasticsearch) and keep it consistent between evaluation and production.
  • It isn’t a reranker. RRF only reorders what the retrievers returned, using positions. A cross-encoder reranker reads the query and each document together and is the step that fixes precision.

What I would do

For a RAG pipeline: retrieve 20 to 50 candidates each from BM25 and a vector index, fuse with RRF at k = 60, then rerank the fused top 50 or so down to the handful that go into the prompt. That’s close to what Anthropic describes in its contextual retrieval post, which combines BM25 and embedding results “using rank fusion techniques” and reranks the top 150 down to 20.

I wouldn’t tune k first. The paper found it “not critical”, and the window size and the choice of retrievers move results far more. Spend the effort on a small judged query set so you can tell whether fusion helped at all.

FAQ

What is the formula for reciprocal rank fusion?

RRFscore(d) = sum over each ranking of 1 / (k + rank of d), with ranks starting at 1, documents absent from a list contributing nothing, and k usually 60.

Why does RRF use k = 60?

Cormack, Clarke and Büttcher fixed it at 60 after a pilot study in 2009, found it near-optimal and noted that the exact value was not critical. It keeps rank 1 from dominating while still favoring higher ranks.

Does RRF need score normalization?

No. It uses only ranks, which is the point. That makes it safe for combining BM25 scores with cosine similarities.

Is RRF better than a weighted score sum?

It is more stable and needs no tuning. A tuned weighted sum of normalized scores can beat it on a specific dataset, so measure on your own queries if you have labels.

Sources

Get new posts in your inbox

© 2026 Malhar Ujawane. Built with Astro.