Wasserstein Contrastive Representation Distillation

Liqun Chen, Zhe Gan, Dong Wang, Jingjing Liu, Ricardo Henao, Lawrence Carin · DOI

Abstract

The primary goal of knowledge distillation (KD) is to encapsulate the information of a model learned from a teacher network into a student network, with the latter being more compact than the former. Existing work, e.g., using Kullback-Leibler divergence for distillation, may fail to capture important structural knowledge in the teacher network and often lacks the ability for feature generalization, particularly in situations when teacher and student are built to address different classification tasks. We propose Wasserstein Contrastive Representation Distillation (WCoRD), which leverages both primal and dual forms of Wasserstein distance for KD. The dual form is used for global knowledge transfer, yielding a contrastive learning objective that maximizes the lower bound of mutual information between the teacher and the student networks. The primal form is used for local contrastive knowledge transfer within a mini-batch, effectively matching the distributions of features between the teacher and the student networks. Experiments demonstrate that the proposed WCoRD method outperforms state-of-the-art approaches on privileged information distillation, model compression and cross-modal transfer.

Introduction

Knowledge Distillation (KD) has emerged as a cornerstone technique for model compression, enabling the training of efficient "student" networks under the guidance of high-capacity "teacher" models. Traditional KD approaches typically minimize the Kullback-Leibler (KL) divergence between output logits. However, this focus on final probabilities often neglects the rich, high-dimensional structural information present in intermediate layers. While recent methods like Contrastive Representation Distillation (CRD) have attempted to bridge this gap using contrastive learning, they often struggle with numerical instability and the rigid assumption of one-to-one feature matching, which can hinder generalization across diverse architectures.

Methodology: The WCoRD Framework

WCoRD addresses these challenges by employing the Wasserstein Distance (WD) as a geometrically-aware metric for feature alignment. The framework uniquely integrates both the dual and primal forms of WD to capture both global and local structural knowledge.

Global Contrastive Knowledge Transfer (GCKT)

Utilizing the dual form of the Wasserstein distance, GCKT aims to maximize the mutual information between teacher and student representations globally. As illustrated in Figure 1, a "critic" network is trained to distinguish between congruent pairs (features from the same input) and incongruent pairs (features from different inputs). To ensure stability and prevent mode collapse—common issues in standard contrastive learning—WCoRD enforces a 1-Lipschitz constraint on the critic through spectral normalization.

Global Contrastive Knowledge Transfer (GCKT) using the dual form of Wasserstein distance.

Local Contrastive Knowledge Transfer (LCKT)

Complementing the global view, LCKT uses the primal form of the Wasserstein distance to match feature distributions within a mini-batch. Unlike rigid one-to-one matching, LCKT allows for a soft, many-to-many alignment, encouraging the student to learn the local neighborhood structure of the teacher's feature space. This optimization is performed efficiently using the Sinkhorn algorithm, providing a differentiable and robust regularization signal.

Experimental Results

The effectiveness of WCoRD was evaluated across standard benchmarks (CIFAR-100, ImageNet), cross-modal transfer tasks, and specialized medical imaging datasets.

Model Compression

On CIFAR-100, WCoRD consistently outperformed state-of-the-art distillation methods across a variety of teacher-student pairs, including both similar and dissimilar architectures. For instance, in the WRN-40-2 to WRN-16-2 distillation task, WCoRD+KD achieved a top-1 accuracy of 76.11%, surpassing the 75.64% achieved by CRD+KD.

Performance comparison on CIFAR-100 across various teacher-student architecture pairs.

On ImageNet, distilling a ResNet-34 into a ResNet-18, WCoRD+KD achieved a Top-1 error of 28.44%, demonstrating its scalability to large-scale datasets.

Cross-Modal and Privileged Information Distillation

WCoRD showed significant gains in cross-modal transfer (Luminance to Chrominance), achieving 75.43% accuracy. In the domain of privileged information for medical imaging (OCT-GA dataset), WCoRD achieved an AUC of 84.50%, representing a substantial improvement over baseline students and existing distillation techniques.

Discussion and Conclusion

The success of WCoRD lies in the synergy between its dual and primal components. The dual form provides a stable global objective for mutual information maximization, while the primal form offers a flexible local structural regularizer. By relaxing the requirement for exact feature mimicry and ensuring gradient stability through Lipschitz constraints, WCoRD provides a more robust and generalizable framework for knowledge transfer. Future work may explore its application in federated learning and enhancing adversarial robustness.

Summary updated

BibTeX
@inproceedings{chen2020wasserstein,
  author = {Liqun Chen and Zhe Gan and Dong Wang and Jingjing Liu and Ricardo Henao and Lawrence Carin},
  title = {{Wasserstein Contrastive Representation Distillation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr46437.2021.01603},
}
Figure