Blogs
Hybrid Search and Reranking: Improving Retrieval Quality

Hybrid Search and Reranking: Improving Retrieval Quality

hybrid search,reranking in RAG,reciprocal rank fusion,BM25 and vector search,cross-encoder reranker,improve RAG retrieval quality,two-stage retrieval,hybrid search for enterprise RAG

By
R&D, FDE Academy
November 21, 2026
Hybrid Search and Reranking: Improving Retrieval Quality

Summarize this article using AI

What Is Hybrid Search?

Hybrid search is a retrieval approach that combines keyword (lexical) search and vector (semantic) search in one query and merges their ranked results. In Microsoft's Azure AI Search documentation, a hybrid query is a single request that includes both search and vector query parameters, runs full-text and vector search in parallel, and merges results using Reciprocal Rank Fusion (RRF).

Keyword search matches the words in a query. Vector search converts text to embeddings and finds passages that are close in meaning. If you need a refresher on the vector side, see our guide to RAG decisions in fine-tuning vs RAG.

Why Neither Keyword nor Vector Search Is Enough

Each method fails in a predictable way

Keyword (BM25) vs Vector Search Retrieval Characteristics Matrix
Query type Keyword (BM25) Vector search
Exact code or ID ("E4021", "SKU-88421") Strong Can miss; embeddings may treat codes as noise
Rare names and acronyms Strong if the term appears Depends on the embedding model
Paraphrase ("my package is overdue") Weak if no words overlap Strong
Synonyms and vague questions Weak Strong
Negation, numbers, precise conditions Mixed Often weak

Microsoft's documentation describes the advantage of full-text search as precision, and notes that benchmark testing on real-world and benchmark datasets indicates hybrid retrieval with its semantic ranker offers significant benefits in search relevance. That is the vendor's claim, so test it on your data.

The sentence-transformers documentation makes the complementary point: semantic search overcomes the shortcomings of lexical search and can recognise synonyms and acronyms. Real enterprise queries mix both kinds, which is the argument for running both.

How Results Are Combined: Reciprocal Rank Fusion

The two retrievers return scores on different scales. BM25 scores have no fixed upper limit; cosine similarity sits between -1 and 1. Adding them directly is unreliable. Reciprocal Rank Fusion avoids the problem by using only ranks.

For each document, RRF takes its position in each result list and adds 1/(rank + k). Microsoft's documentation states that k is a constant "experimentally observed to perform best if it's set to a small value like 60." A document near the top of both lists gets the biggest combined score.

python

def rrf(ranked_lists, k=60, depth=10):

    scores = {}

    for ranking in ranked_lists:

        for rank, doc_id in enumerate(ranking[:depth], start=1):

            scores[doc_id] = scores.get(doc_id, 0) + 1 / (k + rank)

    return [d for d, _ in sorted(scores.items(), key=lambda x: -x[1])]

We ran this function with rank-bm25 for the keyword list. A document ranked first in both lists scored 2/61 = 0.03279, double the 1/61 = 0.01639 for a document ranked first in only one, as the formula predicts.

The original RRF paper (Cormack, Clarke and Büttcher, SIGIR 2009) describes RRF as unsupervised, so it needs no training examples, and reports that it consistently yields better results than any individual system it combined in the TREC experiments they ran. That is an old result on classic benchmarks, not a promise for your corpus.

Practical notes:

  • Weights. Azure AI Search lets you weight vector queries up or down in a hybrid query. Weight only after measuring.
  • Score-based fusion (normalise then add) is an alternative. It can work well but needs normalisation and tuning per dataset.
  • Depth. Fusing only the top 10 to 50 from each list is common; the best depth depends on your data.

What Is Reranking?

Reranking is a second retrieval stage that re-scores a short list of candidate passages with a more accurate but slower model, then reorders them. The sentence-transformers documentation describes the standard Retrieve & Re-Rank pattern: first-stage retrieval uses fast methods (a bi-encoder or lexical search) to fetch a larger set of potentially relevant documents, and a second stage uses a cross-encoder to score each candidate against the query for better precision.

