Zenaique

Why does a cross-encoder reranker pay off even though it is slower than a bi-encoder retriever?

Flashcard·Easy·4.0 · 0·~30s·Asked atMckinseyPineconeSourcegraph
Attempt it
TL;DR

Cross-encoder slowness is multiplied by tens of candidates, not millions of corpus chunks, so total reranker latency stays acceptable while precision climbs sharply over bi encoder only ranking.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Picture sifting through a mountain of resumes. A super-careful interviewer who can spend twenty minutes on each one is too slow to read all five thousand. So a quick first pass narrows the pile to thirty. Then the careful interviewer spends twenty minutes each on those thirty and picks the actual best five. The careful interviewer is slow per resume but only sees thirty resumes total. That is the bi-encoder plus cross-encoder pattern in retrieval: cheap and broad first, expensive and careful second.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Cross-encoder rerankers look prohibitively slow when measured on per-pair latency. Tens of milliseconds per pair is glacial compared to the microseconds of a bi-encoder cosine. The reason the pattern still wins is that the cross-encoder is multiplied against a small number, the candidate set, not the corpus.

This card walks through the architectural reason the two models cost what they cost, the arithmetic that makes the pipeline work, and the precision gain that makes the cost worthwhile.

What each model architecture caches

A bi-encoder runs query and chunks through the model independently. Each output is an embedding vector. Because the chunk side does not depend on the query, every chunk in the corpus can be embedded once at ingest and stored in an approximate nearest neighbour index. At query time the system embeds the query (one forward pass) and runs an ANN lookup over the precomputed chunk index. The query-time cost is independent of corpus size, milliseconds whether the corpus has ten thousand chunks or ten million.

A cross-encoder runs query and chunk through the model jointly. The input is a single concatenated sequence [CLS] query [SEP] chunk [SEP] and the output is a single relevance score. Attention can compare every query token against every chunk token, which is what makes the score sharper. The catch: nothing about this can be precomputed. Every (query, chunk) pair is a fresh forward pass.

The structural consequence

Bi-encoders are corpus-side cacheable; cross-encoders are not. That asymmetry is the reason the two architectures live at different stages of the pipeline.

The arithmetic that makes it work
Why bi-encoder cosine mis-ranks at the top
When to skip the reranker
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
python
import cohere, time

co = cohere.Client()

def retrieve_with_rerank(query: str, k1: int = 30, k2: int = 5):
    t0 = time.time()
    candidates = vector_db.search(query, top_k=k1)   # bi-encoder, ~5 ms over 1M chunks
    t1 = time.time()
    docs = [c.text for c in candidates]
    reranked = co.rerank(
        model="rerank-3.5",
        query=query,
        documents=docs,
        top_n=k2,
    )                                                  # cross-encoder, ~30 ms over 30 candidates
    t2 = time.time()
    print(f"retrieve {1000*(t1-t0):.1f} ms, rerank {1000*(t2-t1):.1f} ms")
    return [docs[r.index] for r in reranked.results]

Real products, models, and research that use this idea.

  • Cohere Rerank 3.5 is the dominant hosted cross-encoder in 2026, typically reranking 50-100 candidates in tens of milliseconds.
  • BGE Reranker v2 from BAAI is the leading open-weight cross-encoder, self-hostable for cost-sensitive workloads.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow does k1 affect total reranker latency?
A

Roughly linear, doubling k1 doubles the reranker's forward-pass count. Production stacks set k1 large enough for recall but small enough that the reranker fits the latency budget.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Comparing the cross-encoder to the bi-encoder on per-pair latency. The right comparison is total latency including the candidate set size, where the cross-encoder over 30 candidates costs less than running it over a million.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Explain why bi-encoder chunk embeddings can be precomputed and cross-encoder pairs cannot

  • State the typical k1 and k2 values for a 2026 production stack

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Pick the most effective intervention when an agent's context grows by 8KB every iteration
MCQ·Medium