In this article
  1. Before you start
  2. Why interviewers ask this
  3. Bi-encoder vs cross-encoder from first principles
  4. The Staff-level answer
  5. The rubric
  6. Three variants of this question
  7. Common mistakes
  8. Follow-up questions
  9. Sources

Before you start

This page is one step of the embeddings and vector search learning path.

Why interviewers ask this

A candidate who mixes up the two designs proposes a search system that is either too slow or not accurate enough. That is the cost of the mistake, and it is why the question appears in retrieval and recommendation design rounds.

The question separates people who know the vocabulary from people who know where the compute goes. A weak answer says "one makes embeddings, the other makes scores." A strong answer says where the two texts meet: outside the network for a bi-encoder, inside it for a cross-encoder. That single fact explains the speed, the accuracy and the production pattern. A Staff-level answer adds the recall ceiling of the first stage, a rough cost estimate, and middle-ground designs such as the poly-encoder and late interaction.

Bi-encoder vs cross-encoder from first principles

Retrieve-and-rerank pipeline
A retrieve-and-rerank pipeline is a two-stage search design in which a fast first stage, usually a bi-encoder or keyword search, pulls a shortlist of candidate documents from a large collection, and a slower second stage, usually a cross-encoder, rescores only that shortlist to produce the final order.
Poly-encoder
A poly-encoder is an architecture that encodes the candidate into one vector and compresses the context into a few learned code vectors through attention, then lets the candidate attend over those codes, so candidate vectors can still be precomputed. Humeau et al. report it as faster than a cross-encoder and more accurate than a bi-encoder.
Late interaction
Late interaction is a scoring design in which query and document are encoded separately into one vector per token, and the score adds up, for each query token, its highest similarity to any document token (an operation called MaxSim). Document token vectors are precomputed, as with a bi-encoder, but the index is larger. ColBERT, from Khattab and Zaharia (2020), is the standard example.

In plain words

Picture a library. A bi-encoder is a librarian who writes one catalogue card per book, once. When you ask for something, she writes one card for your request and compares cards. A cross-encoder is a librarian who sits down with your request and one book, reads them side by side, and gives a mark. Her mark is better. But she must repeat this for every book.

The analogy breaks in one place. Real catalogue cards are lists of numbers learned by a network, not hand-written summaries.

Now the precise version. A bi-encoder is a model that encodes two texts independently into two vectors so a simple formula can compare them. A cross-encoder is a model that reads two texts together in one pass and outputs a single score for the pair. Both are typically built from a transformer such as Bidirectional Encoder Representations from Transformers (BERT), so the difference is wiring, not model family (Sentence Transformers documentation).

Step 1: A bi-encoder encodes each text on its own

A bi-encoder sends the query and the document through the network separately. The cross-encoder documentation describes passing sentences A and B independently, which gives sentence embeddings u and v, and then comparing them with cosine similarity (many systems use a dot product instead). Reimers and Gurevych (2019) build this with siamese and triplet network structures, meaning the same network is applied to each side.

Cosine similarity is a score of how closely two vectors point the same way, from -1 to 1. Input: one text. Output: one fixed-size vector. The query and the document never see each other inside the network. You now know the key property: a document's vector does not depend on the query. Training is covered in the two-tower model page, where the two sides may share weights or keep separate ones.

Step 2: A cross-encoder reads both texts together, so every pair costs a pass

A cross-encoder passes the query and the document into the transformer at the same time. Inside the network, attention, the operation that lets every token weigh every other token, runs across both texts. The retrieve-and-rerank documentation says the network then outputs a single score between 0 and 1 for how relevant the document is to the query. That attention across both texts is why it is more accurate.

Input: one pair. Output: one score. It "does not produce a sentence embedding" (Sentence Transformers documentation), and you cannot feed it a single text. The price is the pair count. Clustering 10,000 sentences with a cross-encoder needs scores for about 50 million combinations and takes about 65 hours, per the same source. The exact count is 49,995,000 pairs.1 The next step shows what that does to search.

Step 3: Only the bi-encoder lets you precompute the collection

A bi-encoder embeds every document once, ahead of time, and stores the vectors in an approximate nearest-neighbour index. An approximate nearest-neighbour index is a structure that checks only part of the collection and may miss a few true matches in exchange for speed. At query time only the query is encoded. The retrieve-and-rerank documentation says the retriever must be efficient for collections with millions of entries. The same 10,000 sentences take about 5 seconds with Sentence-BERT instead of about 65 hours (Reimers and Gurevych, 2019). For the index side, read similarity search.

