Rank Fusion: Reciprocal Rank Fusion and the Geometry of Rank Aggregation
Why combining ranked lists by position beats combining them by score — and how close a cheap heuristic gets to the optimal consensus
Overview & motivation
BM25 gives us a lexical ranking: it scores a document by the exact query terms it contains, weighted by how rare and how saturated those terms are. A dense dual-encoder gives us a semantic ranking: it embeds query and document into a shared vector space and scores by cosine similarity, so a passage that paraphrases the query without sharing its words can still rank highly. Each catches what the other misses — BM25 nails the literal ticker, CUSIP, and line-item match that a paraphrase-trained embedding smears into near-synonyms; the dense leg recovers the relevant passage that shares no surface tokens with the query at all. Production hybrid retrieval runs both and must combine their rankings into one.
The obstacle is that the two scores are not commensurable. BM25 is an unbounded sum of per-term weights; cosine similarity lives in . The naive fix — add the two scores per document — lets whichever list has the wider numeric range dictate the result, so the combination depends on an accident of scale rather than on agreement between the retrievers. The method that dominates in practice sidesteps this entirely by throwing the scores away and keeping only the positions: it reads off each document’s rank in each list and fuses those. That method is Reciprocal Rank Fusion (RRF), and it is the doorway to a genuinely rich piece of mathematics — the theory of rank aggregation, where rankings are points in a metric space, the “best combination” is a median permutation, and the cheap heuristic everyone ships sits at a measurable distance from the optimum it does not even try to reach.
Before any algebra, drag the fusion constant and switch between methods to watch positions beat scores:
- 110-K · net interest margin sensitivity
- 210-K · interest-rate hedging policy
- 3Call · rate-exposure hedging
- 410-K · FX translation exposure
- 5News · central-bank rate decision
- 6Call · operations update
- 1Call · rate-exposure hedging
- 210-K · interest-rate hedging policy
- 310-K · net interest margin sensitivity
- 410-K · FX translation exposure
- 5News · central-bank rate decision
- 6Call · operations update
- 110-K · net interest margin sensitivity
- 2Call · rate-exposure hedging
- 310-K · interest-rate hedging policy
- 410-K · FX translation exposure
- 5News · central-bank rate decision
- 6Call · operations update
The corpus in the laboratory is the same finance setup we will analyze throughout: a query, interest rate exposure, run against a small mix of 10-K filing text and earnings-call passages. The lexical leg (BM25) ranks a concise, interest-heavy disclosure first; the dense leg ranks a term-dense call passage first; and each leg buries the other leg’s favorite. The fused column reconciles them. Switch the method to CombSUM and scale the lexical scores up, and watch the fused order collapse onto the lexical list — the failure RRF is built to avoid.
What we cover
- Score fusion (CombSUM/CombMNZ) and exactly why incompatible scales break it.
- Reciprocal Rank Fusion: the definition, the reciprocal-rank decay , and what the constant controls.
- RRF as a positional voting rule, and the Borda count it converges to as .
- The geometry of rankings: permutations as points, the Kendall-τ distance and Spearman footrule, and the Diaconis–Graham inequality tying them together.
- The Kemeny consensus — the median permutation — and why computing it is NP-hard.
- The footrule-optimal aggregate as a polynomial-time 2-approximation of Kemeny.
- Evaluation over the finance corpus, a finance case study, and the honest caveats.
Score fusion, and why it breaks
The earliest combination methods fuse scores. Given retrievers each assigning document a score , CombSUM ranks by the sum , and CombMNZ multiplies that sum by the number of lists in which appears, rewarding documents many retrievers agree on (Fox and Shaw, 1994). Both are reasonable when the scores are commensurable — several runs of the same retriever, say. They fail when the scores are not.
Make the failure concrete. Suppose BM25 scores a relevant filing at and a strong dense match at cosine . CombSUM adds them. Now imagine we re-express BM25 in millibels, or simply tune a different saturation constant, so every BM25 score is multiplied by a thousand: the filing now scores . Nothing about the ranking BM25 produces has changed — the documents are in the same order — yet CombSUM’s output flips entirely, because the BM25 term now dwarfs every cosine value and the sum is, to three significant figures, the BM25 score alone. The combination was never reading agreement between the retrievers; it was reading their units. A practitioner can paper over this with per-list normalization — min–max or -scoring each list before summing — but normalization is brittle in its own way: it is sensitive to outliers and to the score distribution, and a single anomalously high score compresses everything else toward zero. We want a combination rule that cannot be fooled by scale at all. The way to get one is to discard the scores and keep only what survives any rescaling: the order itself.
Reciprocal Rank Fusion
Write for the rank of document in list — its 1-based position, so the top document has rank . RRF scores a document by summing a decaying function of its rank across the lists.
Definition 1 (Reciprocal Rank Fusion).
Given ranked lists , the RRF score of document is
where is the 1-based rank of in list (with a convention, e.g. , for documents absent from a list, contributing ), and is a fixed constant. Documents are ranked by decreasing . The standard choice is (Cormack, Clarke, and Büttcher, 2009).
Two design choices are doing the work. First, the contribution from a list depends only on the document’s rank there, never on its score — this is the whole point, and the next section makes its consequence precise. Second, the contribution decays reciprocally in rank: the gap between rank and rank is , far larger than the gap between rank and rank . RRF is therefore top-heavy — being first in a list matters much more than the difference between fortieth and forty-first — which matches what we want from retrieval, where only the head of each list is trustworthy.
The constant tunes exactly how top-heavy the rule is. Because the reciprocal is steepest when is small, a small exaggerates the advantage of the top ranks: at the score is dominated by any list that places first. A large flattens the decay toward a straight line in rank, so every position contributes almost equally and only the sum of ranks matters. The celebrated default is a single empirically chosen number — and, as the rigor flag insists, that is all it is. Drag the slider in the laboratory and watch the fused order shift as the rule slides between these two regimes; hover any document to see its contribution from each list, the same decomposition the formula sums.
Proposition 1 (Scale invariance of RRF).
Let be any strictly increasing function applied to list ‘s scores. Then the RRF ranking computed from the rescaled scores is identical to the RRF ranking from . CombSUM has no such property.
Proof.
A strictly increasing preserves order: if and only if . So list sorted by is the same ordering as list sorted by , which means every rank is unchanged. The RRF score is a function of those ranks alone, so it — and the order it induces — is unchanged. CombSUM, by contrast, ranks by , which depends on the score values: taking for the lexical list multiplies that list’s contribution by , so for a large enough multiplier the lexical scores dominate the sum and CombSUM returns the lexical order regardless of the dense scores. The companion harness asserts exactly this — RRF stable under a rescaling while CombSUM’s order collapses onto the rescaled list.
∎Scale invariance is the precise statement of why position beats score. It also explains why RRF fuses heterogeneous retrievers so gracefully: a BM25 list, a cosine list, and a learned-sparse list need no shared calibration, because their numeric ranges never enter the computation. Only their orderings do.
RRF as a positional voting rule: the Borda limit
Reading only positions places RRF inside social choice theory: each retriever is a “voter” submitting a ranked ballot over the “candidate” documents, and RRF is a positional scoring rule — it awards each candidate points that depend only on the positions it receives, then sorts by total points. The most classical positional rule is the Borda count, in which a candidate ranked (1-based) out of on a ballot earns points. RRF is a different positional rule, with reciprocal weights in place of Borda’s linear — but the two coincide in a limit.
Proposition 2 (The Borda limit of RRF).
Let be the Borda total of over lists of documents. As , the RRF ranking converges to the Borda ranking, provided the Borda totals are distinct.
Proof.
Expand the reciprocal weight for large :
Summing over the lists,
Now , so . The bracketed quantity is the same for every document; the only document-dependent leading term is . Hence for two documents with ,
once is large enough. When all Borda totals are distinct, there is a threshold beyond which every pairwise comparison agrees with Borda, so the RRF order is the Borda order.
∎The distinctness caveat is not a technicality to wave away — it is visible in our finance instance, where the two prize disclosures and the consensus filing all share the same Borda total, a three-way tie. There the limit order is decided not by Borda but by the next term in the expansion, the curvature of , which is exactly why the companion harness verifies the Borda limit on strict random instances rather than on the tied finance one. The lesson is the useful one: at the large- end RRF is a Borda count, and at the small- end it is winner-take-the-top; the shipped interpolates between these, closer to the top-heavy end.
The geometry of rankings
To say what the best combination of ballots is, we need to measure how far two rankings are from each other. A ranking of documents is a permutation — equivalently, the rank vector recording each document’s position — and the set of all permutations becomes a metric space once we choose a distance. A permutation is itself a familiar object from statistics: the rank vector of a sample is a deterministic function of its order statistics, so the space rank fusion operates over is exactly the space of orderings that order statistics induce. Two distances matter here.
Definition 2 (Kendall-τ distance and Spearman footrule).
For permutations of , the Kendall-τ distance counts discordant (oppositely ordered) pairs,
and the Spearman footrule sums absolute displacements,
The Kendall distance is the number of adjacent transpositions needed to turn one ranking into the other — the bubble-sort count, the smallest number of swaps of neighboring items that reconciles them. It is the natural notion of disagreement for rankings: each discordant pair is one “this should be above that, but the other ballot says otherwise.” Counting concordant and discordant pairs is the same machinery that defines the rank statistics of nonparametric testing — Kendall’s τ is a U-statistic, and the Mann–Whitney U is built from the identical pair count — so the geometry here and the inference there share a combinatorial core. The footrule, by contrast, asks how far each item had to move. These two ways of measuring disarray are not independent; they are pinned to each other within a factor of two.
Theorem 1 (Diaconis–Graham inequality).
For all permutations of ,
Proof.
Relabel by so that is the identity; the distances are invariant under this relabeling, and we write , . For each position set
the inversions in which is, respectively, the smaller element (a larger value sits to its left) and the larger element (a smaller value sits to its right). Every inversion is counted exactly once by the of its right endpoint and exactly once by the of its left endpoint, so
A short count gives the key identity : among the values smaller than , some sit left of and the rest — of them — sit right; among the positions left of , some hold smaller values and hold larger ones; subtracting leaves .
Upper bound . Since ,
Lower bound . This is the companion bound of Diaconis and Graham (1977); unlike the upper bound it does not fall out of the per-position identity (the local data are not enough — the bound needs the global structure of a genuine permutation), and we take it as established rather than reprove it here. Both directions are checked numerically in the companion harness, which asserts over thousands of random permutation pairs.
∎The inequality says the two measures of disarray are equivalent up to a constant: a ranking with many inversions has large displacement and vice versa, and neither can be small while the other is large. We are about to spend that equivalence. The “right” notion of consensus is defined through the Kendall distance, but the Kendall distance is hard to optimize; the footrule is easy to optimize; and Diaconis–Graham is the bridge that lets a footrule answer stand in for a Kendall answer.
The Kemeny consensus
With a distance in hand, the best combination of ballots has a clean definition: the ranking that disagrees least, in total, with the input lists.
Definition 3 (Kemeny consensus).
Given input rankings , a Kemeny consensus is a permutation minimizing the total Kendall-τ distance to the inputs,
The Kemeny consensus is the median permutation under the Kendall metric, and it has a strong optimality property: it satisfies the extended Condorcet criterion — if a majority of lists rank document above document , then so does the consensus, whenever this is consistent. It is, in a precise sense, the ranking the retrievers “vote for.” In our finance instance this exposes a subtlety worth being precise about. Brute-forcing the consensus shows the Kemeny optimum is not unique — six orderings tie at the minimum total Kendall distance of , and RRF’s own output is one of them. One of those co-optimal orderings lifts the consensus filing — the disclosure ranked second by both legs — to the top, since being everyone’s second is one way to minimize total disagreement; RRF’s positional weights instead break the tie toward each leg’s idiosyncratic leader, scoring the shared-second document by and leaving it third. So RRF is not a worse approximation of the consensus here — it is itself a Kemeny consensus, and the difference is only which co-optimal tie each rule selects. This is still the point of the rigor flag: RRF is a heuristic that never computes the consensus set, so it cannot know its ordering is one optimum among several, nor choose deliberately among them.
The reason it never computes it is decisive.
Remark (Kemeny optimization is NP-hard).
Finding a Kemeny consensus is NP-hard, even with only four input lists. The reduction is from the minimum feedback arc set problem on tournaments: build a directed graph whose vertices are documents and whose edge is weighted by how many lists rank above ; a Kemeny-optimal ranking is exactly a vertex ordering minimizing the weight of “backward” edges, the minimum feedback arc set. We cite this hardness rather than prove it (Dwork, Kumar, Naor, and Sivakumar, 2001; Bartholdi, Tovey, and Trick, 1989).
For the six-document toy corpus we can find the Kemeny optimum by brute force over all permutations — the companion harness does — but makes that hopeless at retrieval scale. We need a consensus we can actually compute, and Diaconis–Graham tells us where to find one.
A computable surrogate: the footrule 2-approximation
Swap the hard distance for the easy one. Define the footrule-optimal aggregate as the ranking minimizing total footrule distance to the inputs — and observe that, unlike Kemeny, this minimization is a polynomial-time problem.
Theorem 2 (Footrule aggregation is a polynomial-time 2-approximation of Kemeny).
The footrule-optimal aggregate can be computed in polynomial time as a minimum-cost bipartite matching, and its total Kendall cost is within a factor of of the Kemeny optimum:
Proof.
Polynomial time. Minimizing over permutations is separable across documents once we view as an assignment of documents to the target positions: the cost of placing document at position is , and we seek the assignment of documents to distinct positions of minimum total cost. That is precisely a minimum-cost perfect bipartite matching between documents and positions, solved by the Hungarian algorithm in .
The factor of two. Let be a Kemeny optimum. Apply the Diaconis–Graham inequality termwise:
The first step bounds Kendall by footrule on the aggregate, the second uses that minimizes total footrule (so it cannot do worse than the Kemeny ranking does on footrule), and the third bounds footrule by twice Kendall on the optimum. The chain delivers (Dwork, Kumar, Naor, and Sivakumar, 2001).
∎This is the payoff of the geometry. We cannot compute the median permutation, but we can compute the footrule median in cubic time, and the bridge inequality guarantees it lands within of the true optimum’s disagreement. The companion harness checks the bound directly: across the finance instance and hundreds of random multi-list instances, the footrule aggregate’s Kemeny cost never exceeds twice the brute-force optimum. Where does RRF sit in this picture? Nowhere on the guarantee. RRF is neither the Kemeny optimum nor the footrule 2-approximation; it is a positional heuristic with no proven bound on its distance to consensus. It is fast, it is scale-invariant, and it works extremely well empirically — but the rigorous statements above are about the Kendall–footrule geometry and the matching-based aggregate, not about RRF. Honesty about that distinction is the difference between explaining rank fusion and selling it.
Evaluation: does fusion actually help?
Geometry aside, the practical question is whether fusing two retrievers retrieves better than either alone. Against graded relevance judgments we measure NDCG, the discounted cumulative gain normalized by its ideal. On the finance corpus the answer is clean and is asserted in the harness: each leg, by burying one of the two genuinely relevant disclosures down at rank three, scores NDCG@6 ; RRF, by interleaving the two leaders so both prize disclosures land in the top two, recovers the ideal ordering at NDCG@6 , strictly beating both legs. The fusion wins not because it is cleverer than either retriever but because the two retrievers fail differently — the lexical leg misses the semantically phrased passage, the dense leg misses the term-exact filing — and a position-based combination keeps whatever either leg ranked highly while discarding the idiosyncratic mistakes neither leg corroborates.
A candid note on the companion code: its dense leg is a deterministic toy embedding — a seeded random projection of bag-of-words counts, scored by cosine — chosen so the notebook is self-contained, CPU-only, and reproducible to the decimal with no model download. By the Johnson–Lindenstrauss lemma a random projection approximately preserves cosine, so this stand-in is really a length-normalized lexical-cosine ranking that disagrees with BM25 because it carries no IDF weighting; it is not a trained semantic encoder, and we do not pretend it captures synonymy a real bi-encoder would. The rank-aggregation mathematics above is entirely indifferent to how the second list is produced — that independence is precisely why the geometry, not the encoder, is the rigorous content of this topic.
Honest caveats
Implementation
The companion notebook (notebookPath) imports the BM25 lexical leg from the BM25 topic, builds the deterministic toy dense leg, and implements RRF, Borda, CombSUM, the Kendall-τ and footrule distances, the footrule aggregate via scipy’s linear_sum_assignment, and an exact brute-force Kemeny consensus. Its verification harness asserts every claim the topic makes, each assert a pedagogical statement made executable: RRF’s order is unchanged when the BM25 scores are scaled by a thousand while CombSUM’s order collapses onto them (Proposition 1); holds across thousands of random permutation pairs (Theorem 1); the RRF order at large equals the Borda order on strict instances (Proposition 2); the footrule aggregate’s Kemeny cost stays within twice the brute-force optimum across the finance instance and hundreds of random ones (Theorem 2); and NDCG@6 of the RRF fusion strictly exceeds that of either leg on the finance corpus. The FusionLaboratory component above mirrors that corpus, the two input rankings, and the fused order to the decimal, so the three pillars — math, viz, and code — agree by construction.
Connections
- BM25 is the lexical leg whose ranking RRF fuses with a dense retriever; this topic picks up exactly where BM25's finance case study leaves off bm25-binary-independence-model
- learned sparse and late-interaction retrievers supply additional ranked lists that the same positional fusion combines, with no rescaling needed across the heterogeneous scorers late-interaction-learned-sparse
References & Further Reading
- paper Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods — Cormack, Clarke & Büttcher (2009) The origin of RRF and the k = 60 constant
- paper Combination of Multiple Searches — Fox & Shaw (1994) CombSUM and CombMNZ score-fusion baselines
- paper Rank Aggregation Methods for the Web — Dwork, Kumar, Naor & Sivakumar (2001) Kemeny optimization, NP-hardness, the footrule 2-approximation via min-cost matching
- paper Spearman's Footrule as a Measure of Disarray — Diaconis & Graham (1977) The K ≤ F ≤ 2K inequality between Kendall-τ and the Spearman footrule
- documentation Reciprocal rank fusion — Elasticsearch Reference Production RRF: the rank_constant parameter defaulting to 60