Reciprocal rank fusion
Also: RRF
A method for combining two ranked result lists — lexical and semantic search, say — into one ranking, using only each result's rank, not its raw score.
Last updated
On this page
Reciprocal rank fusion combines two or more ranked result lists into a single ranking using
only each result’s position in each list, not its raw score. For a document ranked at
position r in a given list, its RRF contribution from that list is 1 / (k + r), where
k is a small constant (commonly 60). A document’s final score is the sum of that term
across every list it appears in, and the fused ranking sorts by that sum.
Why rank instead of raw score
A lexical engine like BM25 and a semantic engine comparing embedding cosine similarities produce scores on completely different scales, and neither scale is calibrated against the other. BM25 scores are unbounded and depend on term rarity and document length; cosine similarity is bounded between -1 and 1 and clusters tightly for a static embedding model. Averaging the two raw scores directly means whichever engine happens to produce larger numbers dominates the fusion — not because it found better results, but because of an accident of scale. Rank position sidesteps the problem entirely: “first place” means the same thing regardless of which engine produced it or what its internal scoring function looks like.
A worked example
Suppose a query returns these top four results from each engine (by rank, not score):
| Rank | Lexical (BM25) | Semantic (cosine) |
|---|---|---|
| 1 | Document A | Document C |
| 2 | Document B | Document A |
| 3 | Document D | Document B |
| 4 | Document C | Document E |
With k = 60, Document A scores 1/61 + 1/62 ≈ 0.03252 (rank 1 lexical, rank 2 semantic).
Document C scores 1/64 + 1/61 ≈ 0.03202 (rank 4 lexical, rank 1 semantic). Document B scores
1/62 + 1/63 ≈ 0.03200 (rank 2 lexical, rank 3 semantic) — essentially tied with C, a hair
behind. Document D and E, each appearing in only one list, score lower still. The fused order
becomes A, then C and B in a near-tie, then D and E — a document that ranked well in both
lists (A) clearly beats one that ranked first in only one (C), which is the behaviour RRF is
designed to produce: consistent moderate agreement outranks a single strong opinion from only
one engine.
Where it sits in Archēglyph
Search results combine a BM25 lexical ranking over the Tantivy index with a vector search semantic ranking over the zvec index, fused with reciprocal rank fusion into the single relevance score shown against each result — the mechanism behind hybrid search. The Lexical | Hybrid | Semantic toggle on the search box, covered step by step in Your first dataset, lets a researcher bypass fusion entirely and see either engine’s ranking alone — useful when the fused order doesn’t match intuition and you want to know which engine is driving a particular result up or down.
Comparison with the alternatives
| Approach | Needs calibrated scores? | Sensitive to outlier scores? | Tuning required |
|---|---|---|---|
| Weighted score sum | Yes | Yes | Per-engine score normalisation |
| Learning-to-rank | Yes (as training signal) | Depends on model | Labelled training data |
| Reciprocal rank fusion | No | No | One constant, k |
RRF’s appeal for a system like this is the last column: it needs no labelled relevance judgments and no per-corpus score calibration, which matters when the same fusion logic has to behave sensibly across every dataset a researcher creates, from twenty pages to twenty thousand, without per-dataset tuning.
Limitations
RRF assumes every input list is independently reasonable — it fuses rank agreement, not correctness, so if both the lexical and semantic engines share the same blind spot (neither indexes a particular language variant well, say), fusion will not correct for it. It is also insensitive to how much better a first-place result is than a second-place one, only that it is better; a list where the top result is a runaway best match and one where the top two results are nearly tied are treated identically by RRF, which is the price of not needing calibrated scores.
Bottom line
Reciprocal rank fusion is a simple, tuning-light way to combine lexical and semantic search rankings without needing the two engines’ scores to live on the same scale — it looks only at where each engine placed a result, not by how much. That is precisely the property that makes hybrid search practical across datasets of very different size and vocabulary without retuning fusion weights for each one.
FAQ
Frequently asked questions
- Why does reciprocal rank fusion use rank position instead of the raw scores from each search engine?
- Because BM25 scores and cosine-similarity scores live on different, uncalibrated scales. Combining raw scores means whichever engine happens to produce larger numbers dominates the result, regardless of which one actually found better matches. Rank position means the same thing — 'first place' — no matter which engine produced it.
- What does the constant k control in reciprocal rank fusion?
- k dampens the difference between adjacent ranks. A small k makes first place matter much more than second place; a larger k flattens the ranking so that moderate agreement across multiple lists counts for more relative to a single strong first-place finish. 60 is the commonly used default from the original paper.
- Can reciprocal rank fusion combine more than two ranked lists?
- Yes. The formula sums a 1/(k + rank) term for every list a document appears in, so it generalises to any number of ranked inputs — three search engines, or the same engine run with different parameters, fuse the same way as two.