Multi-view contrastive learning for online knowledge distillation

Chuanguang Yang

TL;DR

This paper introduces Multi-view Contrastive Learning for Online Knowledge Distillation (MCL-OKD), a novel approach that enhances knowledge transfer between peer networks by focusing on learning discriminative feature representations, not just class probabilities. MCL-OKD significantly outperforms existing methods on image classification and few-shot learning tasks, achieving better performance without increasing inference costs.

What Problem Does This Paper Address?

Deploying deep neural networks for image classification on resource-constrained edge devices is challenging due to their computational demands. Knowledge Distillation (KD) offers a solution by transferring knowledge from a large "teacher" model to a smaller "student" model. However, Online Knowledge Distillation (OKD) is a more practical variant where multiple student models learn collaboratively from scratch, without a pre-trained teacher. Existing OKD methods primarily focus on exchanging class probability distributions, neglecting the richer information contained in the learned feature representations. This paper addresses the gap of effectively transferring this "representational knowledge" among peer networks in an OKD setting.

Methods

The core innovation is the introduction of Multi-view Contrastive Learning (MCL) within the OKD framework. Here's how it works:

  • Multiple Peer Networks: The system uses multiple (M) identical neural networks, each acting as a "peer." These peers process the same input data.
  • Feature Embeddings as Views: Each peer network extracts feature embeddings from the input. These embeddings, derived from different peers, are treated as different "views" of the same data instance.
  • Contrastive Learning Objective: MCL aims to maximize the agreement between embeddings of the same data instance from different views (positive pairs) while pushing apart embeddings of different data instances (negative pairs). This is achieved by learning a linear transformation to a shared embedding space and applying a contrastive loss.
  • Ensemble Teacher: An ensemble of all peer networks forms an "online teacher." This teacher then distills probabilistic knowledge to a designated "main" student network, which is used for deployment.
  • Combined Loss: The overall learning objective for MCL-OKD is a combination of:
  • Cross-Entropy Loss ($L_{ce}$): Standard supervised learning loss for each peer network.
  • KL Divergence Loss ($L_{kl}$): For distilling probabilistic knowledge from the ensemble teacher to the main student.
  • Contrastive Loss ($L_{contrast}$): The novel component, encouraging discriminative representations across peer networks.

Crucially, the contrastive learning uses a memory bank to efficiently access negative samples, and the final deployment only uses the main student network, ensuring no additional inference cost.

Datasets

The paper evaluates MCL-OKD on the following standard image classification and few-shot learning benchmarks:

  • CIFAR-100: A dataset with 100 classes and 32x32 resolution images.
  • ImageNet: A large-scale dataset with 1000 classes and 224x224 resolution images.
  • miniImageNet: Used for few-shot learning evaluation, a subset of ImageNet.

Key Insights and Ideas

  • Representational Knowledge is Key: The most significant insight is that focusing on learning discriminative feature representations through contrastive learning is more effective for OKD than solely relying on probability distribution matching. This is because representations capture deeper semantic information.
  • "Views" from Peer Networks: The paper cleverly frames the embeddings from different peer networks as distinct "views" of the data, enabling the application of powerful multi-view contrastive learning techniques.
  • No Inference Cost Penalty: A major advantage is that MCL-OKD achieves superior performance without increasing the inference time or computational cost of the final deployed model, as only one network is used at test time.
  • Superiority in Metric Learning: The method's effectiveness in few-shot learning highlights its strength in learning a discriminative feature space, which is crucial for tasks where few examples are available per class.

Key Results

  • Image Classification: MCL-OKD consistently outperforms state-of-the-art OKD methods (DML, CL-ILR, ONE, OKDDip) on CIFAR-100 and ImageNet. For instance, on CIFAR-100, it achieves an absolute 1.84% reduction in error rate compared to OKDDip on average. On ImageNet, it shows a 0.79% margin improvement over the baseline.
  • Few-Shot Learning: MCL-OKD achieves the highest accuracy on miniImageNet for few-shot learning, outperforming other OKD methods and even RKD (a SOTA KD method for few-shot learning that requires a pre-trained teacher).
  • Training Complexity: While MCL adds some computational overhead during training (e.g., contrastive computing), the overall training time is comparable to existing methods. The memory bank for negative samples adds about 600MB per peer network.

Limitations and Future Work

  • Training Complexity: While inference is efficient, the training process involves multiple peer networks and a memory bank, increasing computational and memory demands during training. The paper notes that the memory bank requires about 600MB per peer network.
  • Hyperparameter Tuning: The effectiveness of the contrastive loss is dependent on hyperparameters like temperature ($\tau$) and the balancing factor ($\beta$), which might require careful tuning.
  • Future Work: The paper implicitly suggests that further exploration of how different "views" can be generated and combined within the contrastive framework could lead to even more powerful representation learning for OKD. The success in few-shot learning also points towards its potential in other metric learning applications.

Summary updated

Abstract

Previous Online Knowledge Distillation (OKD) often carries out mutually exchanging probability distributions, but neglects the useful representational knowledge. We there-fore propose Multi-view Contrastive Learning (MCL) for OKD to implicitly capture correlations of feature embeddings encoded by multiple peer networks, which provide various views for understanding the input data instances. Benefiting from MCL, we can learn a more discriminative representation space for classification than previous OKD methods. Experimental results on image classification demonstrate that our MCL-OKD outperforms other state-of-the-art OKD methods by large margins without sacrificing additional inference cost. Codes are available at https://github.com/winycg/MCL-OKD.
BibTeX
@inproceedings{yang2021multi,
  author = {Chuanguang Yang},
  title = {{Multi-view contrastive learning for online knowledge distillation}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2021},
  doi = {10.1109/icassp39728.2021.9414664},
}
Figure