Can Cross Encoders Produce Useful Sentence Embeddings?

Haritha Ananthakrishnan, Julian Dolby, Harsha Kokel, Horst Samulowitz, Kavitha SrinivasarXiv 2025 · DOI

Introduction

In modern Information Retrieval (IR), practitioners typically face a stark trade-off between the efficiency of Dual Encoders (DEs) and the accuracy of Cross Encoders (CEs). While DEs allow for rapid vector similarity searches, CEs—the "gold standard" for precision—are computationally prohibitive for large-scale retrieval. Conventional wisdom suggests that CEs are incapable of producing standalone sentence embeddings. However, recent research challenges this assumption, revealing that early layers of CEs contain potent signals that can be "infused" into lightweight DEs to achieve high performance with massive speedups.

The Dual vs. Cross Encoder Trade-off

Information retrieval systems generally utilize two distinct architectures:

  • Dual Encoders (DEs): Models like SBERT map sentences into a shared vector space. This enables pre-computation of document embeddings and sub-millisecond retrieval. However, training effective DEs often requires complex hard-negative mining and vast datasets.
  • Cross Encoders (CEs): These models process a query and document pair simultaneously, capturing intricate interactions. While highly accurate, they must be run at inference time for every potential pair, making them suitable only for re-ranking a small subset of candidates.

Methodology: Knowledge Infusion

The researchers explored whether the internal representations of a pre-trained CE could be repurposed for standalone embedding tasks. They proposed a "DE-2 CE" architecture—a minimal two-layer Dual Encoder initialized with weights "stolen" from a CE.

Weight infusion from a Cross Encoder into a 2-layer Dual Encoder.

The infusion process involves:

  1. Embedding Extraction: To generate embeddings from a CE, a sentence is paired with itself, and mean pooling is applied across tokens at specific layers.
  2. Weight Transfer: The Embedding Layer and Encoding Layer 0 are copied directly from a pre-trained CE into the DE. A second layer (Layer 1) is added with random initialization, and the entire model is fine-tuned on the MS MARCO dataset.

The Early Layer Phenomenon

A critical discovery of this work is that CE embeddings are highly effective in early layers but lose their utility in deeper layers. In early stages, the model appears to capture general semantic meaning. As data progresses through the network, the representations shift toward computing specific interactions between the input pair, rendering them useless as standalone embeddings.

Performance of sentence embeddings across layers for Dual Encoders (DE) and Cross Encoders (CE).

Interestingly, the first layer of a CE was found to be a significantly better "teacher" than the first layer of a standard DE, outperforming it by an average of 29.5% in retrieval tasks. This suggests the CE training objective forces the model to learn more robust representations much earlier in its architecture.

Results and Efficiency

The study evaluated this infusion technique across 12 diverse datasets, including the BEIR benchmark and MS MARCO. The results demonstrate that the tiny DE-2 CE model is a viable alternative to standard 12-layer transformers:

  • Speed: The 2-layer model achieved a 5.15x speedup in inference time compared to 12-layer baselines.
  • Accuracy: On 6 out of 12 datasets, the DE-2 CE model remained within 1% accuracy of the full-sized baseline.
  • Weight Significance: The infused model consistently outperformed a 2-layer model initialized with random weights, proving that the specific weights learned by the CE are the primary drivers of performance.

Conclusion

By challenging the assumption that Cross Encoders cannot produce useful embeddings, this research opens a new path for building efficient IR systems. "Infusing" early-layer CE knowledge into lightweight Dual Encoders allows for the creation of models that are significantly faster than standard baselines without sacrificing substantial accuracy. Future work may extend these "infusion recipes" to multi-lingual contexts and larger architectural families.

Summary updated

Abstract

Cross encoders (CEs) are trained with sentence pairs to detect relatedness. As CEs require sentence pairs at inference, the prevailing view is that they can only be used as re-rankers in information retrieval pipelines. Dual encoders (DEs) are instead used to embed sentences, where sentence pairs are encoded by two separate encoders with shared weights at training, and a loss function that ensures the pair's embeddings lie close in vector space if the sentences are related. DEs however, require much larger datasets to train, and are less accurate than CEs. We report a curious finding that embeddings from earlier layers of CEs can in fact be used within an information retrieval pipeline. We show how to exploit CEs to distill a lighter-weight DE, with a 5.15x speedup in inference time.
BibTeX
@misc{ananthakrishnan2025can,
  author = {Haritha Ananthakrishnan and Julian Dolby and Harsha Kokel and Horst Samulowitz and Kavitha Srinivas},
  title = {{Can Cross Encoders Produce Useful Sentence Embeddings?}},
  year = {2025},
  eprint = {2502.03552},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.03552},
}
Figure