RAG & retrieval Guide 21 of 25

Chunking, hybrid search, and reranking: getting retrieval right

Most wrong RAG answers are decided before the model writes a word: the passage it needed never reached it. Three plain engineering levers fix most of that, if you measure them.

  • 10 min read
  • Updated 
  • 8 sources

Key takeaways

  • Score retrieval on its own with recall@k and nDCG on labeled real questions; a fluent answer can hide the fact that the right passage was never found.
  • Chunk along document structure at a few hundred tokens and prefix each chunk with its title; a 2026 study found costly chunkers rarely beat simple baselines.
  • Vector search alone often misses exact strings such as error codes and part numbers. Run BM25 keyword search beside it and merge the lists with reciprocal rank fusion.
  • On Microsoft’s customer data, a cross-encoder reranker over a broad candidate list gave the biggest single jump; budget for its latency and use its scores as a cutoff.
  • Add model-written chunk context, query rewriting, or agentic retrieval only when your own eval shows they beat the cheap baseline.
On this page 5 sections

When a retrieval-augmented generation (RAG) assistant answers wrongly, teams usually reach for a bigger model or a longer prompt. Often neither helps, because the large language model (LLM) never saw the passage that held the answer. It wrote a confident reply from whatever the search step handed over, and nothing in that reply admits the evidence was missing.

That makes retrieval the quiet failure point of most RAG systems. Three levers decide what reaches the model: how documents are cut into chunks, how candidate chunks are found, and how the shortlist is re-sorted before the model reads it. Each is cheap to get roughly right and easy to get badly wrong by trusting defaults.

This guide covers all three, the published evidence behind each as of October 2026, and the order in which to pull them. It assumes you know the basic RAG pipeline and what an embedding is.

How do you measure retrieval quality?

Score retrieval on its own, separately from the final answer. The core metric is recall@k: of the passages that answer a test question, what share appear in the top k results, averaged over the test set? When only the first few results reach the model, add nDCG@k (normalized discounted cumulative gain), which also rewards putting the best passages at the top.

Anthropic’s retrieval experiments report the mirror image: the share of relevant passages missing from the top 20 results. Counting failures is a useful habit, because failures are what users remember.

The labels are the expensive part, and models now do much of that work. In a 2025 paper, Pinterest’s search team described fine-tuning a compact multilingual model on human relevance ratings, then checking its judgments against people. The model then labeled 150,000 rows in 30 minutes on a single graphics processor.

An 8-billion-parameter Llama model was slightly more accurate but six times as costly to run, so the smaller one won. Cheap labels then let the team enlarge and stratify its query samples, cutting the smallest effect its experiments could detect from 1.3–1.5% to 0.25% or less.

A setup that works for most teams:

  1. Collect 100–300 real questions from logs or support tickets, including some the corpus cannot answer.
  2. Label the passage or passages that answer each one. A model can draft labels, but check a sample by hand.
  3. Score retrieval alone with recall@20 and nDCG@5 before reading any generated answers.
  4. Score answers separately, for correctness and for staying faithful to the retrieved text.
  5. Rerun both on every change to the parser, chunker, embedding model, or index settings.

Chunking: deciding what can be found

Chunking sets the units your search can return. An embedding squeezes a passage into one fixed-length vector, so a long passage covering several topics blurs into an average that matches none of them sharply. Microsoft’s Azure AI Search team tested this in September 2023 with OpenAI’s Ada-002 embeddings. For answers buried deep in long documents, recall@50 rose from 28.7 with one vector per document, built from its first 4,096 tokens, to 51.4 with 512-token chunks.

Bigger chunks are not safer. In the same tests, recall@50 fell steadily as chunks grew, from 42.4 at 512 tokens to 34.9 at 8,191. Boundaries mattered less than size: ending chunks at sentence breaks and overlapping neighbors by a quarter lifted recall@50 only from 40.9 to 43.9.

Defaults deserve suspicion. Chroma’s 2024 evaluation found that the choice of chunker moved recall by up to 9%. Re-created in Chroma’s tests, the default then used by OpenAI’s file search (800-token chunks with 400 tokens of overlap) landed slightly below average on recall and last on every precision and efficiency measure. Heavy overlap stores the same text twice and can put it into the prompt twice.

The best size also depends on the question. In tests NVIDIA published in June 2025 on five document collections, from earnings reports to tax consulting reports, short factual questions did best with 256–512-token chunks. Analytical questions favored 1,024 tokens or whole pages. Splitting by page gave the best average answer accuracy across the five, 0.648, but only narrowly: the best fixed token size reached 0.645.

Do clever chunkers pay off?

