Distillation versus Contrastive Learning: How to Train Your Rerankers

Zhichao Xu, Zhiqi Huang, Shengyao Zhuang, Vivek Srikumar
7/11/2025
cs.CLcs.IR

No official code found. Best implementation: zhichaoxu-shufe/distillation-versus-contrastive-learning (1 star, Apache-2.0, last commit 2025-11-02).

Abstract

Training effective text rerankers is crucial for information retrieval. Two strategies are widely used: contrastive learning (optimizing directly on ground-truth labels) and knowledge distillation (transferring knowledge from a larger reranker). While both have been studied extensively, a clear comparison of their effectiveness for training cross-encoder rerankers under practical conditions is needed. This paper empirically compares these strategies by training rerankers of different sizes (0.5B, 1.5B, 3B, 7B) and architectures (Transformer, Recurrent) using both methods on the same data, with a strong contrastive learning model acting as the distillation teacher. Our results show that knowledge distillation generally yields better in-domain and out-of-domain ranking performance than contrastive learning when distilling from a more performant teacher model. This finding is consistent across student model sizes and architectures. However, distilling from a teacher of the same capacity does not provide the same advantage, particularly for out-of-domain tasks. These findings offer practical guidance for choosing a training strategy based on available teacher models. We recommend using knowledge distillation to train smaller rerankers if a larger, more performant teacher is accessible; in its absence, contrastive learning remains a robust baseline. Our code implementation is made available to facilitate reproducbility.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Official repo for Distillation versus Contrastive Learning: How to Train Your Rerankers, IJCNLP-AACL 2025 Findings

10Shell, PythonNov 2, 202511 months agoApache-2.0

Similar Papers

Cite this paper

@article{xu2025distillation,
  title  = {Distillation versus Contrastive Learning: How to Train Your Rerankers},
  author = {Zhichao Xu and Zhiqi Huang and Shengyao Zhuang and Vivek Srikumar},
  year   = {2025},
  eprint = {2507.08336},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.08336v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.08336.svg)](https://codeofpaper.com/paper/2507.08336)

Discussion