# Reranking in RAG: cross-encoders, LLM rerankers and when to skip it

> Reranking rescores the top results of a first-stage retriever with a slower, more accurate model. How it works, how many candidates to rerank and when to skip it.

Source: https://www.honeyhive.ai/learn/reranking (updated 2026-11-17)

Reranking is a second scoring pass in a retrieval pipeline. A fast first stage (vector search, keyword search or both) pulls a few dozen to a few hundred candidates, and a slower, more accurate model rescores them against the query. Only the top few go into the prompt. In a RAG system it sits between retrieval and generation, as the optional step in a [RAG pipeline](/learn/rag-pipeline).

## Why a second stage helps

Pinecone [explains](https://www.pinecone.io/learn/series/rag/rerankers/) that a bi-encoder compresses a document into one vector before it ever sees the query, and that compression loses information. A reranker reads the query and the raw document together, so it can judge the pair directly.

The second reason is the LLM side. Pinecone [notes](https://www.pinecone.io/learn/series/rag/rerankers/) that LLM recall degrades as more tokens go into the context window, so the useful pattern is to retrieve widely for recall and then pass only a few reranked chunks. Liu and colleagues [found](https://arxiv.org/abs/2307.03172) that model performance is often highest when relevant information sits at the beginning or end of the input and drops when it is in the middle. Putting the best chunks first and cutting the rest is the cheapest fix. See [context rot](/learn/context-rot) for the wider effect.

Pinecone's walkthrough [retrieved 25 chunks and reranked to 3](https://www.pinecone.io/learn/series/rag/rerankers/), and the final three included chunks that had sat at original positions 23 and 14.

## Reranker types

| Type | How it scores | Cost profile | Sources |
|---|---|---|---|
| Cross-encoder | Query and document go through one transformer together and return a score | One model pass per candidate, no precomputation | [Sentence Transformers](https://sbert.net/examples/cross_encoder/applications/README.html) |
| Hosted rerank API | Same idea behind an endpoint that takes a query and documents | Billed per [search unit](https://cohere.com/pricing) (one query with up to 100 documents), no model to host | [Cohere docs](https://docs.cohere.com/docs/rerank) |
| LLM reranker | A prompted LLM orders the candidates | Accurate but can be slow and expensive | [Sun and colleagues](https://arxiv.org/abs/2304.09542), [Meilisearch](https://www.meilisearch.com/blog/rag-reranking) |

Cross-encoders for ranking are old news. Nogueira and Cho [reported](https://arxiv.org/abs/1901.04085) in January 2019 that a BERT reranker topped the MS MARCO passage leaderboard with a 27% relative gain in MRR@10 over the previous best. The newer question is whether a general LLM can do the job. Sun and colleagues [introduced](https://arxiv.org/abs/2304.09542) a new test set, NovelEval, to check that LLM rankers were not just remembering benchmark data, and [distilled](https://arxiv.org/abs/2304.09542) ChatGPT's ranking behavior into a 440M model that beat a 3B supervised model on BEIR.

Meilisearch [suggests](https://www.meilisearch.com/blog/rag-reranking) an LLM reranker when accuracy is the main goal and standard rerankers give low precision, with the caveat that it can be slow and expensive.

## How many candidates to rerank

Two numbers matter: how many candidates the first stage returns, and how many chunks survive.

- Sentence Transformers' example [retrieves the top 100](https://sbert.net/examples/cross_encoder/applications/README.html) with a bi-encoder and scores every (query, hit) pair with the cross-encoder.
- Anthropic's [setup](https://www.anthropic.com/news/contextual-retrieval) retrieved 150 and kept 20. Of 5, 10 and 20 chunks passed to the model, 20 did best, though the authors warn that extra information can distract the model.
- Pinecone's example went from 25 to 3.

Anthropic [calls it](https://www.anthropic.com/news/contextual-retrieval) an inherent trade-off: reranking more chunks can improve results but raises cost and latency, and reranking fewer does the opposite. Its advice is to experiment on your own use case.

Context length also limits the reranker. Cohere's docs [say](https://docs.cohere.com/docs/rerank) the query and document tokens count together against the model's context length, and an over-long document is chunked and processed in several inferences. A [chunking strategy](/learn/chunking-strategies) that keeps chunks well under that limit avoids the surprise.

## What reranking buys

In Anthropic's tests, across codebases, fiction, arXiv papers and science papers, the top-20 retrieval failure rate started at 5.7%. Contextual embeddings plus contextual BM25 [reduced it](https://www.anthropic.com/news/contextual-retrieval) by 49%, and adding a reranker took the cut to 67%, or 1.9%. These are one team's datasets with the Cohere reranker, so treat them as an example of the size of the effect, not a promise. For the first stage that feeds the reranker, see [hybrid search](/learn/hybrid-search) and [embedding models](/learn/embedding-models).

## When to skip it

Meilisearch [lists](https://www.meilisearch.com/blog/rag-reranking) four cases where reranking is unnecessary: simple datasets, short documents, low-stakes use cases and latency-sensitive applications. Its reasoning for simple datasets is that the retrieval pool has too little noise to justify a second scoring pass.

Cost is the other reason. Pinecone [estimates](https://www.pinecone.io/learn/series/rag/rerankers/) that a small BERT reranker on a V100 GPU over 40 million records would need more than 50 hours for one query, which is why a reranker only ever sees the short list from a first stage. The Sentence Transformers docs [make the same point](https://sbert.net/examples/cross_encoder/applications/README.html): cross-encoders do not scale well to large datasets.

## How to measure it

Measure the retriever with and without the reranker on the same labeled questions.

- Precision@k and recall@k show whether the right chunks reach the top. Meilisearch [also lists](https://www.meilisearch.com/blog/rag-reranking) MRR, which asks where the first relevant document appears.
- Downstream answer quality, such as accuracy and hallucination rate, shows whether the better ranking changes the answer. Meilisearch [recommends](https://www.meilisearch.com/blog/rag-reranking) measuring it too.
- Latency and cost per query belong in the same table, since the reranker adds both.

[Context precision and recall](/learn/context-precision-and-recall) and [RAG evaluation](/learn/rag-evaluation) cover the metrics in detail.

## Testing a reranker in HoneyHive

HoneyHive [experiments](https://docs.honeyhive.ai/v2/evaluation/introduction.md) run a dataset through a function, so you can run the same questions through the pipeline with the reranker on and off and compare the runs. A [Python evaluator](https://docs.honeyhive.ai/v2/evaluators/python.md) can score whether the known-relevant chunk appears in the top k.

## FAQ

### What is reranking in RAG?

A second scoring pass over retrieved candidates. Cohere's [docs](https://docs.cohere.com/docs/rerank) describe rerank models as sorting text inputs by semantic relevance to a query, often to reorder results from an existing search system. Only the top few reranked chunks go to the LLM.

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

A bi-encoder embeds each text separately, so document vectors can be indexed ahead of time. A cross-encoder passes the query and a document through the transformer together and outputs a relevance score, per the [Sentence Transformers docs](https://sbert.net/examples/cross_encoder/applications/README.html). It is more accurate but cannot be precomputed.

### How many documents should I rerank?

There is no universal number. Anthropic's [tests](https://www.anthropic.com/news/contextual-retrieval) retrieved 150 candidates and kept the top 20, and found 20 chunks beat 5 or 10, while noting that more reranked chunks cost more latency. Try a few values on your own data.

### Does reranking add latency?

Yes. A reranker scores each candidate individually, so cost grows with the candidate count. Anthropic [describes](https://www.anthropic.com/news/contextual-retrieval) a small added latency and an inherent trade-off between reranking more chunks and speed.

### Can an LLM be a reranker?

Yes. Sun and colleagues [reported](https://arxiv.org/abs/2304.09542) that properly instructed LLMs can deliver competitive, even superior results to supervised rerankers on popular retrieval benchmarks. Meilisearch [notes](https://www.meilisearch.com/blog/rag-reranking) that they can be slow and expensive.
