Cross-Encoder
A neural network architecture where two input texts are concatenated and processed together, yielding highly accurate similarity scores at the cost of high computational overhead.
How it works
A cross-encoder takes two texts as input, concatenates them with a separator token, and processes them jointly through a Transformer. The full attention mechanism allows every token in text A to attend to every token in text B, enabling rich cross-text reasoning. A classification head on the [CLS] token outputs a relevance score. Cross-encoders are typically fine-tuned on sentence pair datasets (e.g., MS MARCO for passage retrieval) to produce well-calibrated similarity scores.
Why it matters
Cross-encoders achieve significantly higher ranking accuracy than bi-encoders because their deep cross-attention captures subtle semantic relationships. They are used as rerankers in two-stage retrieval pipelines: a fast bi-encoder retrieves the top-100 candidates from a vector database, then a cross-encoder reranks them to produce the final top-10. This pipeline gives the quality of cross-encoders at a fraction of the cost, and is now standard in production RAG and search systems.