August 21, 2026

Cross-Encoder Reranking

Stephen M. Walker II · Co-Founder / CEO

What is Cross-Encoder Reranking?

Cross-encoder reranking is a technique that uses a transformer model to score the relevance between a search query and a candidate document by processing both together through a single neural network, rather than comparing separately computed embeddings. It is a second-stage refinement step used in retrieval-augmented generation (RAG) pipelines to improve which documents actually reach the language model's context window.

In traditional dense retrieval systems, queries and documents are embedded separately into a shared vector space using a bi-encoder architecture. The similarity between these embeddings, often measured by cosine similarity or dot product, determines the initial ranking. This approach is fast and scalable, but it cannot capture complex lexical and semantic interactions between the specific words in the query and the documents.

A cross-encoder takes a different approach: it concatenates the query and a candidate document into a single input sequence and feeds that into a transformer model, so the attention mechanism performs full "cross-attention." Every token in the query can directly attend to every token in the document across all layers of the network. The result is a relevance score that accounts for word-level interactions the two separately computed word embeddings in a bi-encoder cannot capture.

Because this full attention mechanism is computationally expensive, cross-encoders cannot search millions of documents directly. Instead, they are deployed in a two-stage retrieval pipeline. In the first stage, a fast retriever (like a bi-encoder over a vector database, or BM25) fetches a broad set of candidate documents, for example the top 100. In the second stage, the cross-encoder re-scores and reorders these candidates, moving the most relevant chunks to the top (for example, the top 5) before they are passed to a large language model for generation.

This reranking stage matters because LLMs are sensitive to the order and quality of their input context. Passing relevant, well-ranked context reduces hallucinations, improves generation accuracy, and makes better use of the context window.

Bi-Encoder (Dense Vector Search) vs. Cross-Encoder vs. Late Interaction (ColBERT)

Neural information retrieval generally uses one of three architectures: bi-encoders, cross-encoders, and late-interaction models like ColBERT. Each makes different trade-offs between computational speed, storage requirements, and ranking accuracy.

FeatureBi-Encoder (Dense Search)Cross-Encoder (Reranker)Late Interaction (ColBERT)
ArchitectureEmbeds query & document separately.Concatenates query & document.Embeds query & document at token level.
Attention MechanismSelf-attention only within query or doc.Full cross-attention between query & doc.Late interaction (MaxSim) over token embeddings.
Speed (Inference)Extremely fast (milliseconds).Slow (requires inference per doc pair).Moderate (faster than cross-encoder).
Index StorageModerate (one vector per document).None (no embeddings stored).Very High (vectors for every token).
Accuracy / RelevanceGood, but struggles with nuanced intent.Highest accuracy of the three.Strong (approaches cross-encoder).
Primary Use CaseFirst-stage retrieval (scalability).Second-stage reranking (precision).First-stage retrieval or reranking.

Bi-encoders are the workhorses behind most vector databases. They are built for speed: because documents are pre-computed into embeddings, at query time the system only needs to embed the short query and run a fast nearest-neighbor search. The trade-off is that compressing a document into a single dense vector loses granular detail and some complex relationships.

Cross-encoders produce the most accurate relevance scores of the three, because processing the query and document together lets the transformer model recognize synonyms, negations, and complex dependencies directly. The cost is computational overhead: scoring 100 documents requires running 100 separate forward passes through a full transformer model at query time.

Late interaction (ColBERT) offers a middle ground. It maintains token-level embeddings for documents, which increases index size substantially, but delays the interaction between query and document until the final scoring phase via a lightweight maximum similarity (MaxSim) operation. This lets it capture more nuance than a bi-encoder without paying the full runtime cost of a cross-encoder.

Why Vector Similarity Isn't Always Relevance (The MRR@10 and NDCG@10 gap)

A common misconception in building RAG pipelines is that high vector similarity inherently guarantees high contextual relevance. In practice, dense embeddings can be overly simplistic, leading to frustrating retrieval failures where the retrieved documents share semantic themes with the query but fail to actually answer it.

This discrepancy becomes strikingly clear when evaluating systems using standard retrieval metrics like Mean Reciprocal Rank (MRR@10) and Normalized Discounted Cumulative Gain (NDCG@10).

