What the constant k does
Reciprocal rank fusion merges ranked lists using only each passage's place in each list: it adds 1 / (60 + rank) per list. No scales to align, one constant, and you can recompute the search lab's Fused column by hand.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write rrf_score(ranks, k=60) that takes a passage's list of ranks (one per list that contains it) and returns its fused score. Print it for [1, 3] and [10, 10] with 6 decimals.
Using rrf_score, print the fused score of a passage first in one list only, then of a passage tenth in both lists. Which is higher?
Explain it without notes
State the RRF formula and compute the fused score of a passage ranked 2nd in one list and 7th in another, with k = 60.
Why does RRF not need normalised scores?
Explain what the constant k does, using two values.
What can you not do with a fused score?
Expected output
k rank 1 rank 2 rank 10 rank 50 rank 1 / rank 10
1 0.50000 0.33333 0.09091 0.01961 5.50
10 0.09091 0.08333 0.05000 0.01667 1.82
60 0.01639 0.01613 0.01429 0.00909 1.15
1000 0.00100 0.00100 0.00099 0.00095 1.01
fused score of A (ranks 1 and 20) and B (ranks 5 and 5):
k=1 A 0.54762 B 0.33333 winner: A
k=10 A 0.12424 B 0.13333 winner: B
k=60 A 0.02889 B 0.03077 winner: B