Distribution Shift Matters for Knowledge Distillation with Webly Collected Images

Jialiang Tang, Shuo Chen, Gang Niu, Masashi Sugiyama, Chen Gong

Introduction

Knowledge Distillation (KD) is a powerful technique for compressing large "teacher" models into smaller, more efficient "student" models. Traditionally, this process requires access to the original training data. However, privacy concerns and storage limitations often make this data unavailable. While data-free KD methods using synthetic or web-scraped images have emerged, they face significant challenges. Specifically, web-scraped data often suffers from "distribution shift"—a gap in style and concept between the web images and the original training set.

The Challenge of Distribution Shift

When using web-collected images as proxies for original data, the student network often encounters instances that deviate from the target distribution. These deviations can be stylistic (e.g., sketches or cartoons instead of real photos) or conceptual (e.g., cat food instead of a cat).

Distribution shift in webly collected data.

Existing methods frequently ignore these shifts, leading to "unreliable" student networks that fail to generalize to the target task. The performance degradation caused by these stylistic and conceptual gaps is a primary hurdle for web-based distillation.

The $KD^3$ Framework

To address these issues, the authors propose $KD^3$ (Knowledge Distillation between Different Distributions). This framework integrates three core components designed to mitigate the impact of distribution shift by dynamically selecting relevant data and learning invariant features.

The $KD^3$ framework architecture.

1. Teacher-Student Dynamic Instance Selection

Rather than treating all web data equally, $KD^3$ dynamically filters images. Initially, it leverages the teacher’s high-confidence predictions to identify useful samples. As training progresses, a time-dependent function ($\alpha(t)$) gradually shifts the selection criteria to favor images that are most informative for the student's current learning state, ensuring the data remains relevant as the student improves.

2. Classifier Sharing and Feature Alignment

To ensure effective knowledge transfer, the student shares the teacher’s frozen final classifier layer. The student is then trained to align its internal feature representations with those of the teacher. A weighted loss function is employed, prioritizing images where both networks show high agreement, thereby reducing the influence of noisy or irrelevant web data that doesn't fit the target distribution.

3. MixDistribution Contrastive Learning

The most technical innovation is the MixDistribution block. Recognizing that distribution shifts are often encoded in image statistics (mean and variance), this block generates "perturbed" images by mixing statistical profiles. The student learns to produce invariant features across original and perturbed versions, effectively focusing on core content while ignoring stylistic variations.

Experimental Results

The framework was evaluated on standard benchmarks including CIFAR-10, CIFAR-100, and TinyImageNet, using diverse web-collected proxies like MNIST-M and SVHN.

Key findings include:

  • Superior Performance: $KD^3$ consistently outperformed state-of-the-art data-free methods. On TinyImageNet, it achieved a +5.11% accuracy gain over the previous best method (DFND).
  • Architecture Robustness: The method remains effective even when the student and teacher architectures differ significantly (e.g., ResNet34 to MobileNetV2), often coming within 1-2% of the accuracy achieved by training on the original data.
  • Component Efficacy: Ablation studies confirmed that all three pillars—selection, alignment, and MixDistribution—are essential for optimal performance, with removing any component leading to drops of up to 5%.

Conclusion

$KD^3$ demonstrates that explicitly modeling and mitigating distribution shift is crucial for successful knowledge distillation using web-collected images. By combining dynamic instance selection with style-invariant representation learning, $KD^3$ bridges the gap between unavailable original data and accessible but noisy web proxies.

Summary updated

BibTeX
@inproceedings{tang2023distribution,
  author = {Jialiang Tang and Shuo Chen and Gang Niu and Masashi Sugiyama and Chen Gong},
  title = {{Distribution Shift Matters for Knowledge Distillation with Webly Collected Images}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
}
Figure