How does reciprocal rank fusion work, and why fuse by rank instead of by score?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
RRF merges multiple ranked lists (BM25, dense, one list per expanded query...) by summing reciprocal ranks:
def rrf(rankings: list[list[str]], k: int = 60) -> list[str]:
scores: dict[str, float] = {}
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, key=scores.get, reverse=True)
Full worked answer
RRF merges multiple ranked lists (BM25, dense, one list per expanded query...) by summing reciprocal ranks:
def rrf(rankings: list[list[str]], k: int = 60) -> list[str]:
scores: dict[str, float] = {}
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, key=scores.get, reverse=True)
A document ranked 1st contributes 1/(60+1) ≈ 0.016 per list; rank 50 contributes ≈ 0.009. Documents appearing high in multiple lists accumulate the highest fused scores, but a strong showing in a single list still surfaces - which is the behaviour you want from hybrid search, where some queries are purely lexical and some purely semantic.
Why ranks, not scores: BM25 scores are unbounded and corpus-dependent (term frequencies, document lengths); cosine similarities live in a narrow model-specific band (one embedder's "great match" is 0.85, another's is 0.55); neither is a calibrated probability. Adding or averaging them requires normalization (min-max or z-score per query), which is fragile - normalization statistics shift per query, per corpus update, and per model version, so a weighted-score fusion tuned today silently degrades next quarter. Ranks are invariant to all of that. RRF has zero training, one insensitive hyperparameter, and near-SOTA fusion quality in practice - a rare free lunch.
The k constant (60 in the original RRF paper - Cormack, Clarke & Büttcher, 2009) is a smoothing term controlling how steeply contribution decays with rank: small k makes fusion top-heavy (rank 1 dominates rank 5); large k flattens differences. It's famously insensitive - nobody meaningfully tunes it.
Limitations to name: RRF throws away score magnitude - a maximally confident dense hit counts the same as a marginal rank-1 - and it treats all lists as equally trustworthy. If you have training data, a learned fusion (or just letting the cross-encoder reranker arbitrate the union of candidates) can beat it; RRF is the right default until then.
What a good answer covers
- A document ranked 1st contributes 1/(60+1) ≈ 0.016 per list; rank 50 contributes ≈ 0.009
- Documents appearing high in multiple lists accumulate the highest fused scores, but a strong showing in…
- Why ranks, not scores: BM25 scores are unbounded and corpus-dependent (term frequencies, document…
- Adding or averaging them requires normalization (min-max or z-score per query), which is fragile -…
- Ranks are invariant to all of that
Key terms: multiple · Why ranks, not scores · k constant
In the glossary: RRF · BM25 · Hybrid search · Cross-encoder
Interviewer follow-ups to expect
When would weighted fusion beat RRF, and what data do you need to tune it?
How does RRF interact with multi-query expansion?
If a doc appears in the dense list only, what's its ceiling in the fused ranking?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep