All chapters
  1. Start hereRetrieval is a query. The model reads only what it returns
  2. Foundations · 1What retrieval means: lookup, keyword search, semantic search
  3. Foundations · 2Traditional SQL first: WHERE, indexes, full-text search and BM25
  4. Foundations · 3Vectors without AI: coordinates, distance and nearest neighbors
  5. Foundations · 4Embeddings: how a model turns text into a vector
  6. Foundations · 5Choosing an embedding model: quality, cost, privacy and fit
  7. Search · 6Schema and storage: where the vectors live
  8. Search · 7Exact vector search: compare the query with every row
  9. Search · 8Approximate nearest neighbors: HNSW, IVF and the recall trade
  10. Search · 9PostgreSQL and pgvector: vectors inside a relational database
  11. Search · 10SQLite vector search: one file on one machine
  12. Pipeline · 11Chunking and ingestion: from a document to retrievable units
  13. Pipeline · 12Retrieval pipelines: from a question to the context the model reads
  14. Pipeline · 13Hybrid search: words and vectors together
  15. Pipeline · 14Reranking: a second, more careful look at the candidates
  16. Pipeline · 15Top-k and scale: ten thousand, a hundred thousand, a million rows
  17. Pipeline · 16Two corpora: similar applicants and underwriter precedents
  18. Pipeline · 17Grounded generation: citations, abstention and conflicts
  19. Pipeline · 18Evaluating retrieval: recall@k, MRR, nDCG and faithfulness
  20. Practice · 19Google Cloud choices: Cloud SQL, AlloyDB, Vector Search, Agent Retrieval, RAG Engine, Agent Search
  21. Practice · 20Other ecosystems: libraries, engines and managed services
  22. Practice · 21Operations: migrations, deletes, permissions and freshness
  23. Practice · 22Advanced retrieval: rewriting, hierarchies, late interaction, graphs, agents
  24. Practice · 23Reference architectures: local-first, dual-corpus, managed, Postgres-native
  25. Practice · 24Framework recipes and the decision guide
  26. ReferenceGlossary
  27. AboutAbout this site and its sources
Pipeline · 13

Hybrid search: words and vectors together

Embeddings blur exact names, codes and identifiers; keyword search misses paraphrase. BM25 plus dense retrieval, reciprocal rank fusion and field weighting, with scores you can explain.

Two blind spots
Embeddings blur exact identifiers such as R-SPRK-01 or SUB-1004; keyword search misses paraphrase. Each fails where the other works.
Fuse by rank
Reciprocal rank fusion adds 1 / (k + rank) from each list. It needs no score calibration, and you can compute it by hand.
Explain every row
Keep each row's BM25 rank, dense rank and fused parts. A reviewer can then see why a passage reached the context.

An underwriter leaves a note on a submission: "check this against R-SPRK-01". The underwriting agent passes the note to search_guidance, the tool that searches the policy fixture. The guidance corpus holds 13 current passages, and the tool, in this version, ranks them by vector distance alone. This site's own case UW-R02 records what comes back: the top three are the wind-zone note GD-NOTE-02, the roof-age rule R-ROOF-01 and the occupancy note GD-NOTE-08. The sprinkler rule the underwriter named sits at rank 5.

Nothing crashed, and the ranking is not random. The query is eight characters with no ordinary words in it, and an embedding of an identifier says little about what the identifier means. A plain keyword search ranks R-SPRK-01 first without effort, because that exact token occurs in one passage only.

Now reverse the situation. In case UW-R01 the query is a sentence, "roof replaced recently but aerial imagery shows an older roof", and the passage it needs is R-ROOF-03, the rule for roof ages that disagree. That rule never uses the query's words. Keyword ranking places it fourth; the vector ranking places it second. Each method wins one case and loses the other. This page is about running both and merging their answers so that neither blind spot reaches the model. Retrieval is a query, and the model reads only what it returns: a passage that ranks fifth for the wrong reason can fall outside the context, and then the recommendation is written without it.

What this is not. This page explains the fusion mechanism. Which products ship hybrid search, and what their checkboxes mean, is on ecosystems. Where the fused list sits among the other stages, and the candidate budgets, is on retrieval pipelines.

Two retrievers, two blind spots#

