Enhancing Class-Imbalanced Learning with Pre-Trained Guidance through Class-Conditional Knowledge Distillation

Lan Li, Xin-Chun Li, Han-Jia Ye, De-Chuan Zhan

TL;DR

Standard knowledge distillation often fails on long-tailed datasets because it focuses on the wrong probability distribution. This paper introduces Class-Conditional Knowledge Distillation (CCKD), a method that leverages large-scale pre-trained models (like CLIP) to teach a student model the underlying structure of minority classes ($p(x|y)$) rather than just the final labels. Combined with data synthesis and feature imitation, this approach yields a massive 7.4% average accuracy improvement across major imbalanced benchmarks.

What Problem Does This Paper Address?

Real-world data is rarely balanced; it usually follows a "long-tail" distribution where a few categories have plenty of examples, but most have very few. This creates two massive headaches for machine learning:

  1. Classifier Bias: Models naturally gravitate toward favoring majority classes.
  2. Generalization Gap: For minority classes, there simply isn't enough data to learn a robust representation—a problem the authors liken to "making bricks without straw."

While Knowledge Distillation (KD) usually helps by having a "teacher" model guide a "student," traditional KD transfers the posterior probability $p(y|x)$ (the probability of a label given an image). On imbalanced data, this is problematic because the training distribution is skewed. If the student just mimics the teacher's output on this skewed data, it fails to learn the intrinsic features that define the rare classes.

Methods

The authors propose a paradigm shift in distillation for imbalanced learning:

Architecture of ACCKD
  • Class-Conditional Knowledge Distillation (CCKD): Instead of matching the teacher's raw predictions, the student is tasked with learning the teacher's class-conditional probability distribution $p(x|y)$. By applying Bayes' theorem, the authors derive a new loss function that isolates the data structure from the class imbalance, allowing the student to "see" what makes a minority class unique, regardless of how few samples are present.
  • Augmented CCKD (ACCKD): To further boost performance, the authors add two components:
  • Balanced Data Synthesis: They use Mixup and CutMix to create a synthetic, class-balanced dataset ($D_{mix}$). This ensures the student practices on a "fair" distribution.
  • Feature Imitation: A loss term encourages the student’s feature encoder to produce representations that are mathematically similar (via cosine similarity) to the teacher’s high-quality features.
  • Teacher Strategies: They explore three ways to utilize a pre-trained CLIP model as a teacher: Zero-shot (using text prompts), Nearest Class Mean (NCM), and parameter-efficient fine-tuning (Adaptformer).

Datasets

The researchers evaluated their method on three standard "Long-Tailed" (LT) benchmarks:

  • CIFAR-100-LT: A version of CIFAR-100 artificially skewed with an imbalance ratio of 100.
  • ImageNet-LT: A long-tailed subset of the massive ImageNet dataset containing 1,000 classes.
  • iNaturalist 2018: A naturally imbalanced dataset of 8,142 species, notoriously difficult due to its fine-grained categories.

Key Insights and Ideas

  • $p(x|y)$ is the Key: The core insight is that while $p(y|x)$ changes when moving from imbalanced training to balanced testing, the class-conditional distribution $p(x|y)$—the actual "look" of the class—remains stable. Distilling this is much more robust.
  • Pre-trained Models as Information Donors: Large models like CLIP have already "seen" the world. They act as the "straw" for the student's "bricks," providing the missing structural information about rare classes that isn't present in the small training set.
  • Reducing Feature Deviation: The authors show that minority classes usually suffer from high "feature deviation" (the gap between training and test feature centers). CCKD significantly narrows this gap, making features more generalizable.
  • Separability Matters: It’s not just about moving features to the right place; it’s about making them distinct. ACCKD produces much more separable feature clusters for minority classes compared to standard methods.

Key Results

The results show that CCKD/ACCKD consistently outperforms state-of-the-art baselines:

Accuracy comparison across class frequencies
  • ImageNet-LT: Using an "AF+LA" teacher, ACCKD achieved 55.4% accuracy, a significant jump from the 44.6% achieved by standard Logit Adjustment (LA) alone.
  • Minority Class Boost: The most dramatic gains were in the "Few-shot" categories (classes with <20 images). On ImageNet-LT, accuracy for these classes jumped from 26.4% to 46.5%.
  • iNaturalist 2018: Even on this massive, fine-grained dataset, the method provided a 9.1% improvement over the baseline when using a strong teacher.
  • Versatility: The method proved adaptable, showing gains even when swapped into other imbalanced learning frameworks like CDT or LADE.

Limitations and Future Work

  • Computational Overhead: Training with a large teacher model and generating synthetic data increases the computational budget and memory requirements during the training phase.
  • Teacher Quality: The student's performance is inherently tied to the teacher. If the pre-trained model (like CLIP) has a "blind spot" for a specific niche domain, the distillation might be less effective.
  • Hyperparameter Sensitivity: The method introduces balancing parameters and a temperature scaling factor that may require careful tuning for new datasets.

The authors suggest that future work could explore even more efficient ways to extract guidance from pre-trained models without needing the full teacher architecture present during every training step.

Summary updated

BibTeX
@inproceedings{li2024enhancing,
  author = {Lan Li and Xin-Chun Li and Han-Jia Ye and De-Chuan Zhan},
  title = {{Enhancing Class-Imbalanced Learning with Pre-Trained Guidance through Class-Conditional Knowledge Distillation}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=O4nXWHPl6g},
}
Figure