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.
The infusion process involves:
- Embedding Extraction: To generate embeddings from a CE, a sentence is paired with itself, and mean pooling is applied across tokens at specific layers.
- 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.
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