Re-Ranking Best Practices for Search and RAG
Re-ranking takes a rough first-pass result list and orders it by what truly matches the query. These practices keep it fast, accurate and worth the cost.
On this page
Short answer
Re-ranking best practices are to retrieve a generous candidate set first, score it with a stronger model, keep the candidate count small enough to stay fast, mix in diversity and freshness, and measure the gain on real queries. Done well, re-ranking lifts the right answer into the top few results without slowing search down.
What is re-ranking?
Re-ranking is the second stage of search: after a fast first pass returns a rough list of candidates, a stronger model scores each one against the query and puts them in a better order. The first pass finds candidates quickly; the re-ranker decides which ones actually match.
It matters because the first pass is usually based on simple similarity, such as matching words or vectors. That is fast but rough: a document can share many words with a query while answering a different question. Re-ranking reads the query and each candidate together, so it can tell a real match from a near miss.
Re-ranking is used in product search, document search and retrieval-augmented generation, where the passages sent to the language model decide the quality of the answer. If the wrong passages go in, the answer will be wrong no matter how good the model is. For the wider picture, how RAG works explains where re-ranking sits in the pipeline.
How does re-ranking fit into search and RAG?
Re-ranking fits between retrieval and the final answer. Retrieval finds candidates cheaply from a large collection; re-ranking scores a small number of them carefully; the top few then go to the user or to the language model.
| Stage | What it does | How many items |
|---|---|---|
| Retrieval | Finds rough candidates fast | Hundreds or thousands |
| Re-ranking | Scores candidates against the query | 20 to 100 |
| Final answer | Uses the top results | 3 to 10 |
The key point is that re-ranking can only order what retrieval found. If the right document never makes the candidate list, no re-ranker can bring it back. That is why the first stage needs to be generous, even if it is rough.
In RAG, the re-ranked passages are the context the model writes from. A better top five means fewer wrong answers and fewer cases where the model says it cannot find the information. The gain shows up in answer quality, not just in search scores.
How do you pick the first-stage candidates?
You pick the first-stage candidates by retrieving more than you need, from more than one method, and keeping the count high enough that the right answer is usually in the list. A candidate set of 20 is too small; a set of 100 is a safer starting point.
Combine methods. Keyword search finds exact matches, such as product names and error codes, while vector search finds passages that mean the same thing in different words. Using both covers more cases than either alone, and the re-ranker then sorts the combined list.
Check recall before tuning the re-ranker. Take a set of real questions with known good answers, run retrieval, and measure how often the right document appears in the candidate list at all. If it is missing a third of the time, fix retrieval first: add synonyms, clean the documents, or raise the candidate count.
Keep the candidate count steady. A count that jumps around makes latency unpredictable and results hard to compare. Pick a number, measure recall and speed at that number, and change it only when you have a reason.
Which re-ranker should you use?
Which re-ranker to use depends on how much accuracy you need, how fast the answer must come back, and what you can afford to run. There are three common choices, and the right one is usually the simplest that meets your quality bar.
Cross-encoder models read the query and each candidate together and give a relevance score. They are the standard choice: accurate, well tested and fast enough for tens of candidates. Most teams should start here.
Large language models can re-rank by judging each candidate or ordering a small list. They are more accurate on tricky queries, such as ones needing judgement about which passage answers the question, but they are slower and cost more per query. They suit low-volume, high-value searches.
Simple rules still have a place. A rule that boosts recent documents, official sources or the user's own language can sit alongside the model score and fix the cases a model gets wrong. Rules are cheap, easy to explain and easy to change.
Whichever you pick, test it on your own queries. A re-ranker that wins on a public benchmark may not win on your documents, because your queries and your content are different.
Re-ranking is one of several techniques that improve retrieval quality. Advanced RAG techniques covers the others, from query rewriting to hybrid search.
How do you keep re-ranking fast enough?
You keep re-ranking fast enough by limiting how many candidates it scores, keeping the model small, and skipping re-ranking when it adds little. Re-ranking is the slowest part of search, so its cost has to be controlled.
Limit the candidate count. Scoring 100 candidates takes roughly five times as long as scoring 20, so the count is the biggest lever on speed. Start at 50, measure the time, and only raise it if recall clearly improves.
Use a small, fast model for the common case. A compact cross-encoder handles most queries well, and a larger model can be reserved for the queries that matter most, such as the ones that drive purchases or support answers.
Cache where you can. Repeated queries, popular pages and stable documents do not need to be re-ranked every time. A short cache for common queries removes a large share of the work without changing results.
Set a time budget and stick to it. If re-ranking takes longer than the budget, fall back to the retrieval order rather than making the user wait. A fast, decent answer beats a slow, perfect one.
How do you know re-ranking is helping?
You know re-ranking is helping by measuring it on real queries with known good answers, before and after you turn it on. Without that measurement, you are guessing, and the extra cost may buy nothing.
Start with a fixed test set of real questions and the documents that answer them. Measure how often the right document is in the top three and the top five, with re-ranking on and off. A clear gain on that set is the evidence you need to keep it.
Then measure live. Compare users who get re-ranked results with users who do not, and watch clicks, task completion and support tickets. A ranking that scores better offline can still fail live, for example when users prefer recent documents over the most relevant ones.
Track the cost alongside the gain. Record the extra time per query and the extra spend, and check that the improvement justifies them. If the gain is small, a cheaper re-ranker or a smaller candidate set may give almost the same result for less. RAG evaluation covers how to build the test set and the measures behind these checks.
Example (hypothetical): a support search gets a re-ranker
Example (hypothetical): a support team answers 1,000 questions a day through a search over help articles. Retrieval alone puts the right article in the top five for 62% of questions, or 620 a day, and agents spend time hunting for the rest.
The team adds a cross-encoder re-ranker over the top 50 candidates. The right article now reaches the top five for 81% of questions, or 810 a day, which is 190 more correct answers a day without writing any new articles.
Speed is checked too. Scoring 50 candidates adds about half a second per search, which the team accepts, and a cache for the most common questions removes the extra time for about a third of searches. The team keeps the candidate count at 50, because raising it to 100 adds time without a clear gain in the top-five rate.
The lesson is to measure both sides: the gain in correct answers and the cost in time. Re-ranking earned its place because the gain was large and the cost was small and bounded.
Common mistakes with re-ranking
The most common mistakes with re-ranking are scoring too few candidates, trusting a benchmark instead of your own queries, and adding re-ranking where retrieval is the real problem.
- Too few candidates. If the right document never reaches the re-ranker, no amount of scoring can find it.
- Trusting public benchmarks. A model that wins on a benchmark may not win on your documents and your queries.
- Re-ranking to fix bad retrieval. If recall is low, fix the first stage first; re-ranking only orders what it is given.
- Scoring too many candidates. Latency grows with the count, and the gain flattens out past a point.
- No fallback on timeout. A slow re-ranker should fall back to retrieval order, not make the user wait.
- Ignoring freshness. A re-ranker that favours relevance alone will keep showing old documents; mix in recency where it matters.
- Measuring only offline. Live behaviour can differ from the test set, so run a live comparison before rolling out.
Key takeaways
- Re-ranking orders a rough candidate list; it cannot find documents retrieval missed
- Retrieve generously from keyword and vector search, then re-rank 20 to 100 candidates
- Cross-encoders are the standard starting point; larger models suit high-value queries
- Candidate count is the biggest lever on speed, so keep it fixed and measured
- Prove the gain on your own test set and live, and track the extra time and cost
- Always have a fallback to retrieval order when re-ranking is too slow
Frequently asked questions
What is the difference between retrieval and re-ranking?
Retrieval is the fast first pass that finds rough candidates from a large collection, using keyword or vector matching. Re-ranking is the careful second pass that scores a small number of those candidates against the query and orders them by true relevance.
How many candidates should a re-ranker score?
A common starting point is 50 candidates. Fewer than 20 risks missing the right answer, while more than 100 adds latency without much gain. Measure recall and speed at your chosen count and adjust only with evidence.
Do I need a re-ranker if I already use vector search?
Often yes. Vector search finds passages that are similar in meaning, but it can rank a near miss above the true answer. A re-ranker reads the query and each passage together, so it catches the distinction that similarity alone misses.
Can a large language model be used as a re-ranker?
Yes, and it can be more accurate on tricky queries, but it is slower and more expensive per query. It suits low-volume, high-value searches. For most traffic, a cross-encoder gives most of the gain at a fraction of the cost.
Does re-ranking help RAG answers?
Yes, directly. In RAG, the passages sent to the model decide the quality of the answer. Better-ranked passages mean fewer wrong answers and fewer cases where the model cannot find the information, even with the same underlying model.
What should I do when re-ranking is too slow?
Reduce the candidate count, use a smaller model, or cache common queries. If it still exceeds your time budget, fall back to the retrieval order for that query. A fast, decent answer is better than a slow one that times out.