Mostly not, on current evidence. A University of Passau study by Caspari and colleagues, which its authors say was accepted for the November 2026 Conference on Information and Knowledge Management (CIKM), put this to the test. It compared eight chunking methods with three embedding models on two public corpora scaled to millions of documents. Its verdict: “computationally expensive methods rarely provide consistent gains over simpler chunking.”

Semantic, late, and summary-only chunking seldom significantly beat plain token or sentence windows. The main exception, prefixing a model-written document summary, often helped ranking but rarely beat a plain document-title prefix, a cheap tweak that held up across many settings.

Contextual chunks: when they earn their cost

Titles help because chunks lose their surroundings: a passage saying the refund window is 60 days is hard to retrieve if nothing in it names the product or the region. Anthropic’s Contextual Retrieval has a model write 50–100 tokens situating each chunk within its document, then prepends that note before indexing. In its September 2024 tests, top-20 failures fell by 35%, and by 49% once keyword search over the enriched chunks was added too. By Anthropic’s estimate, prompt caching held the one-off cost to $1.02 per million document tokens.

The CIKM study is more skeptical. With dense search alone, model-written context rarely beat simpler baselines by a significant margin. The authors also priced contextualizing a 10,000-document corpus at $9.60–$14.73 through third-party model providers.

The setups differ enough for both results to stand. Anthropic averaged across four kinds of material, from codebases to fiction, and its headline figures used Google’s Gemini embeddings. The 2026 study used small open embedding models and public corpora of up to millions of documents. The practical reading: add free context such as title and section path first, and pay for model-written context only if your eval shows chunks full of the company and this policy.

Why hybrid search beats vector search alone

Dense embeddings match meaning, so a question about resetting a login can find a page titled Password recovery. They are weak at exact strings: part numbers, error codes, names, and internal acronyms the embedding model never learned. Anthropic’s illustration is a support query for one specific error code, where embeddings may surface pages about error codes in general and miss the one that names it.

Keyword search fills that gap. BM25 (Best Matching 25) is the long-standing standard for keyword ranking; Azure AI Search’s keyword mode, for one, scores with it. It scores a passage on how often the query’s terms appear, how rare those terms are across the collection, and the passage’s length, with diminishing credit for repeats. Running it beside vector search and merging the two result lists is called hybrid search.

Microsoft’s 2023 numbers show both the payoff and the catch. Scores below are nDCG@3 on four customer datasets (higher is better), with Ada-002 vectors over 512-token chunks. Relevance was graded by an LLM prompt that Microsoft had checked against human labels.

Query typeKeyword (BM25)VectorHybridHybrid + reranker
All customer queries40.643.848.460.1
Keyword-style queries79.211.761.066.9
Fact-seeking queries37.849.049.163.4
Little word overlap with the document23.036.135.949.1
Misspelled queries28.839.140.654.6

Two lessons stand out. Vector search alone collapses on keyword-style queries, scoring 11.7 against BM25’s 79.2, and terse keyword queries are exactly what people type into internal tools. Hybrid is not free either: on those same queries, fusion pulled the score well below keyword search alone, and reranking won back only part of the loss.

Merging lists with reciprocal rank fusion

You cannot simply add a BM25 score to a cosine similarity, because they sit on different scales that shift from query to query. Reciprocal rank fusion (RRF), from a 2009 paper by Cormack, Clarke, and Büttcher, uses positions instead: a document scores the sum of 1/(k + rank) across the lists that contain it. The authors fixed k at 60 after a pilot run, noted that the exact value mattered little, and found the fused ranking almost always beat the best single input. Azure AI Search used RRF to produce the hybrid results above.

def reciprocal_rank_fusion(rankings, k=60, top_n=100):
    """Merge ranked lists of chunk IDs, best first,
    such as BM25 and vector results."""
    scores = {}
    for ranking in rankings:
        for rank, chunk_id in enumerate(ranking, start=1):
            prev = scores.get(chunk_id, 0.0)
            scores[chunk_id] = prev + 1.0 / (k + rank)
    ranked = sorted(scores, key=scores.get, reverse=True)
    return ranked[:top_n]

The constant k flattens the reward for position. With k at 60, rank 1 earns about 0.016 and rank 10 about 0.014, so a chunk that both retrievers place fifth outscores one that only a single retriever ranks first. That consensus effect helps on average, but it can also bury a perfect keyword match, a plausible reason hybrid trailed keyword search in Microsoft’s keyword-query row. Weighting the lists, or routing obvious identifier lookups straight to keyword search, are fixes worth testing.

Filters deserve the same attention as fusion. Restricting the search by product, region, date, or permission before ranking removes whole classes of wrong answers without any model at all.

Reranking: spending compute where it counts