The difference between the two model types matters:

  • Bi-encoder: encodes the query and each document separately into vectors, so document vectors can be precomputed. Fast and scalable.
  • Cross-encoder: reads the query and one document together and outputs a relevance score. More accurate for ranking but must run for every pair, so you use it only on the top candidates.

A published example pipeline retrieves the top 100 documents with a bi-encoder and reranks them with a cross-encoder to improve accuracy.

Azure AI Search offers a built-in semantic ranker that can rerank full-text and hybrid results; its score is reported separately from the search score. Whatever you use, the pattern is identical: retrieve wide, rerank narrow.

python

# Sketch only: NOT run in our environment (model download was blocked)

from sentence_transformers import CrossEncoder

ce = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")

pairs = [(query, doc_text[d]) for d in fused_candidates[:50]]

scores = ce.predict(pairs)

top5 = [d for _, d in sorted(zip(scores, fused_candidates[:50]), reverse=True)][:5]

The Full Pipeline: From Query to Prompt

A typical production flow looks like this:

  1. Understand the query. Optional rewrite, spell-fix or expansion.
  2. Apply filters. Customer, product, date, permissions. Filtering on metadata before or during retrieval prevents irrelevant or unauthorised passages.
  3. Retrieve in parallel. Keyword and vector, each returning dozens of candidates.
  4. Fuse. RRF into one list.
  5. Rerank. Cross-encoder or semantic ranker on the top candidates.
  6. Select and order. Pass a small number of passages to the LLM.
  7. Generate and cite. Show sources so users can verify.

Step 6 matters more than it looks. The "Lost in the Middle" paper found that language model performance is often highest when relevant information occurs at the beginning or end of the input context, and degrades significantly when models must use information in the middle of long contexts. Sending the best few passages, in a sensible order, beats stuffing in everything that retrieved. Data quality still caps the result; see data cleaning for AI projects and AI data pipelines for messy enterprise data for the chunking and ingestion side.

A Small Test: What Fusion Did on a Toy Corpus

