What Is Re-Ranking, and How Does It Improve Search?
Re-ranking is a second pass over search results that scores each candidate and puts the best matches first. It fixes the weak ordering of fast first-pass search.
On this page
Short answer
Re-ranking is a second scoring pass in search: after a fast first pass retrieves a broad set of candidate documents, a re-ranker model reads each candidate against the query and scores how well it matches, then orders the results by that score. It matters because the first pass is fast but rough, so the best answer often sits far down the list until re-ranking moves it to the top.
What is re-ranking?
Re-ranking is a second pass over search results that scores each candidate document against the query and puts the best matches first. It sits between retrieval and the answer: the first pass finds a broad set of candidates quickly, and the re-ranker reads each one carefully before the final order is set.
It exists because fast search is rough search. A vector search can scan millions of documents in milliseconds, but it compares compressed summaries, not the full text, so its ranking is often wrong. Re-ranking trades a little time for a much better order.
| Stage | What it does | Speed | Accuracy |
|---|---|---|---|
| First pass retrieval | Finds 50 to 100 candidates fast | Milliseconds | Rough ranking |
| Re-ranking | Scores each candidate against the query | Slower, per document | Fine ranking |
| Final answer | Uses the top few documents | Fast | Best of the set |
How does a re-ranker score documents?
A re-ranker reads the query and one document together and gives a relevance score, usually between 0 and 1. The model looks at wording, meaning and context, so it can tell a document that answers the question from one that only shares a few words with it.
The most common re-rankers are cross-encoder models, which feed the query and the document into the model as a pair. That is slower than comparing precomputed vectors, because the model runs once per document, but the score is far more precise.
Some systems use a large language model as the re-ranker instead, asking it to judge each document or to order a short list. That costs more per query, so teams usually reserve it for the top 10 or 20 candidates. What a vector database is explains the first-pass side of the same pipeline.
Re-rankers are trained on pairs of queries and documents with human labels for relevance, so they learn what a good match looks like in practice. A general re-ranker works well for most teams, while a team with unusual documents can fine-tune one on its own labelled pairs. Either way, the model sees the full text, which is why its scores beat the compressed comparison of the first pass.
Where does re-ranking help most?
Re-ranking helps most in retrieval-augmented generation, where the answer depends on the few documents handed to the model. If the wrong documents reach the model, the answer is wrong, so a better order directly improves the answer.
It also helps in support search, help centres and document search, where users ask questions in their own words. A keyword search misses paraphrases, and a vector search finds them but ranks them poorly, so re-ranking closes the gap.
It helps least when the first pass is already good, such as a small, clean document set with exact titles. In that case the extra scoring adds latency without changing the order much. What retrieval-augmented generation is shows where re-ranking fits in the full pipeline.
What are the costs and trade-offs?
The main trade-off is latency. A cross-encoder scores each document one by one, so re-ranking 50 documents takes far longer than re-ranking 10. Most teams re-rank 20 to 50 candidates and pass only the top 5 to the answer step.
Cost is the second trade-off. A hosted re-ranking API charges per call, and a self-hosted model needs GPU time, so the bill grows with every query. The gain in answer quality usually justifies the cost for user-facing search, but not for background jobs where order matters less.
A third trade-off is complexity. Adding a re-ranker means another model to test, monitor and update, and another place where things can fail. Keep the pipeline simple at first, add re-ranking when measurements show the first pass is the weak link, and check the vendor's pricing page before you commit to a hosted service.
There is also a trade-off in freshness. A re-ranker scores documents as they are, so it cannot fix stale content or missing pages. If your documents change often, keep the index fresh first, because re-ranking a stale set only orders old answers more neatly.
Example (hypothetical): a support search pilot
Example (hypothetical): a support team tests re-ranking on 300 real questions. Without re-ranking, the correct help page reaches the top 5 results for 141 of the 300 questions, which is 47 out of every 100.
With re-ranking, the correct page reaches the top 5 for 189 of the 300 questions, which is 63 out of every 100. That is 189 minus 141, or 48 more questions answered from the top results, a gain of 16 points.
The team also measures latency. Re-ranking 50 candidates adds about 400 milliseconds per question, while re-ranking only 20 adds about 160 milliseconds. They settle on 20 candidates, keeping most of the gain with less than half the delay.
What are the common mistakes?
The most common mistake is re-ranking too many documents. Scoring 100 candidates costs five times as much as scoring 20, and the extra documents rarely change the top 5. Start with 20 and increase only if tests show a gain.
The second mistake is judging re-ranking by feel instead of by measurement. Teams add it, notice answers look better and never measure, so they cannot tell whether the gain is real or the cost is worth it. Keep a fixed test set of questions and score before and after.
The third mistake is forgetting the first pass. Re-ranking can only order the documents it is given, so if the right document never reaches the top 100, no re-ranker can save it. Fix retrieval coverage first, then add re-ranking to polish the order.
How to add re-ranking in five steps
Add re-ranking in five steps. First, measure your current search on a fixed test set, so you have a baseline to compare against. Second, pick a re-ranker: a hosted API is fastest to try, while a small open model is cheaper at high volume.
Third, wire it into the pipeline after retrieval and before the answer step, scoring 20 to 50 candidates. Fourth, measure again on the same test set and check both accuracy and latency.
Fifth, tune the candidate count and the number of documents passed onward until the gain flattens. RAG project ideas lists small projects where re-ranking is a good first upgrade, and a short pilot will tell you whether it earns its place.
Key takeaways
- Re-ranking is a second scoring pass that orders search candidates by real relevance.
- It fixes the rough ranking of fast first-pass retrieval.
- Score 20 to 50 candidates; more rarely changes the top results.
- Measure on a fixed test set before and after adding it.
- It can only order what retrieval finds, so fix coverage first.
Frequently asked questions
Is re-ranking the same as ranking?
No. Ranking is the order any search returns. Re-ranking is a second pass that re-scores the candidates from the first pass with a stronger model, so the final order is more accurate than the first pass alone.
Do I need re-ranking for a small document set?
Usually not. With a few hundred documents, a simple vector search already ranks well, and the extra scoring adds latency without changing much. Add it when the set grows or users report wrong top results.
What is a cross-encoder re-ranker?
A cross-encoder is a model that reads the query and one document together and outputs a relevance score. It is more accurate than comparing precomputed vectors, but slower because it runs once per document.
Can a large language model do re-ranking?
Yes. A large language model can judge each document or order a short list, and it often scores well. It costs more per query, so teams usually use it only on the top 10 or 20 candidates.
How many documents should I re-rank?
Most teams re-rank 20 to 50 candidates and pass the top 5 onward. Scoring more adds cost and latency with little gain, because the best answers rarely sit below position 50.
Does re-ranking help RAG answers?
Yes, often a lot. In retrieval-augmented generation the model can only use the documents it is given, so a better order means better source material and fewer wrong or invented answers.