Course contentsShow
← Machine Learning and Deep Learning
Lesson 2001 of 3,53843. Retrieval-Augmented Generation: Advanced TechniquesFree lesson

Reciprocal Rank Fusion

RRF algorithm for merging ranked lists without requiring normalized scores, with parameter tuning.

Reciprocal Rank Fusion

You'll learn how to elegantly merge ranked lists from different retrieval systems without worrying about score normalization.

The Core Problem

In hybrid search, you've got two ranked lists: one from BM25 (keyword search) and one from vector similarity. Each uses completely different scoring scales—BM25 might return scores like 15.3, while cosine similarity gives 0.87. We covered score normalization last lesson, but there's a simpler, more robust alternative.

How RRF Works

Reciprocal Rank Fusion (RRF) ignores raw scores entirely. Instead, it uses only the position (rank) of each document in each list.

The algorithm:

  1. For each document, look at its rank in each retrieval method
  2. Apply this formula: RRF_score = Σ(1 / (k + rank_i))
  3. Sort documents by their combined RRF scores

The parameter k (typically 60) is a constant that prevents top-ranked items from dominating too heavily.

Analogy: Imagine two friends ranking their favorite restaurants. Instead of comparing "8.5/10" vs "4 stars," you just note "Friend A ranked this #3, Friend B ranked it #1." RRF gives more credit to restaurants appearing high on both lists.

Parameter Tuning

The magic parameter is k:

  • Lower k (e.g., 10): Top-ranked items dominate more strongly
  • Higher k (e.g., 100): Flattens differences, giving lower-ranked items more influence
  • Default k=60: Well-balanced for most scenarios

Tune k by evaluating retrieval quality metrics on your validation set.

Key Takeaway: RRF merges ranked lists using only rank positions with the formula 1/(k+rank), eliminating score normalization complexity while remaining highly effective—just tune k to balance top-rank dominance.