Start with what each method sees. Keyword search, the method of the SQL first page, splits text into tokens and looks them up in an inverted index, a map from each token to the rows that contain it. BM25 then scores each row by how many rare query tokens it contains and how short it is. The formula and a hand computation live on that page; here it is enough that BM25 rewards a rare exact token. Because each row is described by the few tokens it contains out of a large vocabulary, this kind of retrieval is called sparse retrieval: think of a vector with one slot per vocabulary word, almost all slots zero.

Vector search, the method of the embeddings page, turns the query and every row into a short list of numbers, an embedding, and ranks rows by distance between those lists. Every slot holds a value, so this is called dense retrieval. Dense retrieval connects "older roof" with "aged roofing" because the model places them near each other. That is the strength UW-R01 needs.

The same mechanism causes the blind spot. An identifier such as R-SPRK-01, the submission id SUB-1004 or a parcel id carries its meaning by convention, not in its letters. The example's toy encoder, a deterministic 16-dimension stand-in for an embedding model, makes this visible: it maps known words to concept dimensions, and R-SPRK-01 is not a known word, so it lands on a hashed dimension that many unrelated words share. Real models split an identifier into subword pieces and give it a vector too, and the embeddings page shows why such vectors are a weak signal for exact codes, numbers and negation. An exact identifier is a token that must match character for character: a rule id, a submission id, a policy number, an evidence id such as EV-ROOF-0412.

Before AI. Shop search boxes met this problem years ago. A customer types a product code, and a ranking tuned for descriptions buries the exact item under similar ones. Search teams added an exact match on the code field next to the text ranking and merged the two. Hybrid search is the same idea, with the text ranking replaced by vectors.

So the plan is straightforward to state. Run a sparse retriever and a dense retriever on the same query and the same filters, then merge the two ranked lists into one. That is hybrid search. The interesting part is the merge.

Diagram: Hybrid search: two retrievers under one filter, fused by rank

Read left to right. The query UW-R02 is the identifier R-SPRK-01. The same version filter limits both legs to the 13 current passages. The keyword leg ranks by BM25 and puts the sprinkler rule first; the vector leg ranks by cosine distance and puts it fifth. Fusion reads only the two ranks of each passage and adds 1 / (60 + rank) from each list. Ranks and scores are from the example's toy encoder and synthetic data.

  1. One query, one filter
    1. Query text and vector: The same query goes to both legs: as tokens to one, as a vector to the other.
    2. Version filter: The same exact filter runs inside both legs, before each ranks.
  2. Two legs
    1. Keyword leg: Rare exact tokens rank first; paraphrases are missed.
    2. Vector leg: Meaning ranks first; identifiers are blurred.
  3. Fuse
    1. Rank fusion: Only positions are used, so no score needs calibrating.
    2. One candidate list: Both kinds of evidence survive; the reranker orders them next.

The diagram shows the shape for UW-R02. Both legs see the same 13 current passages, because the version filter applies to both. Each produces a ranked list. Fusion reads only the positions in those lists and writes one candidate list for the stages after it.

Why the scores cannot be added#

The first merge most engineers try is to add the two scores. It fails for a reason you can see in the numbers. On the SQL first page, the BM25 score of R-SPRK-01 for this query is 6.247; BM25 scores have no upper limit and grow with the number of matching rare terms. A cosine similarity lies between −1 and 1; with the example's toy vectors, whose entries are never negative, it stays between 0 and 1. Add 6.247 to 0.6 and the keyword side decides almost everything. Change the corpus and the BM25 scale moves, because it depends on corpus statistics, so a fixed weight that worked last month stops working.

You could rescale each list first, for example dividing every score by the list's maximum. Products do this, and the advanced section below covers it. The method this page computes by hand avoids the problem: it ignores the scores and uses only the ranks.

Reciprocal rank fusion, by hand#

Reciprocal rank fusion, RRF, gives each row a score of 1 / (k + rank) from every list it appears in, and adds those parts. A row ranked first in a list gets 1 / (k + 1); a row missing from a list gets nothing from it. Cormack, Clarke and Buettcher introduced it at SIGIR 2009 with k = 60, a value they fixed during a pilot study and did not change afterwards. They explain that k damps the influence of a single list that places a row at the very top, and the reciprocal shape keeps lower-ranked rows from vanishing.

rrf(d) = sum over lists r of  weight_r / (k + rank_r(d))      rank starts at 1, weight defaults to 1

