Cross-Encoder vs Bi-Encoder Rerankers?
Cross-encoders and bi-encoders explained for beginners: how each reads a question and a chunk, and why teams rerank a shortlist, for your AI interview.
In short
A bi-encoder turns the question and each document into separate vectors, so it can search a huge library fast. A cross-encoder reads the question and one document together and scores them more carefully, but it is too slow for everything, so it reranks a short list.
12 min readIntermediateVery common · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
A bi-encoder turns the question and each chunk into vectors separately. The chunk vectors are stored ahead of time, so search stays fast over millions of chunks. A cross-encoder reads the question and one chunk together. It is more accurate, but it runs once per pair, so I only use it to rerank the top hundred results. Search finds the candidates, and the reranker puts the best ones first.
Search for an AI assistant usually has two steps. The first step is a fast search over the whole library, and it often uses a bi-encoder. A bi-encoder turns the question and each chunk into a list of numbers, and the chunk lists were stored in advance, so a new question only needs one encoding and a quick comparison.
The second step is a reranker, and a cross-encoder is a common choice. It reads the question and one chunk together, as a single input, and gives one relevance score. It is more careful, because the model can look at both texts at once. It is also expensive, because every pair needs a full pass through the model and nothing can be stored ahead of time. So I never run it on the whole library.
The pattern is to find a shortlist of about 100 with the fast step, rerank that shortlist with the cross-encoder, and send the best few to the model. Anthropic's tests found that passing 20 chunks worked better than passing 10 or 5, so the number is something to measure, not a rule. The trade-off is delay and cost against recall (how many of the right chunks the search finds), so I measure both on real questions before I pick the shortlist size. A bigger shortlist finds more right answers, but each question waits longer.
What is a reranker, in plain words?
A reranker sorts a shortlist again, more carefully. In a RAG app (retrieval-augmented generation, where the model answers from your own documents), the first search often pulls out a lot of chunks, sometimes hundreds, that might help. The reranker then puts those chunks in order of real usefulness, and only the top few go into the model's prompt.
Think of a law firm's junior associate. They pull 100 possibly relevant cases from a 40,000-file archive using keyword matching and a quick relevance check. A senior lawyer then reads those 100 properly and picks the best 10. The associate is fast and wide, and the senior is slow and careful. An AI reranker plays the senior's part, and a bi-encoder or keyword search plays the associate's. In a bank's support assistant, that means 100 candidate chunks come from 2 million, and the reranker keeps the few that answer a card fee question.
Key words
- Chunk
- A piece of a document, often a few paragraphs, stored so search can find it.
- Embedding
- A list of numbers, also called a vector, that stands for the meaning of a piece of text.
- Bi-encoder
- A model that encodes the question and each chunk separately, then compares the two lists.
- Cross-encoder
- A model that reads the question and one chunk together and gives one relevance score.
- Shortlist
- The top candidates from the first search, handed to the reranker.
How does a cross-encoder differ from a bi-encoder?
Both models turn text into numbers that carry meaning. The difference is when the two texts meet. A bi-encoder encodes them apart, so each chunk's vector is computed once and stored. A cross-encoder joins them, so the model reads both together, and it has to run again for every pair.
- Bi-encoder
Read apart, compared fast
Each chunk is encoded once, when it is indexed. A new question is encoded once, then compared with the stored vectors. Cheap per chunk, so it can search millions.
- Cross-encoder
Read together, scored carefully
The question and one chunk go through the model as one input, which gives one score for that pair. Nothing can be stored ahead of time, so every pair costs a full pass.
- Why it matters
Better order costs time
Use the bi-encoder to find candidates and the cross-encoder to order them. Azure's semantic ranker does the same: it rescores the results of a first pass.
Two ways to score a question against a chunk
Bi-encoder: read apart
Question
encoded on its own
Chunk
encoded once, at indexing
Cross-encoder: read together
Question + chunk
joined into one input
Encoder
one pass per text
Cross-encoder
one pass per pair
Vector match
fast, against stored vectors
Relevance score
one number for the pair
- 1The question is encoded alone, into one list of numbers.
- 2Each chunk was encoded alone earlier, so its numbers are stored.
- 3The two lists of numbers are compared, which is quick.
- 4The question and one chunk are joined and read as one input.
- 5The model reads the pair and gives one score: the slow step.
The 2019 Sentence-BERT paper explains the cost of reading pairs. Its authors say that BERT "requires that both sentences are fed into the network", and they measured the cost of finding the most similar pair in 10,000 sentences:
“it requires that both sentences are fed into the network, which causes a massive computational overhead”
Reimers and Gurevych, Sentence-BERT (2019)
“derive semantically meaningful sentence embeddings that can be compared using cosine-similarity”
Reimers and Gurevych, Sentence-BERT (2019)
Their abstract makes the point: "Finding the most similar pair in a collection of 10,000 sentences requires about 50 million inference computations (~65 hours) with BERT." Their fix, SBERT, makes sentence vectors that can be compared directly by cosine similarity, a standard score for how closely two lists of numbers point the same way.
How do teams use both in one search?
One common design is two stages. Nogueira and Cho describe the same pattern in their paper, Passage Re-ranking with BERT: a first search uses "a standard mechanism, such as BM25" (a classic keyword-scoring method), then in the second stage, "passage re-ranking, each of these documents is scored and re-ranked by a more computationally-intensive method."
- 1
Find candidates fast
A bi-encoder search or keyword search pulls the top 100 chunks from the whole library.
- 2
Rerank the shortlist
A cross-encoder scores each question and candidate pair, and the list is sorted by that score.
- 3
Send only the best
The best few go into the model's prompt. Fewer chunks means less for the model to read, so each answer costs less to produce.
Search first, then rerank a shortlist
Customer question
about a card fee
Stage 1: fast search
Bi-encoder index
2 million vectors, compared fast
Shortlist of 100
the best guesses so far
Stage 2: careful rerank
Cross-encoder
scores each of the 100 pairs
Best few to the model
the context the model reads
- 1The question goes into the fast search.
- 2The search returns its 100 best candidates.
- 3The shortlist goes to the cross-encoder, one question and chunk pair at a time.
- 4The best few chunks go to the model.
A worked example. A mid-size bank keeps 2 million chunks of product rules, fee tables and complaint procedures. Its support assistant gets a question about a card fee. The bi-encoder compares the question with the stored vectors, which is cheap, and returns 100 candidates. The cross-encoder then scores those 100 pairs. Scoring all 2 million with a cross-encoder would mean 2 million full model passes for one question, and no support team can wait for that.
# A made-up bank: 2 million policy chunks. We count model passes for one customer question.
CHUNKS = 2_000_000
SHORTLIST = 100
def two_stage():
# Stage 1, bi-encoder: embed the question once, compare it with stored vectors (a plain scan; a vector index checks far fewer).
stage1 = {"question embeddings": 1, "vector comparisons": CHUNKS}
# Stage 2, cross-encoder: one full model pass per shortlisted pair.
stage2 = {"cross-encoder passes": SHORTLIST}
return stage1, stage2
def whole_library():
# No shortlist: the cross-encoder reads the question with every chunk.
return {"cross-encoder passes": CHUNKS}
s1, s2 = two_stage()
print("Stage 1:", s1)
print("Stage 2:", s2)
print("Cross-encoder on the whole library:", whole_library())Output
Stage 1: {'question embeddings': 1, 'vector comparisons': 2000000}
Stage 2: {'cross-encoder passes': 100}
Cross-encoder on the whole library: {'cross-encoder passes': 2000000}“Reranking is a commonly used filtering technique to ensure that only the most relevant chunks are passed to the model.”
Anthropic, contextual retrieval
“The results are scored using BM25 or RRF scoring, and then rescored by semantic ranker.”
Microsoft, Azure AI Search semantic ranker
RRF (reciprocal rank fusion) is a way of merging ranked lists before the semantic rescoring.
What are the trade-offs and limits?
Reranking is not free. Anthropic's own write-up puts the cost plainly: "Because reranking adds an extra step at runtime, it inevitably adds a small amount of latency, even though the reranker scores all the chunks in parallel." (Latency means delay.)
More candidates, more cost
Anthropic names the trade-off: reranking more chunks gives better performance, but reranking fewer gives lower latency and cost.
The reranker only sorts
It can't rescue a chunk the first search missed. If the right answer is not in the shortlist, it is gone.
Vectors can blur detail
A bi-encoder packs a whole chunk into one list of numbers, so fine detail can blur. ColBERT, a 2020 model, sits between the two: it encodes the question and the document separately, then runs a cheap interaction step that matches them in fine detail.
Test on your own data
Anthropic's experiments used a Cohere reranker, and they advise: "We recommend experimenting with different settings on your specific use case to find the right balance."
Tip
Asked which to use? Say a bi-encoder or keyword search gives recall (it finds most of the right chunks in the whole library), and a cross-encoder gives precision (it puts the right chunks at the top of a shortlist). Name the shortlist size, and measure it on real questions.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: a reranker orders a shortlist with a more careful model.
- Bi-encoder versus cross-encoder, and why a cross-encoder pass costs more.
- Two stages in production: a fast search finds candidates, then a careful model puts them in order.
- The shortlist limit: the reranker can't rescue a chunk the search missed.
- The trade-off: delay and cost rise with the shortlist, so measure it.
- A real case at scale, such as a support or claims assistant.
Common traps
Trap"A reranker replaces the search."
BetterIt sorts what search finds. Without search there is nothing to sort.
Trap"A cross-encoder is most accurate, so use it for everything."
BetterEvery pair costs a full model pass. It only fits on a shortlist.
Trap"A bigger embedding model turns the bi-encoder into a reranker."
BetterBigger vectors still compare apart. Precise ordering needs the second pass.
Can you spot the design problem?
Spot the design
A claims team has 2 million chunks and needs fast answers. Which search loop would you ship?
Quick check
A support bot's right answer was missing from the top 100 candidates. What fixes it?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Learn it in depth
Last updated on 26 November 2026
Building a search or RAG assistant over your own documents?
I design and build AI products and agents, including the UI and the system behind them. Book a short call and tell me what your search has to find and how fast it must answer.