Contrastive Knowledge Amalgamation for Unsupervised Image Classification

Shangde Gao, Yichao Fu, Ke Liu, Yuqiang Han

TL;DR

Contrastive Knowledge Amalgamation (CKA) is a novel framework that trains a single "student" model to master the combined expertise of multiple specialized "teacher" models without requiring any human-labeled data. By leveraging both intra-model and inter-model contrastive learning, the student model effectively navigates the conflicting signals of heterogeneous teachers to achieve performance that often surpasses the teachers themselves.

What Problem Does This Paper Address?

In the world of deep learning, we often have "specialist" models—one might be great at identifying car models, while another excels at bird species. Knowledge Amalgamation (KA) aims to create a "versatile" student model that can handle all these tasks simultaneously.

However, existing KA methods face three major hurdles:

  1. Heterogeneity: Teachers often have different architectures and specialized decision boundaries, making it hard for a student to align with all of them at once.
  2. Noisy Supervision: Previous methods relied heavily on KL divergence to match probability distributions. If a teacher is imperfect or the task is unsupervised, this signal becomes "confused" and noisy.
  3. Unlabeled Data: Training a versatile model usually requires massive labeled datasets. This paper focuses on the unsupervised setting, where the student must learn solely from the teachers' behaviors on unlabeled images.

Methods

The authors propose the CKA (Contrastive Knowledge Amalgamation) framework, which moves beyond simple output matching to deep feature alignment. Its architecture consists of four main components:

  • Margin-based Intra-model Contrast: Following the SimCLR paradigm, the student model learns robust representations by pulling together different augmented views of the same image and pushing away "negative" samples. A specific margin ($\alpha$) is added to prevent "easy negatives" from dominating the loss.
  • Distance-based Inter-model Contrast: This is the core innovation. Instead of just matching raw features, CKA treats the feature spaces of the teacher and student as "metric measure spaces." It calculates a transport map to ensure that if a teacher sees two images as semantically similar, the student learns to see them that way too, regardless of architectural differences.
  • Common Feature Alignment: Using Maximum Mean Discrepancy (MMD), the student and teachers project their features into a shared latent space. The student is trained to minimize the distribution difference between its features and the aggregated "hints" from all teachers.
  • Soft-target Distillation: Finally, the student's final classification layer is trained to match the concatenated "soft" predictions (probabilities) of all teachers using KL divergence.

Datasets

The researchers evaluated CKA on four popular fine-grained image classification benchmarks:

  • CUB-200-2011: 200 species of birds.
  • Stanford Dogs: 120 breeds of dogs.
  • Stanford Cars: 196 types of cars.
  • FGVC-Aircraft: 102 variants of aircraft.

To simulate the "specialist" environment, they split these datasets into non-overlapping categories to train separate teacher models (e.g., Teacher 1 learns the first 60 dog breeds, Teacher 2 learns the remaining 60).

Key Insights and Ideas

  • Semantic Consistency over Feature Mimicry: The "aha moment" here is that the student shouldn't just copy the teacher's feature vectors. Instead, it should copy the teacher's relational understanding—the relative distances between different samples in the feature space.
  • Teachers as Augmentation Schemes: The authors treat different teacher models as natural "augmentation schemes." By comparing how different models react to the same data, the student gains a more holistic view of the underlying features.
  • Robustness to Noise: By using contrastive losses rather than just cross-entropy or simple KL divergence, the student becomes more resilient to the "conflicting supervisions" that occur when two teachers have slightly different ways of looking at the world.

Key Results

CKA consistently outperformed standard Knowledge Distillation (Vanilla KD) and previous state-of-the-art methods like Common Feature Learning (CFL).

  • Superior Accuracy: On the Stanford Dogs dataset, the student (79.76%) significantly outperformed the individual teachers (66.64% and 72.03%) and even a simple ensemble of the teachers (73.90%).
  • Cross-Dataset Success: In a challenging scenario where one teacher knew about Cars and another knew about Aircraft, CKA achieved 88.21% accuracy on the merged task. Remarkably, this was higher than the 86.90% achieved by a "Supervised" model trained directly on the labels.
  • Ablation Proof: Removing the inter-model contrastive loss led to a significant drop in performance (e.g., from 82.88% down to 80.04% on the Cars dataset), proving that the relational alignment is critical.

Limitations and Future Work

While CKA shows impressive results, the paper notes a few areas for further exploration:

  • Hyper-parameter Sensitivity: The framework relies on several weighting factors ($\lambda$) and a margin ($\alpha$) that may require careful tuning depending on the specific tasks.
  • Computational Overhead: Training with multiple teachers and calculating MMD/transport maps in a shared MLP adds complexity to the training phase (though the final student model remains "lite" and efficient for deployment).
  • Task Diversity: The study focused on fine-grained image classification. Future work could investigate if this contrastive amalgamation holds up for more diverse tasks like object detection or segmentation.

Summary updated

BibTeX
@inproceedings{gao2023contrastive,
  author = {Shangde Gao and Yichao Fu and Ke Liu and Yuqiang Han},
  title = {{Contrastive Knowledge Amalgamation for Unsupervised Image Classification}},
  booktitle = {ICANN},
  year = {2023},
  url = {https://openreview.net/forum?id=fW4HkEvBx4},
}

Loading related content...

Figure