esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

What Is Reciprocal Rank Fusion?

How reciprocal rank fusion merges keyword and vector search results into one ranking, with a worked example and its limits, for your AI interview.

In short

Reciprocal rank fusion (RRF) merges several ranked result lists into one. It gives each item 1 divided by (its rank plus a constant, often 60), and adds those amounts across the lists. Because it works from ranks, the lists' raw scores never need to match.

11 min readAdvancedOccasional · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Reciprocal rank fusion, or RRF, combines two or more ranked lists into one. Say a keyword search and a vector search each return their own top results. RRF scores each item by one divided by (its position plus a constant, often 60), then adds the scores. An item near the top of both lists rises to the top. Because it works from places alone, I never have to scale the two engines' scores to match.

What is reciprocal rank fusion, in plain words?

A search usually returns a ranked list: the best match first, then the next, and so on. Reciprocal rank fusion, or RRF, merges two or more of these lists into one. It is used in retrieval-augmented generation (RAG), where an app first fetches passages from your documents and the model then answers from them.

Picture a hiring panel of three interviewers. Each ranks the same candidates from first to last, but their marks come from different scales, so adding up the marks would be unfair. Adding up the places each person gave is fairer. A candidate that most of the panel ranked near the top rises to the top.

Azure's search documentation describes the same idea. Items that appear near the top of several lists are likely to be more relevant, so they should rank higher in the combined result. In a RAG app, the two lists usually come from a keyword search and a vector search.

Key words

Keyword search
Finds passages that contain the words you typed, such as a clause number.
Vector search
Finds passages whose meaning is close to your question, even when the words differ.
Rank
A place in a list. 1 is first, 2 is second, and so on.
Fusion constant (k)
A fixed number added to each rank, so the gap between the top places is smaller. Often 60.

How does the formula work?

For each item, RRF looks at every list it appears in. It takes the item's rank in that list, adds the constant k, and takes 1 divided by the total. It then adds those amounts across the lists. An item missing from a list adds nothing from that list.

RRF⁡(d)=∑r1k+rank⁡r(d)\operatorname{RRF}(d)=\sum_{r}\frac{1}{k+\operatorname{rank}_r(d)}

In words: an item's RRF score is the sum, over each list it appears in, of 1 divided by (k plus its rank in that list). Microsoft's documentation says the score is calculated this way, and that experiments point to a small k, such as 60.

  1. 1

    Collect the lists

    Run the keyword search and the vector search. Each returns its own ranked list.

  2. 2

    Score by place

    For each item, add 1 divided by (k plus its rank) from every list it appears in.

  3. 3

    Sort the totals

    Sort all items by their total. The highest total goes first.

How two ranked lists become one

Keyword search ranks

best word matches first

Vector search ranks

closest meaning first

Add 1 / (k + rank)

summed for each item

One merged ranking

sorted by total score

  1. 1The keyword list goes in, first place to last.
  2. 2The vector list goes in too, in its own order.
  3. 3The summed totals are sorted, highest first, into one list.
Two ranked lists go in. Each item's place in each list becomes a share, and the shares are added. One merged ranking comes out. Only the places count, so the two engines' raw scores never need to match.

What does a real search look like with RRF?

Imagine a legal team with 40,000 supplier contracts. They want every clause that sets a liability cap, which is the most a party pays if things go wrong. The keyword search returns clauses that use the exact words. The vector search returns clauses that say the same thing differently, such as the maximum either side pays.

The demo uses five results per list to keep it short. A real system fetches many more, then fuses them.

Python
# Fuse two ranked lists with reciprocal rank fusion. K = 60 is a common starting value.
K = 60
keyword = ["MSA-2041 cl. 9.2", "MSA-1187 cl. 4.1", "NDA-0330 cl. 2", "SOW-77 cl. 3", "MSA-2041 cl. 11"]
meaning = ["MSA-1187 cl. 4.1", "MSA-2041 cl. 11", "SOW-77 cl. 3", "MSA-0912 cl. 7", "NDA-0330 cl. 2"]

def fuse(*ranked_lists):
    scores = {}
    for ranked in ranked_lists:
        for rank, clause in enumerate(ranked, start=1):
            scores[clause] = scores.get(clause, 0) + 1 / (K + rank)
    return sorted(scores.items(), key=lambda item: item[1], reverse=True)

for clause, score in fuse(keyword, meaning):
    print(f"{score:.5f}  {clause}")

Output