The pass counts are the stable result; the wall-clock times are not. Spreading the 2019 figure of 65 hours over the 49,995,000 pairs implies about 4.7 milliseconds a pair,1 a pessimistic figure for today. The list of pretrained cross-encoders reports about 1,800 documents per second for ms-marco-MiniLM-L-6-v2 on a V100 graphics card (as of October 2026), so 100 candidates take about 56 milliseconds.1 The ratio is the same: 1,000,000 passes against 100.

On an illustrative collection of 1,000,000 documents, scoring every document needs 1,000,000 cross-encoder passes per query against 100 for reranking, which is 10,000 times fewer.
QuantityValue
Cross-encoder pairs to cluster 10,000 sentences49,995,000
Cross-encoder passes per query over every document (illustrative 1,000,000 documents)1,000,000
Cross-encoder passes per query over 100 candidates100
Ratio of passes, all documents against reranking10,000
Implied cost of one pair, from the 2019 BERT figureabout 4.68 milliseconds
Time for 1,000,000 passes at that implied costabout 4,680 seconds (78 minutes)
Time for 100 passes at that implied costabout 468 milliseconds
Time for 100 passes at a small current reranker's documented throughput (as of October 2026)about 56 milliseconds
Network passes per query, bi-encoder only1 (plus the index lookup)
Raw vectors for 1,000,000 documents, 768 numbers each, 32-bit (illustrative)3.072 GB
Retrieve then rerank cuts cross-encoder work per query by 10,000 timesBar chart of transformer passes per query on an illustrative collection of 1,000,000 documents: 1,000,000 for a cross-encoder on every document, 101 for retrieve then rerank with 100 candidates, and 1 for a bi-encoder alone.Passes per query (passes)0500,0001,000,000Cross, allRetrieve, rankBi-encoderDesign1,000,0001011Diagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/how-do-bi-encoders-and-cross-encoders-differ-in-architecture.html
Illustrative: reranking needs 10,000 times fewer cross-encoder passes than scoring everything; the 101 and 1 bars are tiny, and passes differ in cost.CC BY 4.0 — source: How do bi-encoders and cross-encoders differ in architecture and use cases?
Text description of the diagram
  • A cross-encoder over every document of an illustrative 1,000,000-document collection needs 1,000,000 passes per query.
  • Retrieve then rerank with 100 candidates needs 101 passes: one query encoding and 100 cross-encoder passes.
  • A bi-encoder alone needs one pass per query plus an index lookup.

Step 4: Production systems retrieve first, then rerank

The standard pattern joins the two. The retrieve-and-rerank documentation describes a retrieval system that returns a list of, for example, 100 possible hits, which a cross-encoder then rescores. The shortlist can come from a bi-encoder, from keyword search, or from both, as covered in hybrid search. The reranking stage has its own page: cross-encoder rerankers.

Input: a query and a shortlist. Output: the same documents in a better order. The limit is recall. If the retriever never returns the right document, the reranker cannot rescue it. Middle-ground designs exist for cases where neither extreme fits: the poly-encoder and late interaction (ColBERT), both defined above.

A bi-encoder shortlists and a cross-encoder reranks the shortlistBoxes and arrows: a query enters a bi-encoder alone, document vectors sit in a precomputed index, the index returns about 100 candidates, and a cross-encoder reads the query and each candidate together to produce reranked results.QueryBi-encoderencodes apartQuery + docCross-encoderreads both togetherVector indexprecomputedrerankCandidatesabout 100Reranked resultsfinal orderDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/how-do-bi-encoders-and-cross-encoders-differ-in-architecture.html

The bi-encoder narrows a large collection to a shortlist, and the cross-encoder spends its extra cost only on that shortlist.CC BY 4.0 — source: How do bi-encoders and cross-encoders differ in architecture and use cases?
Step-by-step description
  1. Query and document are encoded separately into vectors.
  2. Query and document are read together and give one score.
  3. Only bi-encoder vectors can be stored ahead of time.
  4. The index returns candidates and the cross-encoder reorders them.
  • A bi-encoder encodes the query and each document separately.
  • A cross-encoder reads the query and a document together and outputs one score.
  • A bi-encoder embeds every document once, ahead of time, and stores the vectors in an approximate nearest-neighbour index.
  • The index returns a shortlist of candidates and the cross-encoder reranks them.

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

The Staff-level answer

Interviewer asks

How do bi-encoders and cross-encoders differ in architecture and use cases?

A strong answer

A bi-encoder runs the query and each document through the transformer separately and compares the two vectors with cosine similarity, so I embed the whole collection once and search an approximate nearest-neighbour index. A cross-encoder feeds the query and document into one transformer together, so attention runs across both and the score is more accurate. But it makes no reusable embedding and needs a forward pass per pair: over a million documents that is a million passes per query, versus a hundred on a shortlist. So I retrieve about a hundred candidates with the bi-encoder, optionally merged with keyword search, and rerank them with the cross-encoder. The trade-off is recall: a document the retriever misses is never rescued.