Compute UW-R02 by hand with k = 60. BM25 ranks R-SPRK-01 first and the dense list ranks it fifth.

  1. BM25 part: 1 / (60 + 1) = 0.016393.
  2. Dense part: 1 / (60 + 5) = 0.015385.
  3. Sum: 0.031778.

Now the roof-age rule R-ROOF-01. The dense list ranks it second. BM25 ranks it third, for a reason worth noticing: the example's tokenizer keeps r-sprk-01 whole and also emits its parts r, sprk and 01, and R-ROOF-01 contains r and 01.

  1. BM25 part: 1 / (60 + 3) = 0.015873.
  2. Dense part: 1 / (60 + 2) = 0.016129.
  3. Sum: 0.032002.

The roof rule wins by 0.000224. Two middle ranks beat one first place and one fifth place. That is RRF doing what it was designed to do, rewarding agreement, and it is why the example's UW-R02 case asserts only that RRF keeps the sprinkler rule "near the top": rank 2, not rank 1. The constant k decides how much one first place is worth against agreement. With k = 2 the same arithmetic gives R-SPRK-01 1/3 + 1/7 = 0.476190 and R-ROOF-01 1/5 + 1/4 = 0.450000, and the order flips.

Diagram: The constant k decides whether agreement or one first place wins

Read left to right. Two passages compete for UW-R02. The sprinkler rule is first in the keyword list and fifth in the vector list. The roof rule is third and second. With k = 60, middle ranks in both lists add up to more than one first place; with k = 2 a first place is worth much more and the order flips. Scores are computed by the example's fusion code.

  1. Ranks in each list
    1. Sprinkler rule: The passage the underwriter named.
    2. Roof-age rule: Matched by the split tokens r and 01, and near in vector space.
  2. k = 60 (the paper)
    1. Agreement wins: Two middle ranks beat one first and one fifth.
  3. k = 2 (Qdrant default)
    1. First place wins: A small k makes the top rank of one list dominate.

The diagram puts the two computations side by side. Nothing about the passages changed between the two columns; only the constant did. That is why a fusion setting belongs in the retrieval configuration you version and test, not in a default you inherit.

The script below runs those numbers with the example's own fusion.rrf, for both cases and both constants, and then shows field weighting, which the next section explains. It is a short file added to a scratch copy of examples/rag-uw. A successful run proves the hand arithmetic matches the code and shows how k changes the order. It does not show that either k suits a real corpus: 13 synthetic passages and a toy encoder are a teaching set.

# hybrid_by_hand.py, run from a scratch copy of examples/rag-uw
import data
from encoders import TOY_A1
from fusion import rrf
from lexical import BM25Index, weighted_bm25
from search import VectorTable, exact_topk

current = [p for p in data.guidance_passages() if p["status"] == "current"]
table = VectorTable.build("guidance_passages", current, "passage_id", "text", TOY_A1)
bm25 = BM25Index.build([p["passage_id"] for p in current], [p["text"] for p in current])


def short(pid):
    return pid.replace("GD-2026.2-", "")


for query in ["R-SPRK-01", "roof replaced recently but aerial imagery shows an older roof"]:
    lexical = [pid for pid, _ in bm25.search(query)]                          # every row with score > 0
    dense = [h["id"] for h in exact_topk(table, TOY_A1.encode_query(query), 50).hits]
    print(f"query: {query!r}")
    print("  BM25 order :", [short(p) for p in lexical[:5]], f"({len(lexical)} rows scored > 0)")
    print("  dense order:", [short(p) for p in dense[:5]])
    for k in (60, 2):
        fused = rrf({"bm25": lexical, "dense": dense}, k=k)
        print(f"  RRF k={k}:")
        for pos, f in enumerate(fused[:3], start=1):
            r = f["ranks"]
            print(f"    {pos}. {short(f['id']):12} bm25 rank {r['bm25']}, dense rank {r['dense']}, score {f['score']:.6f}")
    print()

print("field weighting, query 'roof inspection':")
for weights in ({"text": 1}, {"title": 3, "text": 1}):
    top = weighted_bm25("roof inspection", current, "passage_id", weights, k=3)
    print(f"  {weights}: " + ", ".join(f"{short(p)} {s:.3f}" for p, s in top))