0.03252  MSA-1187 cl. 4.1
0.03151  MSA-2041 cl. 11
0.03150  SOW-77 cl. 3
0.03126  NDA-0330 cl. 2
0.01639  MSA-2041 cl. 9.2
0.01562  MSA-0912 cl. 7

Read the output. Clause 4.1 comes first because both searches ranked it near the top: 1 divided by 62, plus 1 divided by 61, gives 0.03252. Clause 9.2 is the best keyword match, but only the keyword search found it. One share of 1 divided by 61 gives 0.01639, which puts it fifth of six.

That is the trade-off in one line. RRF rewards agreement, so a clause that only one search finds can sink, however good its match. One fix is to fetch deeper lists from each search, so the other engine can place the clause in its own list. With k = 60, though, a rank near 50 adds only about 0.009, so the clause needs roughly a seventh-place or better finish there to reach the top four.

Why use ranks instead of scores, and why k = 60?

Keyword and vector engines score items in their own ways, so their numbers can't be compared directly. Microsoft's documentation says each algorithm has its own range and magnitude. A keyword score of 14 and a similarity of 0.83 (made-up numbers) can't be added without normalising. Their places can.

  • “Each algorithm has its own range and magnitude.”

    Microsoft, Foundry IQ (Azure AI Search) documentation

  • “Experiments show the algorithm performs best when you set k to a small value, such as 60.”

    Microsoft, Foundry IQ (Azure AI Search) documentation

The 60 is a starting point, not a law. The fusion constant is a different number from the k that vector search uses to decide how many of the closest matches (its nearest neighbours) to fetch. Keep the two apart in your answer.

Tip

Asked why 60? Say it is a common starting value that worked well in experiments, and that you would check it on your own data.

What are the limits of RRF?

RRF is simple, which is its strength, but it only uses places. A result that leads its list by a wide margin gets the same share as one that leads by a whisker.

  • Blind to the gaps

    Score differences inside a list are ignored. Only the order counts.

  • Sensitive to its settings

    A 2022 study found RRF sensitive to its parameters, so results can move when the constant changes.

  • Favours agreement

    An item found by only one search gets one share of credit, so it can drop out of the top results.

A 2022 paper on arXiv, An Analysis of Fusion Functions for Hybrid Retrieval, compared RRF with a convex combination (CC) of the two scores, which is a weighted mix of them. Its authors found RRF sensitive to its parameters. CC beat RRF both on the same kind of data and on different data, and it needed only a small set of training examples to tune.

Microsoft's documentation adds a practical point: you can weight a vector query so it counts for more or less in the fused result. That lets you tune the balance instead of giving both lists an equal say.

How would you decide if RRF is good enough?

  1. 1

    Build a test set

    Take a sample of real questions from your users, and mark which passages answer each one.

  2. 2

    Run each option

    Score keyword only, vector only, RRF and a weighted mix on the same questions.

  3. 3

    Look at the misses

    Check which answers were missed, not just the average. A missed clause costs more than a slow reply.

  4. 4

    Keep the simplest winner

    Pick the simplest option that meets your bar, and test again when the documents change.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: merge ranked lists by adding 1 divided by (k plus rank).
  • Why ranks: each engine's scores sit on their own scale.
  • The formula, with k as a fusion constant and 60 as a start.
  • The trade-off: it rewards items several searches agree on.
  • Honest limits: sensitive to settings, and a weighted mix can win.
  • How you would check it on your own questions.

Common traps

  • Trap"Just add the two scores together."

    BetterThe scores sit on different scales, so RRF adds a share for each place instead.

  • Trap"Take the best score from either list."

    BetterThat keeps one search's view only. RRF gives credit to items both searches agree on.

  • Trap"RRF is always the best fusion method."

    BetterIt is a strong, simple default. A 2022 study found a tuned weighted mix could beat it.

Can you spot the fix in this fusion code?

Spot the fix

A team's fusion code adds the raw keyword score to the raw vector similarity. Which line is the RRF fix?

Quick check

A clause is first in the keyword list only. A clause that is fourth in both lists is in the fused results too, with k = 60. Which one ranks higher?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q123What is hybrid search (BM25 + vectors)?11 min
  2. Q124What is BM25?12 min
  3. Q126Rerankers: cross-encoder vs bi-encoder?12 min
  4. Q131Retrieval metrics: recall@k, MRR, nDCG?12 min
  5. Q133What are common RAG failure modes?11 min

Last updated on 27 November 2026

Building a search that mixes keywords and meaning?

I design and build AI search and agents, including how keyword and vector results get merged and tested. Book a short call and tell me what your search needs to find.