New Tool Radar

AI Concepts

How to Add a Reranking Step After Retrieval So the Best Chunks Reach the Model First

Retrieve a wide first set, score each candidate against the query with a reranker, and pass only the top few to the model.

Schematic with three steps: Retrieve wide, then rerank narrow; Measure the change on the test set; Tune the two numbers together.

Vector search compresses each document into a single vector, which loses information, so the top few results can miss the most relevant chunk. A reranker is a cross-encoder that takes the query and one document together and outputs a relevance score, which is much more accurate but much slower. The two-stage pattern fixes this: retrieve a wide first set with fast vector search, then rerank that small set and pass only the best chunks to the model.

What you need

  • A retriever that can return a wide first set, for example the top 50 results
  • A reranking model or API, such as a cross-encoder
  • A labelled test set to measure the change

Step 1: Retrieve wide, then rerank narrow

Fetch the top 50 candidates with vector search, then pass the query and each candidate to the reranker and sort by its relevance score. Keep only the top 5 to 10 for the model.

Step 2: Measure the change on the test set

Compare top-10 recall before and after reranking. In Anthropic contextual retrieval experiments, adding a reranking step cut the top-20 retrieval failure rate from 5.7% to 1.9% when combined with contextual retrieval, a 67% reduction.

Step 3: Tune the two numbers together

Try different first-stage and final counts, for example 50 to 5, or 150 to 20. Reranking more candidates costs more latency, so find the smallest first-stage set that still contains the right chunk.

Worked example: synthetic reranking on 4 questions

The table below is a synthetic example. It shows the expected result of adding a reranking step; no pipeline was run.

Question Top result before rerank Top result after rerank
Refund window Shipping policy Refund policy
Setup steps General FAQ Setup guide
Pricing tiers Pricing page Pricing page
Support hours Contact page Support hours page

Expected result (UNTESTED). reranking puts the right chunk first on 3 of 4 questions where vector search alone did not. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Rerankers are slow: scoring a whole collection with one would take hours, which is why retrieval runs first.
  • A reranker can only reorder what the first stage retrieved; if the right chunk is outside the first set, reranking cannot find it.
  • Reranking adds latency at query time, so budget for it in the response time.
  • A reranker scores query and document together, so it cannot be precomputed the way embeddings can.

Sources

See all