Bridging Contrastive Learning and Domain Adaptation: Theoretical Perspective and Practical Application
Gonzalo Iñaki Quintana, Laurence Vancamberg, Vincent Jugnon, Agnès Desolneux, Mathilde Mougeot
TL;DR
This paper connects contrastive learning with domain adaptation by showing that standard contrastive losses $ ext{$ ext{L}_{NT-Xent}$}$ and $ ext{$ ext{L}_{SupContr}$}$ implicitly reduce the class-wise maximum mean discrepancy $CMMD$, thereby aligning class-conditional embeddings across domains. Through a high-temperature approximation, the authors link $ au ext{L}_{Contr}$ to $CMMD^2$, and extend the theory to inter-class MMD (IMMD), HSIC, and a new DCMMD measure, highlighting how improved domain alignment also enhances class separability. Theoretical results are validated empirically on mammography datasets, including a synthetic patch dataset, showing that SupCon-based training yields better domain adaptation and downstream classification performance in most scenarios, with domain-invariance visualizations supporting the findings. The work provides a solid theoretical foundation for applying contrastive learning to domain adaptation in medical imaging and offers practical guidance for initialization and transfer learning in DA-enabled CL pipelines.
Abstract
This work studies the relationship between Contrastive Learning and Domain Adaptation from a theoretical perspective. The two standard contrastive losses, NT-Xent loss (Self-supervised) and Supervised Contrastive loss, are related to the Class-wise Mean Maximum Discrepancy (CMMD), a dissimilarity measure widely used for Domain Adaptation. Our work shows that minimizing the contrastive losses decreases the CMMD and simultaneously improves class-separability, laying the theoretical groundwork for the use of Contrastive Learning in the context of Domain Adaptation. Due to the relevance of Domain Adaptation in medical imaging, we focused the experiments on mammography images. Extensive experiments on three mammography datasets - synthetic patches, clinical (real) patches, and clinical (real) images - show improved Domain Adaptation, class-separability, and classification performance, when minimizing the Supervised Contrastive loss.