query: 'R-SPRK-01'
  BM25 order : ['R-SPRK-01', 'R-HUMAN-01', 'R-ROOF-01', 'R-ROOF-02', 'R-ROOF-03'] (5 rows scored > 0)
  dense order: ['GD-NOTE-02', 'R-ROOF-01', 'GD-NOTE-08', 'GD-NOTE-01', 'R-SPRK-01']
  RRF k=60:
    1. R-ROOF-01    bm25 rank 3, dense rank 2, score 0.032002
    2. R-SPRK-01    bm25 rank 1, dense rank 5, score 0.031778
    3. R-HUMAN-01   bm25 rank 2, dense rank 8, score 0.030835
  RRF k=2:
    1. R-SPRK-01    bm25 rank 1, dense rank 5, score 0.476190
    2. R-ROOF-01    bm25 rank 3, dense rank 2, score 0.450000
    3. R-HUMAN-01   bm25 rank 2, dense rank 8, score 0.350000

query: 'roof replaced recently but aerial imagery shows an older roof'
  BM25 order : ['GD-NOTE-01', 'R-ROOF-01', 'R-ROOF-02', 'R-ROOF-03', 'GD-NOTE-06'] (7 rows scored > 0)
  dense order: ['GD-NOTE-01', 'R-ROOF-03', 'R-ROOF-02', 'R-ROOF-01', 'GD-NOTE-06']
  RRF k=60:
    1. GD-NOTE-01   bm25 rank 1, dense rank 1, score 0.032787
    2. R-ROOF-01    bm25 rank 2, dense rank 4, score 0.031754
    3. R-ROOF-03    bm25 rank 4, dense rank 2, score 0.031754

field weighting, query 'roof inspection':
  {'text': 1}: R-ROOF-02 2.285, GD-NOTE-01 2.184, R-ROOF-03 1.727
  {'title': 3, 'text': 1}: GD-NOTE-01 12.182, R-ROOF-02 5.244, R-ROOF-03 4.686

Read the UW-R01 block. Fusion lifts R-ROOF-03 from BM25 rank 4 to rank 3, tied with R-ROOF-01 at 0.031754 (ties break by id). Both rules are in the top three, and the inspection-report note that both lists put first stays first. Neither single list put both roof rules that high. In both cases the passage the question needs ends inside the top three, where each single method had lost it in one of the two cases. That is the practical promise of hybrid search: not a perfect order, but a candidate list in which both kinds of evidence survive to the next stage.

Common confusion. An RRF score is not a relevance probability. 0.0318 means nothing alone; it only orders rows within one query's fused list, and its maximum depends on k and on how many lists you fuse. Never threshold it as if 0.03 were "3% relevant".

The lab: exact id against a semantic description#

The lab ranks the 13 current guidance passages by BM25, by toy dense vectors or by RRF with k = 60, for a query you pick or type. Each row shows its BM25 score and rank, dense similarity and rank, and its RRF parts, with the passage the query is about highlighted. Toy encoders and synthetic data show how the mechanism works, not how good any model or product is.

The same results without JavaScript (rank of the target passage; R-... = GD-2026.2-R-...; in this example):

QueryTargetBM25 rankDense rankRRF rank
UW-R01: roof replaced recently but aerial imagery shows an older roofR-ROOF-03423
UW-R02: R-SPRK-01R-SPRK-01152
R-ROOF-03R-ROOF-03142
R-ROOF-03 roof age sources differR-ROOF-03142
large warehouse without sprinklersR-SPRK-01111
UW-R03: maximum roof age in wind zone CR-ROOF-01121

Read the RRF column. It never holds the worst of the two ranks, and it rarely holds the best. When both lists agree (the warehouse query), fusion agrees too. When one list is blind, fusion keeps the passage in the top few, where a reranker, the subject of the next page, can look at it more carefully.

Field weighting: a match in the title is worth more#

A passage has parts. A guidance rule has an id and a body; a note has a title and a body; a precedent has a decision, a rule list and a rationale. A query term that matches the title usually says more about relevance than the same term somewhere in the body. Field weighting scores each field separately and combines them with weights, so a title match counts more.