MRR@10 measures how far down the list the first genuinely relevant document appears. If the perfect answer is ranked #1, the score is 1.0. If it's ranked #5, the score drops to 0.2. NDCG@10 evaluates the overall quality of the top 10 results, penalizing the system if highly relevant documents are ranked below moderately relevant ones.

Bi-encoders frequently struggle with these metrics on complex queries due to several phenomena:

  1. The "Topic Match, Intent Mismatch" Problem: A bi-encoder might retrieve a document about "how to install Python on Windows" for a query asking "how to uninstall Python on Windows." The embeddings for "install" and "uninstall" might be very close in vector space because they appear in similar contexts, but their true relevance to the user's intent is diametrically opposed.
  2. Lexical Blindness: Dense vectors often lose exact keyword matching capabilities. A user searching for a specific product ID or error code might get results that are semantically related but missing the crucial exact match.
  3. Information Bottleneck: Compressing a 512-token document into a single 768-dimensional vector forces the model to average out concepts. Minor but critical details are often smoothed over.

Cross-encoders address these issues directly. By applying full cross-attention, the model can compare the word "uninstall" in the query with "install" in the document, recognizing the contradiction and scoring it lower. Reported gains vary by dataset and baseline, but adding a cross-encoder reranking step often produces double-digit percentage gains in MRR@10 and NDCG@10 over bi-encoder-only retrieval.

The Two-Stage Retrieval Architecture in Production RAG

To balance the need for speed with the need for accuracy, modern RAG applications employ a two-stage retrieval architecture. This pattern lets the system sift through millions of documents in milliseconds while still providing the LLM with a well-curated set of context.

Stage 1: Fast Retrieval (The Net)

The goal of the first stage is high recall, fetching anything that might possibly be relevant. This is typically handled by a vector database using a bi-encoder (Dense Retrieval) and often augmented with a lexical search like BM25 (Sparse Retrieval) in a hybrid setup.

  • Input: User query.
  • Operation: Fast vector similarity search (ANN) across the entire corpus.
  • Output: Top K candidate documents (usually K = 50 to 100).
  • Latency: ~10-50 milliseconds.

Stage 2: Cross-Encoder Reranking (The Scalpel)

The first stage returns a noisy set of candidates. Some are perfect, while others are tangentially related. The second stage applies the computationally intensive cross-encoder strictly to this small candidate pool.

  • Input: User query + Top K documents.
  • Operation: Concatenate query and document [CLS] Query [SEP] Document [SEP], run through the cross-encoder, and output a strict relevance score (typically between 0 and 1) for each pair.
  • Output: The best N documents (usually N = 3 to 7), reordered by their new relevance score.
  • Latency: ~100-300 milliseconds.

This refined top N list is then injected into the context window of the generative LLM. The LLM receives less noise, consumes fewer tokens, and is significantly less likely to be confused by irrelevant information.

Latency Budgets & Choosing Reranking Models

Cross-encoders improve accuracy, but they introduce significant latency into the retrieval pipeline. In user-facing chat applications, every millisecond counts, so it helps to establish a strict "latency budget" when selecting a reranking model.

If your total retrieval budget is 500ms, and Stage 1 takes 50ms, you have 450ms for reranking. The time it takes to rerank depends heavily on the size of the cross-encoder model and the number of candidate documents (K).

As of mid-2026, the reranker market splits into three families.

1. Managed APIs (Cohere Rerank 3.5, Voyage rerank-2.5, Jina Reranker) Cohere pioneered commercial reranking APIs; Rerank 3.5 (released late 2024) remains a common default with broad multilingual coverage. Voyage's rerank-2.5 family added instruction-following, so you can steer relevance criteria ("prefer recent documents") in the request itself.

  • Pros: Zero infrastructure overhead, large context windows, strong accuracy out-of-the-box.
  • Cons: Adds network latency (API calls), cost per query, and potential data privacy concerns.

