Task
📝 **Question:** **Write the function** \`rrf(rankings, k=60)\` — Reciprocal Rank Fusion. Takes a list of rankings (each ranking is an ordered list of doc IDs from best to worst, from a single retriever) and returns the fused top-K as a list of doc IDs sorted by total RRF score, highest first.
Formula for one doc in one ranking at zero-indexed position \`rank\`:
\`\`\`
score = 1 / (k + rank)
\`\`\`
Sum scores across all rankings for each doc; sort docs by total score descending.
Then fuse a vector and a BM25 retriever for an "SKU-4471" query:
\`\`\`
vector = ["doc-A", "doc-B", "doc-C", "doc-D"] # vector thinks A is best
bm25 = ["doc-D", "doc-A", "doc-E", "doc-F"] # bm25 puts D first (matched the SKU)
\`\`\`
Print the fused top-4 as a Python list:
\`\`\`
['doc-A', 'doc-D', 'doc-B', 'doc-C']
\`\`\`
A appears in both lists at high ranks → wins. D was #1 in BM25 → beats B and C even though vector didn't favour it. That's RRF: docs ranked highly by ANY retriever surface.
📋 Pick the right answer.
💡 **Hint:** Re-read the theory above if unsure.