Why does a cross-encoder reranker pay off even though it is slower than a bi-encoder retriever?
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.
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.
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 minutes: bi-encoder caching versus cross-encoder no-caching, the arithmetic over the candidate set size, why bi-encoder cosine mis-ranks at the top, name two production rerankers.
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.
- Voyage Rerank-2 specializes in technical and code domains and is commonly paired with Voyage embedding models.
- Jina Reranker v2 ships an open-weight cross-encoder with long-context support up to 8K tokens.
- Pinecone, Weaviate, and Qdrant all expose hosted reranker integration as a single config flag in 2026.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does k1 affect total reranker latency?
QWhat happens if you push k1 to 200 or 500?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
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.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.