2. Open-Weight Cross-Encoders (Qwen3-Reranker, BAAI/bge-reranker-v2-m3, mxbai-rerank) For teams hosting their own infrastructure, the open-weight field moved fast in 2025. Alibaba's Qwen3-Reranker (June 2025, Apache 2.0) ships in 0.6B, 4B, and 8B sizes with a 32K-token context and coverage of 100+ languages, and the 4B and 8B sizes now top most open relevance leaderboards. BGE-reranker-v2-m3 remains a solid lighter multilingual option, and MiniLM-class models still serve strict latency budgets.

  • Pros: Complete control over data, no recurring API costs, highly optimizable (e.g., quantization, ONNX runtime, TensorRT).
  • Cons: Requires GPU provisioning for fast inference, operational complexity.

3. Listwise Rerankers (jina-reranker-v3) The newest family breaks the one-forward-pass-per-document assumption. jina-reranker-v3 (September 2025) is a 0.6B model that packs the query and up to 64 candidate documents into a single 131K-token context and scores them all in one pass, letting candidates compete against each other directly. It reported 61.94 nDCG@10 on BEIR, beating the 6x-larger Qwen3-Reranker-4B, while cutting per-query compute because the documents share one forward pass. Expect this listwise pattern to spread; it changes the latency math from "K passes" to "one bigger pass."

Optimizing Latency: If self-hosting a cross-encoder is too slow, you can optimize by:

  • Reducing K: Reranking 20 documents instead of 100 cuts latency substantially, though you risk dropping relevant documents in Stage 1.
  • Quantization: Running the model in INT8 or FP16 can speed up inference on compatible hardware.
  • Smaller Models: Using lightweight architectures like MiniLM instead of larger transformers. They sacrifice a few percentage points of accuracy for significant speedups.

Ultimately, the choice depends on your specific RAG constraints. If accuracy matters most and cost or latency is flexible, a managed API or Qwen3-Reranker-4B/8B is a reasonable choice. For strict SLA environments, a small listwise model like jina-reranker-v3 or a quantized MiniLM-class cross-encoder is the practical choice.

Frequently Asked Questions

Does cross-encoder reranking replace vector databases? No. Cross-encoders are far too slow to run across an entire corpus. You still need a vector database (or search engine like Elasticsearch) for the first-stage retrieval to narrow down millions of documents to a manageable subset of 50-100 candidates.

Can I fine-tune a cross-encoder on my own data? Yes, and it is highly recommended if you operate in a niche domain (like medical or legal text). You can fine-tune open-weight models like those from sentence-transformers by providing query-document pairs labeled as relevant or irrelevant. This often yields better results than using large generalized models.

How many documents should I pass to the reranker? The industry standard is typically between 50 and 100 documents. If your first-stage retriever is very good, K=50 might be sufficient. Increasing K beyond 100 yields diminishing returns in accuracy while linearly increasing latency and compute costs.

Why not just use an LLM to rerank? Prompting a general chat model with "rank these documents" (RankGPT-style) works but is slow and expensive per query. The distinction has blurred, though: models like jina-reranker-v3 and Qwen3-Reranker are themselves small LLMs fine-tuned for relevance scoring. The practical rule in 2026 is to use a purpose-trained reranker, whatever its architecture, rather than prompting a frontier chat model for the job.

Does agentic retrieval remove the need for reranking? No. Agents that search iteratively still benefit from better-ordered results per search call. On the BrowseComp-Plus deep-search benchmark (August 2025), improving the retriever raised a GPT-5 agent's accuracy from 55.9% to 70.1% while reducing how many searches it needed. Better ranking shortens the agent's loop; see agentic RAG.

More terms

Continue exploring the glossary.

Learn how teams define, measure, and improve LLM systems.

Glossary term

What is a neural Turing machine?

A neural Turing machine (NTM) is a neural network architecture that can learn to perform complex tasks by reading and writing to an external memory. The NTM is a generalization of the long short-term memory (LSTM) network, which is a type of recurrent neural network (RNN).
Read term

Glossary term

What is Multi-document Summarization?

Multi-document summarization is an automatic procedure aimed at extracting information from multiple texts written about the same topic. The goal is to create a summary report that allows users to quickly familiarize themselves with the information contained in a large cluster of documents. This process is particularly useful in situations where there is an overwhelming amount of related or overlapping documents, such as various news articles reporting the same event, multiple reviews of a product, or pages of search results in search engines.
Read term

It's time to build

Collaborate with your team on reliable Generative AI features.
Want expert guidance? Book a 1:1 onboarding session from your dashboard.

Talk to sales