First-stage retrievers are fast because the heavy work happens before any query arrives: passages are embedded or indexed once, and each query needs only a cheap lookup. A reranker, usually a cross-encoder, reads the query and one candidate together as a single input, so every word of the question can be weighed against every word of the passage. That is generally much more accurate, and much more expensive, because the model runs once per candidate at query time. So you retrieve broadly, then rerank a shortlist.

The published gains are large, with a caveat. Adding Microsoft’s transformer-based semantic ranker lifted nDCG@3 on its customer data from 48.4 to 60.1, the biggest single step in that column. On a suite of public academic benchmarks, though, the same step moved nDCG@10 only from 48.4 to 50.0, so measure on your own questions.

Anthropic retrieved 150 candidates, reranked them with Cohere’s model, and kept 20. With contextual chunks and hybrid search also in place, top-20 failures fell from 5.7% to 1.9%. Handing the model 20 chunks also beat handing it 5 or 10.

Reranker scores double as a quality gate. Microsoft calibrates its ranker to a 0–4 scale that means the same thing across queries and indexes. A weak top score can then trigger a plain not-found reply instead of an answer built on thin evidence. With other rerankers, pick the cutoff empirically from your eval set.

The cost is latency, and at high traffic it can be prohibitive. In a 2024 paper, Pinterest reported that an LLM-based cross-encoder was too slow and costly for live search, so it used that model as a teacher instead. The teacher labeled more than 100 times as much data as people had, and a lightweight production model learned from those labels. The deployed system raised search relevance (nDCG@20) by 2.18% and search fulfillment by more than 1.5%.

What this means for your team

Pull the levers in order of cost, and let your eval decide whether each one stays.

  1. Check that you need retrieval at all. If the whole corpus fits comfortably in the context window and everyone may see all of it, full context with prompt caching may beat a pipeline.
  2. Build the retrieval eval first. Use real questions with labeled passages, scored on recall@20 and nDCG@5.
  3. Fix parsing and structure. Keep tables whole and headings attached, and prefix every chunk with its document title and section path.
  4. Start with simple chunks. Split near 512 tokens on sentence or heading boundaries with light overlap, then test one smaller and one larger size against your real query mix.
  5. Add BM25 beside vectors and fuse with RRF, or use your search engine’s native hybrid mode if it has one.
  6. Add a reranker over the top 50–150 candidates, pass the best 5–20 to the model, and watch tail latency.
  7. Only then experiment with model-written chunk context, query rewriting, agentic retrieval, or, when answers depend on relationships across documents, a knowledge graph. Keep each only if it beats the cheap baseline on your set.

Pitfalls that recur:

  • Judging retrieval by the final answer. A strong model can paper over weak retrieval on easy questions, then fail badly on hard ones.
  • Forgetting re-index cost. Changing the chunker or embedding model means re-embedding everything, and the CIKM authors warn that costly chunking can make re-indexing impractical on large or fast-changing corpora.
  • Putting permissions in the prompt. Access rules belong on every chunk as metadata, enforced as a filter before ranking, never as an instruction to the model.
  • Freezing the test set. Refresh it from production logs every few months, because new products and policies bring new questions.

Retrieval quality lives in parsers, index settings, fusion constants, and a spreadsheet of labeled questions, and much of a RAG system’s accuracy is decided there. When an assistant keeps citing the wrong passages, SurgeX Labs starts by measuring recall on that spreadsheet, before anyone touches the prompt.

Sources

  1. Introducing Contextual Retrieval (opens in new tab) — Anthropic Engineering, 2024 anthropic.com

  2. Evaluating Chunking Strategies for Retrieval (opens in new tab) — Chroma, 2024 trychroma.com

  3. When Is Complex Chunking Worth It? A Multi-Objective Evaluation of Chunking Methods at Scale (opens in new tab) — University of Passau and Interdisciplinary Transformation University (arXiv), 2026 arxiv.org

  4. Finding the Best Chunking Strategy for Accurate AI Responses (opens in new tab) — NVIDIA Technical Blog, 2025 developer.nvidia.com

  5. Azure AI Search: Outperforming vector search with hybrid retrieval and reranking (opens in new tab) — Microsoft Azure AI Search (Tech Community blog), 2023 techcommunity.microsoft.com

  6. Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods (opens in new tab) — University of Waterloo and Google (SIGIR 2009), 2009 cormack.uwaterloo.ca

  7. Improving Pinterest Search Relevance Using Large Language Models (opens in new tab) — Pinterest (arXiv), 2024 arxiv.org

  8. LLM-based Relevance Assessment for Web-Scale Search Evaluation at Pinterest (opens in new tab) — Pinterest (arXiv), 2025 arxiv.org

Where this shows up in our work

Building this? Talk to an engineer.

If this guide maps to a system you’re planning, send a short brief. A senior engineer replies within one business day.