We built a 20-document support corpus (error codes, delivery, billing, login) and 12 queries: 6 exact-term queries such as error codes and SKUs, and 6 paraphrases with little word overlap. As the "semantic" retriever we used latent semantic analysis (LSA: TF-IDF followed by SVD), because embedding models could not be downloaded here. LSA is not a neural embedding model, so treat it as a stand-in for a weaker semantic retriever. We measured hit@3 (a relevant document in the top 3) and MRR (mean reciprocal rank of the first relevant document

Retrieval Performance Across LSA Dimensions Matrix
System LSA with 8 dimensions: hit@3 / MRR LSA with 3 dimensions: hit@3 / MRR
BM25 1.00 / 0.92 1.00 / 0.92
LSA 1.00 / 0.92 0.92 / 0.83
RRF fusion 1.00 / 0.92 1.00 / 0.88

What this shows, and what it does not:

  • With a strong second retriever, all three tied. On this easy toy set, BM25 alone was already as good as the others.
  • With a deliberately weakened semantic retriever, fusion kept the full hit@3 (1.00) that the weak retriever alone lost, but its MRR (0.88) fell slightly below BM25's. Fusion never beat the best single retriever in our test.
  • The takeaway is robustness, not magic: fusion protects you when one method has a bad day, but it does not guarantee the best result. This is a 12-query illustration, not a benchmark. We did not test a cross-encoder reranker.

How to Evaluate Retrieval Quality

You cannot tune what you cannot measure. A simple evaluation loop:

  1. Collect real questions from the customer: support tickets, search logs, subject-matter experts. Aim for dozens to hundreds, not three.
  2. Label relevant passages for each question with a domain expert.
  3. Compute metrics: recall@k (is a relevant passage in the top k?), hit rate, and MRR.
  4. Compare variants side by side: keyword only, vector only, hybrid, hybrid plus reranker.
  5. Segment by query type: exact-code queries, paraphrases, multi-part questions. Averages hide failures.
  6. Check the end result: do answers get more accurate and better cited?

Record latency and cost beside quality; each stage adds time. For governance and review of outputs, see LLM guardrails and human-in-the-loop design and AI governance for forward deployed engineers.

Tuning Knobs That Matter

  • Candidate pool size. More candidates raise recall but cost reranking time.
  • Chunk size and overlap. Poor chunks hurt every retriever.
  • Fusion weights and depth. Change one at a time and re-measure.
  • Final top-k. Fewer, better passages usually beat more.
  • Metadata filters. Often the cheapest relevance win.

When Hybrid Search and Reranking Are Not Worth It

  • Tiny corpus. For a few hundred short documents, plain keyword or plain vector search may be enough.
  • Mostly exact lookups. If users search by ID, a keyword index may do.
  • Strict latency limits. Skip or shrink the reranker.
  • No evaluation set. Without measurement, extra complexity is a guess.

A Worked Scenario: A Support Knowledge Base

This is a hypothetical example, not a case study.

A manufacturer's support assistant answers from 30,000 articles. Users ask things like "E4021 on the dispenser" and "machine keeps stopping after startup." The first build uses vector search only. Testing on 150 real tickets shows paraphrased questions work, but queries containing error codes often pull the wrong article.

The FDE adds BM25 and fuses with RRF. Code queries improve; some long questions get worse because a noisy keyword match crowds out a good semantic one. The FDE tunes the depth, adds a metadata filter on product line and tries a reranker on the top 40 candidates. Latency rises, so the team caches common queries and ships the reranker only for the "help" flow. Each change was kept only if the labelled set improved. The lesson: fix what the evaluation shows, one step at a time.

Common Mistakes

  • Adding a reranker without a baseline. You cannot tell if it helped.
  • Adding raw BM25 and cosine scores. They are not on the same scale.
  • Reranking too many candidates. Latency balloons.
  • Evaluating on three hand-picked questions. Use real, varied queries.
  • Stuffing the prompt. Pass the best few passages.
  • Blaming the LLM before checking retrieval.

For the wider system view, see how FDEs build enterprise AI platforms, AI agent orchestration and Semantic Kernel. Projects like this are a classic reason enterprise AI adoption fails when no one measures quality, and implementing the evaluation loop calls for the Python skills for an FDE interview.

‍

Frequently Asked Questions

  • What is hybrid search in RAG?

    Hybrid search combines keyword search and vector search in one query and merges their ranked results, commonly with Reciprocal Rank Fusion. It helps catch both exact terms like codes and meaning-based paraphrases.

  • How does reciprocal rank fusion work?

    RRF scores each document as the sum of 1/(rank + k) across each result list, with k commonly set to 60. Documents ranked high in several lists rise to the top. It uses ranks, so it avoids mixing incompatible score scales.

  • Do I need a reranker for RAG?

    Not always. A reranker can improve precision on the top candidates but adds latency and cost. Test it on a labelled set of your own questions, and keep it only if the gain justifies the delay.

  • What is the difference between a bi-encoder and a cross-encoder?

    A bi-encoder embeds the query and documents separately, so it is fast and scalable. A cross-encoder reads the query and a document together, which is more accurate but slower, so it is used to rerank a short list.

  • Is hybrid search always better than vector search?

    No. It often helps when queries mix exact terms and paraphrases, but in our small test fusion matched the best single retriever and never beat it. Measure on your own data.

  • How do I measure retrieval quality?

    Build a labelled set of real questions with known relevant passages, then compute recall@k, hit rate and MRR for each variant. Segment results by query type and track latency alongside quality.

  • Background image glowing