What makes it Staff-level: it names where the two texts meet, gives the cost consequence, and ends on the recall ceiling instead of stopping at the definition.

The rubric

The answers differ most in whether they explain why the cross-encoder cannot retrieve, and in whether they name the first stage's recall limit.
DimensionWeak answerStrong answerStaff answer
CorrectnessSays one makes embeddings and the other makes scoresSays texts are encoded apart versus togetherAdds that a cross-encoder yields no reusable embedding
DepthGives no reason for the accuracy gapCredits attention across query and documentLinks the gap to precomputation and pair count
Trade-offsPicks one model for everythingRetrieves, then reranksNames the recall ceiling and hybrid options
CommunicationLists facts in random orderDefines both, then comparesGives a cost estimate before being asked

Three variants of this question

Can a cross-encoder produce embeddings?

No. Its internal states, such as the classification-token state used for the score, are computed from the query and the document together, so a state made for one query cannot be cached and reused for another. The Sentence Transformers documentation also says it produces no sentence embedding. For vectors, use a bi-encoder.

Then a cross-encoder over every document can be affordable, because the pair count is tiny and nothing needs an index. The bi-encoder advantage matters once the collection is large or queries are frequent.

What sits between a bi-encoder and a cross-encoder?

Two designs. The poly-encoder, which Humeau et al. report as faster than a cross-encoder and more accurate than a bi-encoder, keeps candidate vectors precomputable while letting them attend over a few learned query codes. Late interaction, as in ColBERT (Khattab and Zaharia, 2020), precomputes one vector per document token and scores query tokens against them with MaxSim, so it keeps token-level matching without a pass per pair; the trade-off is a larger index. Use either when the shortlist is still large or the latency budget is tight.

Common mistakes

  • "A cross-encoder gives me an embedding I can store." (wrong) It outputs only a score for a pair. (right) "A cross-encoder scores a query-document pair; I store vectors only from a bi-encoder."
  • "Cross-encoders are more accurate, so I use them for search." (wrong) They do not scale to large collections, as the Sentence Transformers documentation states. (right) "I use a cross-encoder only on a shortlist."
  • "They are different model families." (wrong) Both are typically BERT-style transformers. (right) "The difference is how the input is fed in and where the interaction happens."
  • "The 0 to 1 score is a calibrated probability." (wrong) The documentation says only that it is a value between 0 and 1. (right) "I treat it as a relevance score for ranking."

Follow-up questions

Why does the order retrieve first, rerank second matter?

The cheap stage must see the whole collection, and the expensive stage can only afford a shortlist. Reversing them would put the expensive model over millions of pairs, which is the 1,000,000-pass case in the table above.

How many candidates should you rerank?

The retrieve-and-rerank documentation uses about 100 as its example, but the right number is a trade-off. More candidates raise the chance the right document is in the shortlist, and each one adds a cross-encoder pass of latency. Measure the shortlist's recall at several sizes on your own queries.

How do you train each one?

A bi-encoder is trained so matching query-document pairs score higher than non-matching ones; the two-tower model page walks through the loss. A cross-encoder is trained on labelled query-document pairs to output a relevance score for each pair. One option is to distil a cross-encoder's scores into a bi-encoder, using the slower model as the teacher.

How does keyword search fit in?

Keyword search can supply or widen the shortlist, and a bi-encoder can supply the semantic matches. Hybrid search covers how to merge the two lists before the cross-encoder rescoring.

Key takeaways
  • A bi-encoder encodes query and document apart; a cross-encoder reads them together.
  • Only bi-encoder vectors can be precomputed and indexed.
  • A cross-encoder is more accurate but needs one pass per pair, so it fits a shortlist.
  • Production search retrieves with a bi-encoder or keyword search, then reranks.
  • The first stage's recall caps what the reranker can achieve.

Sources

  1. Cross-Encoders (Cross-Encoder vs. Bi-Encoder), Sentence Transformers documentation — Sentence Transformers (sbert.net), 26 Oct 2026
  2. Retrieve & Re-Rank, Sentence Transformers documentation — Sentence Transformers (sbert.net), 26 Oct 2026
  3. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks (arXiv 1908.10084) — arXiv (Reimers and Gurevych), 27 Aug 2019
  4. Poly-encoders: Architectures and Pre-training Strategies for Fast and Accurate Multi-sentence Scoring (arXiv 1905.01969) — arXiv (Humeau et al.), 1 May 2019
  5. ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT (arXiv 2004.12832) — arXiv (Khattab and Zaharia), 27 Apr 2020
  6. Pretrained Cross-Encoders, Sentence Transformers documentation — Sentence Transformers (sbert.net), 26 Oct 2026