The example's lexical.weighted_bm25 builds one BM25 index per field and adds weight × score. In the output above, the query "roof inspection" with body text only ranks the rule R-ROOF-02 first (2.285), because that short rule says to request "the roof age or an inspection", narrowly ahead of GD-NOTE-01 (2.184). With the title weighted three times, the note titled "Roof inspection reports", GD-NOTE-01, moves to first with 12.182. A rule's title is its id, and the tokenizer splits R-ROOF-02 into parts that include roof, which is why the rules gain a little from the title too. Field weighting changes the lexical list before fusion; ranker weights, the optional weights argument of fusion.rrf, change how much each whole list counts during fusion. Keep the two apart when you tune.

PostgreSQL offers the same idea with setweight, which labels the entries of a tsvector with one of the letters A, B, C or D, for example title versus body; ts_rank and ts_rank_cd then weight the labels, by default {0.1, 0.2, 0.4, 1.0} for D, C, B and A, as documented on 2026-11-18. Weaviate describes its keyword side as BM25F, a field-weighted BM25. Elasticsearch's rrf retriever accepts a weight per child retriever, generally available since 9.2 as documented on 2026-11-18, and Qdrant documents weighted RRF from v1.17.0.

Hybrid search in SQL: two CTEs and a full outer join#

The fusion is small enough to write in SQL next to the data. Q7 in the example's sql/queries.sql builds two common table expressions: a lexical one ranked with PostgreSQL full-text search and a dense one ranked by cosine distance. Each carries the same filter (status = 'current' AND trusted), each assigns row_number() as the rank, and a full outer join keeps rows that appear in only one list. The query vector and the query text are bound parameters, never pasted into the SQL. One caution before reading it: ts_rank_cd is PostgreSQL's cover-density ranking, which also counts how close matching words are to each other. It is not BM25, and the PostgreSQL documentation notes that its ranking functions use no global information, while BM25 relies on corpus-wide statistics. RRF reads only the ranks, so the fusion works the same either way.

-- Q7 from examples/rag-uw/sql/queries.sql; ran unchanged on the throwaway database on 2026-11-18
PREPARE hybrid_rrf(vector, text, int) AS
  WITH lexical AS (
    SELECT passage_id, row_number() OVER (ORDER BY ts_rank_cd(body_tsv, q) DESC, passage_id) AS r
    FROM guidance_passages, plainto_tsquery('english', $2) AS q
    WHERE body_tsv @@ q AND status = 'current' AND trusted
    ORDER BY r LIMIT 50),
  dense AS (
    SELECT passage_id, row_number() OVER (ORDER BY embedding <=> $1, passage_id) AS r
    FROM guidance_passages
    WHERE status = 'current' AND trusted
    ORDER BY r LIMIT 50)
  SELECT passage_id, l.r AS lexical_rank, d.r AS dense_rank,
         round(coalesce(1.0 / (60 + l.r), 0) + coalesce(1.0 / (60 + d.r), 0), 6) AS rrf_score
  FROM lexical AS l FULL OUTER JOIN dense AS d USING (passage_id)
  ORDER BY rrf_score DESC, passage_id
  LIMIT $3;
EXECUTE hybrid_rrf(:'q_r02', :'t_r02', 5);

The recorded output (PostgreSQL 16.14, pgvector 0.8.3, from sql/OUTPUT.md; one run on one laptop, toy data; not a benchmark):

     passage_id      | lexical_rank | dense_rank | rrf_score 
---------------------+--------------+------------+-----------
 GD-2026.2-R-SPRK-01 |            1 |          5 |  0.031778
 GD-NOTE-02          |              |          1 |  0.016393
 GD-2026.2-R-ROOF-01 |              |          2 |  0.016129
 GD-NOTE-08          |              |          3 |  0.015873
 GD-NOTE-01          |              |          4 |  0.015625

R-SPRK-01 has the same score as in Python, 0.031778, and here it ranks first. The difference is the lexical leg. plainto_tsquery joins the query's terms with AND, as documented, so a passage must contain all of them, and in this run only the sprinkler rule matched: the lexical list has one row. In Python, BM25 scores any passage that shares a single token, so R-ROOF-01 entered the lexical list at rank 3 and won the fusion. Same fusion, same constant, different first-stage behavior, different winner. The lexical leg's tokenizer and match semantics are part of the hybrid design, not a detail of it.

The fused list, explained row by row#

