Modules/Gen AI/ Hybrid Search Lab

Hybrid Search: Dense + Sparse

Two rankings of the same five documents, fused by rank rather than by score, because the two methods' raw scores live on entirely different scales.

Fusion

4

small k lets rank-1 dominate; large k (60 is the common default) smooths everything out

query: "python list methods"

Two Rankings

Dense (cosine)
Sparse (BM25)

Fused Ranking (Reciprocal Rank Fusion)

Reading It

 

Hybrid Search: A Practical Guide

Neither method alone, combined by their agreement.

Quick Context

Dense retrieval and BM25 fail in different, mostly non-overlapping ways. A document phrased differently from the query but on the same topic can score well under a dense method and poorly under exact keyword match; a document with an unusual acronym or exact code can score well under BM25 and be embedded ambiguously. Hybrid search runs both and combines the results, so a failure in one is not automatically a failure of the whole system.

Why fuse ranks, not raw scores

A cosine similarity lives between -1 and 1. A BM25 score is an unbounded sum that depends on corpus size and term rarity. Averaging the two numbers directly is meaningless — a BM25 score of 8 is not "worth" anything in particular next to a cosine of 0.6. Reciprocal Rank Fusion sidesteps this by throwing the scores away and using only each document's position in each list.

RRF(d) = Σlist 1 / (k + ranklist(d))

A document ranked highly by both methods accumulates a large score from both terms. A document ranked #1 by one method but unranked or low by the other only gets a large contribution from the one list — which lets a document that both methods agree is decent beat a document only one method loves.

Interactive Exploration Guide

  1. Compare the two lists. They do not agree on the #1 result — dense and sparse are weighting the same five documents by genuinely different criteria.
  2. Read the fused ranking. The winner is not necessarily #1 in either individual list — it is the document both methods placed respectably, which is exactly what "fused by rank" is built to surface.
  3. Push k up toward 60. The gaps between fused scores shrink and consensus dominates even more strongly — this is the standard default, chosen to be forgiving of exactly how far down a list something sits.
  4. Pull k down to 1. Rank 1 in either list is now worth dramatically more than rank 2 — a document has to actually top one of the lists to compete.

Key Takeaway

Hybrid search runs dense and sparse retrieval independently and fuses their rankings rather than their scores, because the two methods' raw numbers are not on comparable scales. Reciprocal Rank Fusion rewards documents both methods rank well, which makes the combined system more robust than either retrieval method alone — a document only one method loves can be outranked by one both methods merely like.

Predict, then reveal

About to run: set RRF constant k to its maximum (60). Before it does — what happens to the readout?

Committing to an answer first is the point — the reveal runs the experiment on the visualisation above and reads the real value back, so nothing here is scripted.

Recall check

0 of 3

Say the answer out loud before you reveal it — recalling it is what makes it stick, and rereading it is not.

  1. Without scrolling back — what is the one-line takeaway from this module?

  2. What does this module say about “Fusion”?

  3. What does this module say about “Quick Context”?

Cheat sheet

Hybrid Search: Dense + Sparse (Reciprocal Rank Fusion)

Two rankings of the same five documents, fused by rank rather than by score, because the two methods' raw scores live on entirely different scales.

GEN AI · vizlearn.in/gen_ai/hybrid_search_reciprocal_rank_fusion.html