A re-ranker is a second-stage scorer. It takes the retriever's top-k candidates, re-scores each one against the query with higher precision, and puts the best passages first before they reach the context window.

Re-rankingDiagram with these labels, in reading order: retrieves; feeds; outputs; selects; First-stage; retrieval; Top-k; candidates; Cross-encoder; re-ranker; Relevance; scores; Top results; for context.retrievesfeedsoutputsselectsFirst-stageretrievalTop-kcandidatesCross-encoderre-rankerRelevancescoresTop resultsfor context
Re-ranking process overview

Two-stage retrieval with a cross-encoder

The first stage is a vector or hybrid retriever. It commonly returns 50 to 100 candidate passages quickly, using precomputed vector similarity. That speed has a cost in precision, because the query and each passage were embedded separately.

The second stage is a cross-encoder re-ranker, such as Cohere Rerank or bge-reranker. It feeds the query and one candidate passage into a neural network together and outputs a relevance score. Because the model sees both texts at once, attention can link terms in the query to terms in the passage.

  1. Retrieve the top-k candidates with the fast retriever.
  2. Score each candidate with the cross-encoder.
  3. Keep the top 5 to 10 passages for the final model.

Take a query about climate change impacts on agriculture. A cross-encoder can judge how well a passage addresses that specific angle, using terminology and context that a single-vector comparison may miss.

Why widening top-k does not replace re-ranking

The obvious shortcut is to raise top-k and put 50 chunks in the prompt. This dilutes the context. Near-misses add noise, and the final model can give a confused or incomplete answer. The bi-encoder scores used for retrieval are approximate, so they can rank a near-miss above the best passage.

Running a cross-encoder over the whole corpus would be accurate but is too expensive. Applying it to a shortlist keeps the cost bounded. A database query plan is a fair comparison: a coarse index scan followed by a costlier filter, except that the second step is a neural relevance score instead of a boolean predicate.

When the latency of a re-ranker is worth it

  • Add it when precision at the top, such as precision@5, matters and first-stage results contain irrelevant passages.
  • Skip it when latency is the main constraint or the retriever already returns clean results.
  • Skip it on a small corpus, where the added step buys little.
Precision against latency Re-ranking improves precision and adds latency. Decide from how much the final answer depends on the top few passages.

When it fits, the payoff is denser context in fewer tokens. In many pipelines it is a large quality gain once chunking is sound.

Diagnosing a re-ranker accuracy drop

Example scenario: re-ranker accuracy falls from 85% to 65%. These figures are illustrative.

Re-rankingDiagram with these labels, in reading order: Evaluate retrieval results; Assess scoring algorithm; Fix retrieval issues; Adjust model parameters; Investigate query characteristics; Re-rank accuracy drop; Check retrieval quality; Evaluate scoring model; Analyze query diversity; Improve retriever; Fine-tune scoring weights.Evaluate retrieval resultsAssess scoring algorithmFix retrieval issuesAdjust model parametersInvestigate query characteristicsRe-rank accuracy dropCheck retrieval qualityEvaluate scoring modelAnalyze query diversityImprove retrieverFine-tune scoring weights
Debugging re-ranking failure

A likely cause is a misconfigured re-ranker or a bug in the scoring logic, which stops it from separating relevant from irrelevant passages. Training data that no longer matches the queries is another candidate.

  • Check the model's configuration for discrepancies.
  • Log the scores given to the retriever's top-k candidates and compare them with expected scores.
  • A/B test on a small set of queries to isolate the change.

Recalibrating means updating the training data and retuning the model, at the cost of more training time and compute. Track precision and recall of the re-ranked output afterwards.

Back to the knowledge baseRequest an assessment