Reciprocal rank fusion

역순위 융합

Convert different result ranks into comparable contributions and sum them.

···
html
<div class="v"><header><b>RANK FUSION</b><span id="state"></span></header><main><div class="ranks" id="ranks"></div><div class="winner" id="winner"></div></main><footer>score = Σ 1 / (k + rank)</footer></div>
css
.v{width:min(92vw,660px);height:min(86vh,310px);box-sizing:border-box;padding:clamp(9px,2.5vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:7px;color:var(--fg);font:500 clamp(15px,4.5vmin,19px)/1.25 var(--font-sans, sans-serif)}.v header,.v footer{display:flex;justify-content:space-between;align-items:center;gap:8px;white-space:nowrap}.v header b{color:var(--accent);font-size:.9em}.v header span,.v footer{color:var(--muted);font-size:.82em}.v main{flex:1;min-height:0;position:relative;overflow:hidden}.v .mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.v .active{background:var(--accent)!important;color:var(--bg)!important;border-color:var(--accent)!important}.v .muted{opacity:.45} .ranks{height:calc(100% - 22px);display:flex;justify-content:center;gap:8px}.rank{box-sizing:border-box;width:42%;border:1px solid var(--line);border-radius:6px;padding:3px;text-align:center;font-size:.8em}.rank b{display:block;padding:2px;margin-top:2px;line-height:1.1;border-radius:4px;background:color-mix(in srgb,var(--accent) 12%,var(--surface));font:600 1em ui-monospace,monospace}.winner{position:absolute;left:0;right:0;bottom:0;height:18px;display:grid;place-items:center;text-align:center;color:var(--accent);font:600 .8em ui-monospace,monospace}
js
let n=0;function draw(){document.getElementById("ranks").innerHTML="<div class=rank>KEYWORD<b>A</b><b>B</b><b>C</b></div><div class=rank>VECTOR<b>B</b><b>A</b><b>D</b></div>";document.querySelectorAll(".rank b").forEach((el,i)=>el.classList.toggle("active",n===0?[0,4].includes(i):n===1?[1,3].includes(i):[0,1,3,4].includes(i)));document.getElementById("winner").textContent=["A: rank 1 + rank 2","B: rank 2 + rank 1","B and A lead both lists"][n];document.getElementById("state").textContent=["score A","score B","fuse ranks"][n];n=(n+1)%3}draw();setInterval(draw,1100)

Reciprocal rank fusion gives each document a contribution shaped like 1/(k + rank) in each result list. A document near the top of several lists accumulates more score.

It avoids aligning raw score scales. The constant k and candidate depth still affect the result, so evaluate them on real queries.

When to use

Use it to merge lists whose raw scoring scales differ.

Open as page ↗