post: How Fusion Weights Affect Hybrid Search_□×

How Fusion Weights Affect Hybrid Search

I’ve been working with Claude on search for one of my documentation sites and asking it to look for improvements. Hybrid search and fusion weighting came up, and I wanted to understand them better, so I asked for a blog post explaining them.

The work has two goals: keep useful results available when embeddings fail, and improve which articles search puts first. I haven’t fully tested how well it’s working. Writing through the pieces is part of figuring out what to check.

This hybrid search runs keyword and vector searches for the same query and merges the results.

Keyword search matches words. A full-text index like SQLite FTS5 scores documents with bm25, which considers how rare query terms are, how often they occur in a document, and document length. It’s useful for exact identifiers such as includeSubDomains.

Vector search uses embeddings, numerical representations of the query and documents, to find similar content. It can connect “how do I stop my page layout from jumping while it loads” with an article about Cumulative Layout Shift, even though the question never says “layout shift.”

The methods can complement each other. Keyword search can miss paraphrases. Vector search can drift toward something topically similar when you wanted one exact term.

The keyword path also gives this implementation a fallback. If generating the query embedding fails or times out, search can return available keyword results. If neither path is available, it still returns an error. Combining two search methods doesn’t provide that behavior automatically; the failure handling has to be implemented too.

Fusion

Once you have two ranked lists, you need one list to show the user. That merge step is fusion.

Comparing raw scores directly doesn’t work well. A bm25 score and a cosine distance sit on different scales. Reciprocal rank fusion (RRF) avoids having to align those scales by using positions in the ranked lists. This implementation uses weighted RRF:

score(doc) = sum over lists of  weight / (k + rank)

A document at rank 1 earns more than one at rank 10 within the same list, and a document both searches found earns points from each list. k is a damping constant. The original RRF paper used 60, as does this implementation. The per-list weights extend the original formula, which treats each list equally.

Fusion weights

The weights decide how much each list’s points count.

The current configuration gives vector results a weight of 1.0 and keyword results 0.8. Imagine two articles competing for first place:

  • Article A is #1 in keyword search and #3 in vector search.
  • Article B is #1 in vector search and #3 in keyword search.

With k = 60, A scores 0.8/61 + 1.0/63 ≈ 0.02899. B scores 1.0/61 + 0.8/63 ≈ 0.02909. B wins by a hair, purely because vector points count more.

The weights put B first. Whether that improves the result depends on which article better answers this query. Even a search method that performs better overall can get an individual query wrong.

With equal weights, mirrored cases like A and B tie exactly. This implementation breaks exact ties by article ID. That makes the order predictable, but doesn’t tell us which article is more relevant. A tie alone isn’t a reason to favor vector search.

Measuring instead of guessing

A starting weight is a guess until you test it. The project now has a saved offline evaluation with 40 queries, each mapped to relevant articles. Ten are exact identifiers and thirty are plain-English questions. It builds keyword rankings locally and replays recorded vector rankings, so it doesn’t measure how production search is behaving today.

Mean reciprocal rank at ten (MRR@10) averages 1 divided by the position of the first relevant result within the top ten. A query with no relevant result there contributes zero. A score of 1.0 means every query had a relevant article in first place.

Retriever MRR@10
keyword 0.912
vector 0.741
hybrid 0.907

Keyword search scored highest on this query set. Hybrid came out slightly behind it, but that comparison doesn’t establish that the weights caused the difference. We’d need to compare weight settings while keeping the other inputs fixed.

The saved evaluation also reports recall: how much of the known relevant material appears in the results. Hybrid’s recall at ten was 0.954, compared with keyword’s 0.950. That’s a small gain in this evaluation, alongside slightly lower MRR. It isn’t enough to claim that hybrid search is better for readers overall.

These results give me something to investigate. They don’t confirm that the production index is current or that live queries behave like the saved examples.

Add the check with the feature

If you add hybrid search, add a relevance check alongside it. A few dozen realistic queries with expected answers can show whether a change to the weights, the chunking, or the query parsing improves those cases. They also give you a repeatable check to run in CI.

Forty queries is a small set, so I’d pick a simple, explainable weight change over whichever one squeezes out the highest number. I still need to try the search more fully. The fallback behavior and the ranking results are separate things to check: returning something during an embedding outage is useful, but it doesn’t establish that the first article is the right one.

Sources

I’d appreciate a follow. You can subscribe with your email below. The emails go out once a week, or you can find me on Mastodon at @[email protected].

START
llbbl.exeprojects/posts/experiments/subscribe.dlg
© 2026v1.0.0