Retrieval-augmented generation (RAG) depends on finding useful evidence before asking a language model to answer. A vector search can retrieve candidates quickly, but the nearest vectors are not always the passages that best answer the user’s question.
Reranking adds a second relevance step. The system first retrieves a reasonably broad candidate set with a fast method, then applies a more precise model to reorder those candidates before selecting context for the LLM.
This two-stage design is useful because retrieval systems usually face a trade-off between speed and relevance. Candidate retrieval should be cheap enough to search a large collection. Reranking can spend more computation on the much smaller set that survives the first stage.
Retrieval and reranking solve different problems
The first retrieval stage is mainly responsible for recall: relevant material should appear somewhere in the candidate set. It may use dense vector similarity, lexical search, or a hybrid of both.
Suppose the system retrieves 50 passages:
query
|
v
candidate retrieval
|
+-- passage A
+-- passage B
+-- passage C
+-- ...
+-- passage AXThe reranker then estimates which of those passages are most relevant to the specific query and sorts them again. Only the top few may be sent to the language model.
A reranker cannot recover a relevant passage that the first stage never retrieved. This is why candidate recall remains important even when reranking is strong.
Why vector similarity is not always enough
Embedding models represent queries and passages as vectors. Retrieval commonly compares those vectors with cosine similarity, dot product, or another distance measure.
This is efficient because passage embeddings can be computed in advance. At query time, the system creates one query vector and searches an index for nearby passage vectors.
However, this architecture compresses each query and passage into independent representations. That makes large-scale search practical, but it can miss fine-grained relationships such as negation, exact constraints, or which part of a passage directly satisfies the question.
For example, a query such as:
Which plans do not support audit-log export?may retrieve passages discussing audit logs, exports, and subscription plans even when they do not answer the negative constraint. Semantic similarity is useful for finding the neighborhood; it is not automatically a complete relevance judgment.
Cross-encoders provide a common reranking pattern
A common reranker is a cross-encoder. Instead of encoding the query and passage separately, it processes them together:
[query, passage] -> relevance model -> scoreBecause the model can attend across both pieces of text, it can evaluate their relationship more directly. This often produces better relevance ordering than comparing independently generated embeddings.
The cost is computation. If the first stage returns 50 passages, a cross-encoder generally evaluates 50 query-passage pairs. That is far more expensive than one vector lookup, which is why cross-encoders are usually applied after candidate retrieval rather than across the entire corpus.
Other models can also rerank candidates. The important architectural idea is not a specific model family but the separation between broad, efficient retrieval and narrower, more expensive relevance scoring.
Choose the candidate count deliberately
Reranking introduces two useful limits:
retrieve_k = number of candidates from the first stage
final_k = number of passages kept after rerankingFor example:
retrieve_k = 40
final_k = 6Increasing retrieve_k gives the reranker more opportunities to find relevant evidence, but it increases reranking latency and cost. Setting it too low can create an unrecoverable recall problem.
Increasing final_k gives the LLM more evidence, but more context is not always better. Irrelevant passages consume context-window space and can distract the model from stronger evidence.
Treat both values as evaluation parameters rather than universal constants.
Reranking is especially useful for ambiguous candidates
The benefit of reranking tends to be larger when the initial search produces many superficially similar passages. Documentation is a common example. A product may contain several pages that mention the same feature but describe different versions, plans, environments, or configuration modes.
A first-stage retriever may correctly find that cluster of documents while ordering the wrong passage first. Reranking can improve the final ordering by considering the complete query-passage relationship.
It can also help when hybrid retrieval combines lexical and semantic candidates. The reranker provides a shared scoring stage after candidates arrive from different retrieval methods.
Do not use the reranker score as an absolute truth
Reranker scores are useful for ordering candidates, but their numeric scale may not represent a calibrated probability of relevance. A score of 0.8 does not necessarily mean an 80% chance that a passage answers the question.
Prefer evaluating ranking behavior directly. Useful retrieval metrics include:
- Recall@k: whether relevant evidence appears in the candidate set.
- MRR (mean reciprocal rank): rewards placing the first relevant result near the top.
- NDCG: evaluates ranking when results can have graded relevance.
For a RAG application, also measure downstream answer quality. Better retrieval metrics are valuable only when they improve the behavior users care about.
Evaluate the two stages separately
When a RAG answer fails, determine whether the relevant passage was absent or merely ranked too low.
A practical diagnostic table looks like this:
| Relevant passage in initial candidates? | Relevant after reranking? | Likely problem |
|---|---|---|
| No | No | Candidate retrieval recall |
| Yes | No | Reranking quality |
| Yes | Yes | Generation or context use |
This separation prevents wasted tuning. Changing the reranker will not fix a candidate-recall failure, while increasing the vector-search candidate count may not help if the reranker consistently promotes the wrong passages.
Measure latency as well as relevance
Reranking sits on the request path, so relevance gains have an operational cost. Measure at least:
candidate retrieval latency
+ reranking latency
+ generation latency
= end-to-end latencyBatching query-passage pairs can improve throughput for some reranking models. Smaller candidate sets reduce work. A lighter reranker may be preferable when the quality difference from a larger model is small.
The correct choice depends on the application’s latency budget. An offline research assistant may tolerate a slower relevance stage than an interactive autocomplete-like experience.
Keep passage boundaries meaningful
Reranking cannot fully compensate for poor chunking. If a passage contains too little context, the reranker may not have enough information to judge relevance. If a passage contains several unrelated sections, matching terms from one section can obscure the usefulness of another.
Chunks should generally preserve enough local context to make sense independently. Titles, section headings, product names, and other lightweight metadata can also help the relevance model distinguish passages that otherwise look similar.
Do not optimize chunk size only for embedding retrieval. The same chunks must remain useful when reranked and later presented to the language model.
A practical tuning workflow
Start with a small evaluation set containing representative queries and known relevant passages. Then measure the candidate retriever before adding a reranker.
A useful sequence is:
- Choose a
retrieve_kthat gives acceptable recall. - Add the reranker and measure ranking metrics.
- Select
final_kbased on answer quality and context cost. - Measure end-to-end latency and generation quality.
- Test difficult queries with similar or conflicting candidate passages.
- Repeat the evaluation after changing embeddings, chunking, retrieval settings, or the reranker.
This workflow keeps each optimization tied to an observable failure mode.
When reranking may not be worth it
Reranking adds another model, more latency, and another component to operate. It may provide little value when the corpus is small, queries are highly specific, or the first-stage retriever already places the correct evidence at the top reliably.
Measure before adding complexity. If answer quality does not improve meaningfully, a simpler retrieval pipeline is easier to maintain.
Conversely, when relevant evidence is usually present in the candidate set but frequently appears below weaker matches, reranking directly targets the problem.
Conclusion
Reranking improves RAG by separating broad candidate discovery from precise relevance ordering. Fast retrieval searches the corpus and aims for strong recall; the reranker spends additional computation only on a small candidate set and selects better context for generation.
The key is to treat reranking as part of an evaluated retrieval pipeline. Measure candidate recall, ranking quality, downstream answer behavior, and latency separately. With those signals, you can decide whether a reranker improves the system rather than simply making the architecture more complicated.