Cross-Encoders
Authoritative Definition
Neural network architectures that compute deep, bidirectional attention across query and passage tokens simultaneously to produce highly accurate relevance scores.
Overview & Technical Description
Cross-encoders represent a fundamental approach to evaluating the semantic similarity between two pieces of text, typically a search query and a retrieved document. Unlike bi-encoders—which encode queries and passages independently into static vector embeddings and compare them using simple cosine similarity—cross-encoders feed both the query and the document together into a single transformer model. This concatenated input allows the models self-attention mechanisms to explicitly weigh the relationships between the querys words and the documents words at every layer. Consequently, cross-encoders achieve vastly superior accuracy in detecting nuance, context, and exact phrasing matches. Due to their high computational overhead (requiring a forward pass for every query-document pair), they are primarily deployed as second-stage re-rankers to reorder a small subset of top results retrieved by faster bi-encoders.
Editorial Notes
Used heavily in stage-2 re-rankers like Cohere Rerank and BGE-Reranker. While highly accurate, they are not scalable for searching across millions of documents due to O(N) inference complexity per query.