Two-Stage Retrieval
In this article
- Explain what the first-stage search and the reranker each do, and why one model cannot do both jobs.
- Say what a rerank call takes in and gives back, and keep the candidate count apart from the number of chunks sent to the model.
- Check whether a failed query's gold chunk is among the candidates, and choose a search fix or an order fix from that.
- Say when a reranker is not worth adding.
- Terms defined here: two-stage retrieval, recall ceiling.
Overview
A customer asks your help assistant a question and gets a wrong answer, although the page that holds the right answer exists. It was lost in one of two places: the search never found the page, or found it but ranked it too low for the model to read. The two need different fixes, and a better ranking model only helps with the second.
After this you can split a search into its two stages, say what each is for, read a short trace to see which stage lost an answer, and decide whether to repair the search or reorder its results, or skip the second stage.
Two jobs, two stages
Take a made-up online store. This topic uses a larger example than Brightline, the help assistant of the earlier topics: a store with 10,000 chunks that sends the top 8 to the model. Its help assistant answers customer questions from 10,000 chunks of its policy and help pages. For each question, a fast first-stage search picks 50 candidate chunks, a reranker puts those 50 in a new order, and the top 8 go into the model's request.
Why not use one careful model for everything? Because careful is slow. A reranker reads the question and a chunk together and gives a better relevance judgment than the quick similarity score of a keyword or vector search, but it has to do that work for every (query, chunk) pair while the customer waits. [1] Sentence Transformers says scoring thousands or millions of pairs that way would be too slow, so a retriever first narrows the field to, for example, 100 candidates. [1] The Azure RAG guide draws the same line for a cross-encoder, a reranker model that takes the query and a chunk as one input pair and returns a relevance score: running it over tens of candidates is practical, over the whole corpus it is not. [2]
So each stage gets one job. The first stage must be cheap enough to look at all 10,000 chunks and broad enough not to miss the right one: it favours recall. The reranker favours order. In Azure's words, retrieval is tuned for recall and reranking for precision, which moves the most relevant retrieved chunks to the top. [2] OpenAI's cookbook describes the usual pairing: an embedding search finds the top candidates cheaply, and a more expensive model then reorders only those. [6]
The first stage can be a keyword search or a vector search [1], or a hybrid search that runs both. [2] The reranker can be slow per item because it only sees the 50. This split is called two-stage retrieval.
One rerank call
Two numbers matter here, and they are different settings: N is how many candidates the reranker reads (50 in the store), and M is how many chunks go to the model (8). In pseudo-code:
candidates = first_stage_search(query, k=50) # N = 50 chunks
pairs = [(query, chunk.text) for chunk in candidates]
scores = reranker.predict(pairs) # 50 scores, one per pair
ranked = sort candidates by score, highest first
context = first 8 of ranked # M = 8 chunksThe call takes one query and N texts and returns N scores, one per text, and nothing else. The sort and the cut to M are yours. That matches the real API: with Sentence Transformers you build a list of [query, chunk] pairs, pass it to CrossEncoder.predict, and get one score per pair back, which the Azure guide's example then sorts from high to low and slices. [2]
What a reranker cannot do
Look again at the input of the call: the 50 candidates. Whatever the reranker does, it picks its 8 from those 50. A chunk the first stage never returned cannot reach the model; a better reranker changes the order of what it got, never adds to it.
That gives a hard limit you can measure before you touch the reranker. Recall@K, the share of a query's relevant chunks that land in the top K, works at any cut-off [2]; set K to the candidate count and you get Recall@N. With one gold chunk per query, Recall@50 for one query is 1 if its gold chunk is among the 50 candidates and 0 if not, and the average over a test set is the share of queries whose evidence reached the reranker.
The store's team keeps 100 test queries, each labelled by hand with the one chunk that answers it. On 88 of them the gold chunk is among the 50 candidates, so Recall@50 = 0.88. Even a perfect reranker could serve at most those 88; the other 12 are out of its reach. That limit is the recall ceiling.
Two failing queries
Two queries from the store's log got wrong answers. In both, the gold chunk was not among the 8 the model read.
- Query A, "Does the warranty cover a cracked screen?": the gold chunk, from the warranty exclusions page, is not among the 50 candidates.
- Query B, "How long do I have to return an opened item?": the gold chunk, from the returns policy, is among the candidates at rank 31.
Before reading on, predict for each one: can a reranker fix it?
Here is the trace of both queries through the two stages (invented values):
| query | gold in the 50 candidates | rank after first stage | rank after reranker | in the 8 sent to the model |
|---|---|---|---|---|
| A | no | - | - | no |
| B | yes | 31 | 3 | yes |
Query A cannot be fixed by reordering: the reranker never saw the warranty chunk, so no change to its model or settings can move it into the 8. Query B is the case a reranker exists for: the first stage found the right chunk but put it 31st, far past the cut at 8, and the reranker lifted it to rank 3.
Choosing the fix
For each failed query, ask one question first: is the gold chunk among the N candidates?
- Absent (query A): fix retrieval. Find out why the search missed it (the customer's words differ from the page's, or the chunk was never indexed), then repair the search or make it return more candidates.
- Present, but below rank M (query B): fix the order. That is the reranker's job, and the place to compare or change rerankers.
- Inside the top M, yet the answer is wrong: the evidence reached the model, so the fault lies after retrieval.
Run the check over the whole test set before you choose where to spend effort. In the store, 12 of 100 queries fail at the first stage, and no reranker can win those back.
When to skip the second stage
The Azure guide warns that each reranking method adds processing after the first search finishes, and suggests it when you merged hybrid results, deliberately retrieved a large candidate set, or care more about accuracy than latency. [2] Two cases where you can leave it out:
- The corpus is tiny, say 30 documents. With only a small set of paragraphs there is nothing to narrow: Sentence Transformers' in-document example skips the retrieval stage and scores every paragraph with the cross-encoder directly. [1] A plain sort by the search score may also be enough; measure it.
- The order is already good. If, whenever the gold chunk is among the candidates, it already sits inside the top M, the reranker has nothing left to move, and you pay its latency for no gain.
Common mistakes
- Crediting the reranker for a search fix. You repair the search and switch rerankers in one release, and answers improve; gold chunks that now enter the pool may explain all of it. Change one stage at a time and report Recall@N with every result.
- Tuning the reranker on absent cases. The store's 12 absent queries stay lost under any reranker. Sort failures by stage first.
- Trusting rank-1 hits on easy queries. If the first stage already puts the gold chunk first, the reranker had nothing to do. Test on queries whose gold chunk is in the pool but low.
- Sending the whole corpus to the reranker. Scoring every chunk per query is the cost the first stage exists to avoid; a cross-encoder over a full corpus is not practical. [2]
In production
Log the stage trace for every query: the candidate ids with their first-stage ranks, and the ranks after reranking. Then sorting a failure into "absent" or "misordered" is a lookup, not an investigation. Some managed services set the pool for you: Azure AI Search's semantic ranking rescores only the top 50 results that the first BM25 or hybrid query returns. [2] So know the N of any service you use, because it fixes your recall ceiling.
Sources
- Sentence Transformers: Retrieve & Re-Rank. Hugging Face. Checked 24 Oct 2026.
- Develop a RAG Solution on Azure - Information-Retrieval Phase (Azure Architecture Center). Microsoft. Checked 21 Nov 2026.
- LlamaIndex docs: Basic Strategies. LlamaIndex. Checked 24 Oct 2026.
- LlamaIndex docs: Node Postprocessor Modules. LlamaIndex. Checked 24 Oct 2026.
- OpenSearch docs: Reranking search results using a cross-encoder model. OpenSearch project. Checked 24 Oct 2026.
- OpenAI Cookbook: Search reranking with cross-encoders. OpenAI. Checked 24 Oct 2026.
Check yourself
Check yourself
Question 1 of 13
What is a reranker's job in a two-stage search?
Your first check counts towards your result.