Homeglossary

Cross-Encoder

A cross-encoder is a neural ranking model that reads two inputs, such as a search query and a document, together and assigns them a relevance score. It is commonly used as a reranker because joint processing captures subtle relationships that separate text embeddings can miss. Its improved precision comes with a speed and cost trade-off, so it usually evaluates a small set of already retrieved results.

Build precise AI search apps with Emergent.

What Is a Cross-Encoder?

A cross-encoder is a neural ranking model that reads two inputs together, usually a search query and a candidate document, then gives the pair a relevance score. Unlike an embedding model, it does not create a reusable vector for each input. Its job is to judge how well one specific item answers or matches another.

Cross-encoders are commonly used as rerankers in search, question answering, duplicate detection, and retrieval-augmented generation, or RAG. They can notice details such as negation, word order, and the relationship between terms in both inputs.

How a Cross-Encoder Reranker Works

A cross-encoder usually improves an existing retrieval system rather than searching an entire corpus by itself.

  1. Receive a user query, such as “reset a forgotten administrator password.”
  2. Use keyword, vector, or hybrid search to retrieve a bounded candidate set.
  3. Pair the query with each candidate passage or document.
  4. Process each pair jointly, allowing words in one input to attend to words in the other.
  5. Assign each pair a relevance score.
  6. Sort candidates by score and return the highest-ranked results.

The score ranks alternatives for that model and task. It is not automatically a probability unless the model has been specifically calibrated.

Cross-Encoder vs. Bi-Encoder

These models solve different stages of search. A bi-encoder finds candidates quickly, while a cross-encoder makes the final ordering more precise.

FeatureCross-EncoderBi-Encoder
InputQuery and document togetherEach input separately
OutputOne pairwise relevance scoreReusable embeddings
IndexingCannot precompute pair scoresDocument embeddings can be indexed
Best roleReranking a small candidate setFast retrieval across large collections

Benefits of Cross-Encoders

Joint processing can improve relevance when the meaning depends on a precise relationship between the query and text.

  • Captures fine-grained wording, context, and word order.
  • Handles ambiguous queries more effectively than similarity alone.
  • Improves the passages supplied to an answer-generating model.
  • Supports semantic search, question answering, and duplicate detection.

Practical Limits of Cross-Encoders

Greater precision has a compute and latency cost.

  • Each query-candidate pair requires a separate model run.
  • Reranking too many results can make search slow and expensive.
  • Long documents may be truncated, hiding useful evidence.
  • Quality depends on representative training data and relevance testing.
  • Rerank a fixed, small candidate set rather than an entire corpus.

Using a Cross-Encoder in RAG and AI Search

In RAG, vector search may retrieve several plausible support articles, but a cross-encoder can promote the passage that directly answers the question. Choose a model that fits the domain, test rankings offline against labeled queries, and monitor production results for latency, incorrect citations, and sensitive-data exposure. Teams planning an AI product can start with the Emergent glossary, explore app design and development, and compare AI agent builders. Emergent can help build and ship AI search or RAG apps with a reranking layer. Build precise AI search apps with Emergent.

Start Building
on Emergent today
Start Building