A hybrid result can carry its own explanation. The example's rrf returns, for each row, the rank in every list and the part each list contributed; pipeline.retrieve copies the BM25 score, the dense similarity, both ranks and the RRF score into each result, and the trace records how many rows each leg returned. An underwriter who asks why R-ROOF-01 reached the context for a sprinkler question gets a factual answer: lexical rank 3 through the tokens r and 01, dense rank 2, fused score 0.032002. That answer points straight at the fix (keep identifier parts out of the BM25 tokens, or match identifiers exactly), which a single opaque score could not do.

In our insurance agent. search_guidance in the example runs this hybrid retrieval by default: both legs see only current-version passages (and, for UW-005, the submission's own broker attachments as untrusted data), and the fused list goes to the reranker. For SUB-1004, both legs place R-ROOF-01 first and R-ROOF-03 in the top three, and R-ROOF-03 is the rule the recommendation cites when it recommends escalate. The model recommends; a person decides.

How hybrid search fails#

One leg only. A dense-only tool loses identifiers (UW-R02, rank 5); a keyword-only tool loses paraphrase (UW-R01, rank 4). The check: keep both labeled kinds of query in the test set, ids and descriptions.

A filter on one leg. If the version filter sits on the dense CTE and not on the lexical one, BM25 happily ranks the superseded 2025.4 roof rule, whose text is nearly identical, and fusion carries it into the context (the stale-policy failure of UW-R03). Every filter, version and tenant alike, must appear in every leg.

Identifier tokens that match too much. Splitting R-SPRK-01 into r and 01 let a roof rule outrank the sprinkler rule. Index identifiers as whole tokens, or route identifier-shaped queries to an exact lookup.

A constant copied between products. k = 60 in the paper, in Elasticsearch's rrf retriever (rank_constant) and in Redis FT.HYBRID; k = 2 by default in Qdrant, configurable since v1.16.0; Weaviate's default fusion is relativeScoreFusion, a score blend, since v1.24; Vectara blends lexical and vector scores linearly with lexical_interpolation. All as documented on 2026-11-18; the ecosystems page has the matrix. The output above shows that k alone can flip UW-R02.

Production pitfall. A fused list hides which leg broke. If the dense leg starts returning nothing (an encoder outage, a model mismatch refused by the guard), RRF still returns the lexical list, nicely ordered, and nothing in the result looks wrong. Log each leg's row count in the trace and alert when one leg goes empty.
In a coding agent. A coding agent searching a repository meets both blind spots at once. "Where do we retry provider calls" needs dense retrieval over code and comments; RetryPolicy.maxAttempts needs an exact symbol match, which grep or search_code gives directly. A hybrid code search runs both and fuses them, and a symbol-shaped query is often better sent straight to the exact index.

What the products document#

The pgvector README, read on 2026-11-18, suggests hybrid search by combining pgvector with PostgreSQL full-text search and merging the results with reciprocal rank fusion or a cross-encoder; Q7 is that pattern. Elasticsearch documents an rrf retriever that fuses two or more child retrievers, with rank_constant 60 and rank_window_size 10 by default. OpenSearch's hybrid query (since 2.11) normalizes and combines scores in a search pipeline (min_max, l2 or z_score normalization), and a score-ranker-processor does rank-based RRF. Redis FT.HYBRID, since 8.4.0, defaults to RRF with CONSTANT 60 and WINDOW 20, with LINEAR as the alternative. Milvus merges several searches with an RRFRanker or a WeightedRanker. Pinecone documents client-side RRF over separate searches as one pattern. In frameworks, LlamaIndex's Postgres vector store documents hybrid_search=True with vector_store_query_mode="hybrid", and suggests QueryFusionRetriever with mode="relative_score". All as documented on 2026-11-18, documented shape, not run here. Read the window settings with care: rank_window_size 10 means each leg contributes only its top 10, so a row ranked 11th by one leg gets nothing from it.

A checklist for Monday#

QuestionWhy it matters
Does your test set contain identifier queries and paraphrase queries?Each single method fails one of them (UW-R02, UW-R01)
Does every filter appear in every leg?One unfiltered leg leaks stale or other-tenant rows
Do you know your fusion method and its constant?k = 60 and k = 2 order UW-R02 differently
Does the lexical tokenizer keep identifiers whole?Split parts let R-ROOF-01 outrank R-SPRK-01
Does each result carry both ranks and the fused parts?A reviewer can see why a passage was chosen
Does the trace log each leg's row count?An empty leg hides behind a normal-looking fused list
Is any threshold applied to raw RRF scores?RRF scores order rows; they do not measure relevance
Rank fusion or score blendingWhat each throws away, and when a blend is worth it

Two families compete. Rank fusion (RRF and its weighted form) reads positions only. It is robust: no calibration, no assumptions about score distributions, the same behavior when the corpus or the model changes. It also throws information away. A passage that BM25 scores 6.2 and the next one 0.9 are one rank apart, the same as two passages scored 2.33 and 2.22.

Score blending keeps that information. It normalizes each list's scores to a common range (min-max, or the z-score that OpenSearch documents) and adds them with a weight, the linear lexical_interpolation of Vectara or the relative-score fusion that is Weaviate's default since v1.24. The cost is sensitivity: min-max normalization depends on the highest and lowest score in each list, so one outlier, or a list of length one as in Q7's lexical leg, distorts every other score. A blend can beat RRF on a corpus whose score distributions are stable and well understood; it needs labeled queries to set the weight and a re-check whenever the model or corpus changes. Without labels, rank fusion is the safer default. With labels, compare both on recall@k on the evaluation page's terms.

Identifiers deserve their own pathExact lookup before fusion, and what tokenizers decide

When a query is an identifier, the most reliable retrieval is not a ranking at all. A query that matches the shape of a rule id, a submission id or an evidence id can go to an exact lookup (WHERE rule_id = $1, bound, through a btree) and the matched row can be placed first, with hybrid retrieval filling the rest of the candidates. The example's cross-encoder stand-in does a softer version of this on the next page: a bonus when an identifier in the query appears verbatim in the passage.

The tokenizer is the second decision. The example keeps r-sprk-01 whole and also emits r, sprk and 01, which lets "sprk" find the rule and lets 01 find three others. PostgreSQL's parser and plainto_tsquery behave differently, and Q7 matched only one row. Neither is wrong; each is a policy about what counts as a match, and the UW-R02 numbers show the policy changes the winner. Test the tokenizer on your identifier formats: dashes, dots, leading zeros, case, and parcel ids that mix letters and digits.

Does fusion help? Measure it per sliceThe example's metrics, and why an average can hide a loss

The example's run_demo.py evaluates the three guidance rankings on 14 labeled queries at k = 5 (synthetic labels, toy encoder; numbers in this example, saying nothing about any model): lexical recall@5 0.780, dense 0.774, hybrid 0.893; MRR lexical 0.964, dense 0.798, hybrid 0.917. Hybrid finds more of the relevant passages in the top five, while lexical places the first relevant passage higher on average. That is the trade the hand computation showed: fusion rewards agreement and can demote a single strong first place.

An average over all queries can hide a regression on one kind. Report the metrics per slice (identifier queries, paraphrase queries, queries with a version filter) and keep a few must-pass cases such as UW-R02 and UW-R01 as named tests. The mechanics of recall@k, MRR and slices are on the evaluation page.

Two legs, two places to leakTenant and version filters belong inside both queries

Hybrid search doubles the number of queries that must respect access rules. A precedent belonging to another book of business (UW-R07) must be excluded by a tenant predicate inside each leg, before each leg's top k. If one leg is a managed full-text service and the other a vector column in PostgreSQL, the two filters are written in two languages by two teams, and they drift.

Three habits hold the line. Build both legs from one filter object in code, so a new predicate reaches both. Add a test that queries as tenant A and asserts every fused row belongs to A. And never filter only after fusion: a post-filter on the fused list can remove most of the rows and starve the context, the same starvation that exact search shows for a single leg. Defense in depth against leaks is the subject of guardrails.

In one breath#

Dense retrieval connects paraphrases and blurs identifiers; sparse retrieval matches identifiers and misses paraphrase; hybrid search runs both under the same filters and fuses the two ranked lists. Reciprocal rank fusion adds 1 / (k + rank) from each list, needs no calibration, and rewards agreement, which is why R-SPRK-01 lands second at k = 60 and first at k = 2 or when the lexical leg matches only exact terms. Keep both ranks and the fused parts on every row, so the reason for each candidate is visible and each failure points at its leg.

The agent's candidate list now holds both kinds of evidence: the rule an underwriter named and the rule a paraphrase described. What it does not yet have is a careful order. RRF placed a roof rule above the sprinkler rule for a sprinkler question, and nothing in the first stage reads query and passage together. The next page, reranking, takes this fused list and scores each candidate again with more care.