Kolkata ·  
AI engineering
retrieval
deep · 5 min

Hybrid search

Running keyword search and vector search on the same query and merging the two ranked lists.

updated 27 Sept 2026

Here are two real queries from a public product-search test set. Which kind of search would you trust with them?

The first is "french molding". Keyword search matched "french" and "mold" and put a french bread mold at the top. Vector search returned a decorative rosette applique, which is the kind of thing the person wanted.

The second is "bathroom vanity knobs". Vector search got the topic and returned a whole bathroom vanity set. Keyword search matched "knobs" and returned a knob. Right answer.

So each one wins once and loses once. And neither failure would show up in our logs, because both return something plausible.

Why they miss different things

BM25 scores documents on the exact words they share with the query, with rare words counting more. That makes it precise: a part number, an error code or a name matches only itself. But it has no idea what words mean. If the query and the right document say the same thing in different words, it misses.

Semantic search turns query and documents into embeddings and finds the nearest. It catches paraphrases. But an exact string can lose its pull among lots of documents on the same topic. Paste a part number into the query and you can get pages about the right subject, minus the one with that number.

Since they fail on different queries, the obvious move is to run both and merge. That's hybrid search.

One thing to hold on to: fusion only reorders. It works on what the two lists returned, so a document neither search found can't appear. If the right answer is at position 250 in both and we took 100 from each, no merge will find it.

Why not just add the scores?

That's the first thing everyone tries. Add each document's two scores, done. Let's see what happens with four documents:

doc1doc2doc3doc4
Vector score0.3470.3500.3480.346
BM25 score1001.510.5

Add them and BM25 decides everything, because the vector scores barely differ. Vector similarity is bounded (cosine can't go above 1), but BM25 has no fixed range. Its size depends on how many query words matched and how rare they were, so it changes from query to query. On another query the BM25 scores might be 0.63, 0.01, 0.3 and 0.4, the same scale as the vectors. A fixed weight that balances one query lets BM25 drown out the other.

So we need a smarter merge. There are three common ones.

Use ranks instead of scores. Reciprocal rank fusion (RRF) ignores the scores and gives each document points for its position in each list, roughly one over its rank. First place in either list is worth the same. No scaling, no tuning, which is why it's the usual starting point. The cost is that it throws away the size of gaps. doc1's BM25 score is 67 times doc2's, but RRF only sees "first" and "second", and ends up ranking doc2 above doc1.

Rescale, then weight. Squash each list's scores into 0 to 1 for this query (top becomes 1, bottom 0), then take a weighted sum:

score=α⋅vector+(1−α)⋅keyword\text{score} = \alpha \cdot \text{vector} + (1 - \alpha) \cdot \text{keyword}

α\alpha is a knob between 0 and 1. Now doc1's big lead survives.

Rescale by the spread. Distribution-based score fusion (DBSF) rescales each list using its average and how spread out the scores are, then adds them. It keeps the size of a lead too, with no knob to set.

Keeping the gaps is good when a big lead means something. It's bad when one odd score is noise, because now the noise moves the result.

Does it help?

Mostly. One careful test ran keyword only, vector only and hybrid with default RRF on five public datasets, using a small open embedding model, and scored the top 10. Keyword search won two of the datasets and vector search won the other three, so neither is always better. Here's how much hybrid gained over whichever single search did best:

Modest gains on four of the five, and a small loss on the fifth. You can't tell in advance from the queries which kind of workload you have. The second search was cheap, adding 0.6 to 1.5 ms of median latency in their setup, but it does need a second index.

Which merge is best is less settled. In the same test, DBSF beat default RRF on three datasets, with the other two too close to call. A 2023 study found a tuned weighted sum beat RRF on every dataset it tried, and that a handful of labelled queries was enough to tune α\alpha. Weaviate switched its default from rank fusion to score fusion after an internal test on one dataset showed about 6% better recall.

Those look like they disagree, but they're answering different questions. With no labelled queries, RRF at its default works well and can't be thrown by weird scores. With labels, a tuned weighted sum usually wins. (RRF has its own knob too, and it matters more than people assumed, but a tuned RRF carries over badly to new data.) So "start with RRF" and "weighted sum beats RRF" are both right, at different stages.

Two traps

On Postgres, the keyword half may not be BM25 at all. The built-in ts_rank has no IDF, no saturation and no length discount, and its @@ match drops any page missing a query word. For real BM25 next to pgvector, you need an extension like pg_textsearch or ParadeDB's pg_search.

And the line between the two is blurring. Learned sparse models like SPLADE add related words a document never used, so the "keyword" side starts catching synonyms. Start with BM25 anyway, since it needs no model at query time, and make any learned model beat it on your data first.

So where does that leave us with "french molding" and "bathroom vanity knobs"? Run both searches, merge with RRF, and measure keyword only, vector only and hybrid on your own labelled queries (retrieval evaluation). Keep hybrid if it wins, which it usually will. And once the right document is somewhere in the top 100, putting it at the very top is a job for reranking.

Further reading