NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DearKD: Data-Efficient Early Knowledge Distillation for Vision Transformers

Xianing Chen, Qiong Cao, Yujie Zhong, Jing Zhang, Shenghua Gao, Dacheng Tao

Vision Transformers (ViTs) have demonstrated remarkable performance in computer vision, yet they typically require massive datasets to outperform traditional Convolutional Neural Networks (CNNs). This "data hunger" stems from a lack of inductive biases—such as locality and translation equivariance—that are natively present in CNN architectures. This paper introduces DearKD (Data-efficient EARly Knowledge Distillation), a framework designed to bridge this gap by teaching ViTs to leverage CNN-like structural assumptions during the early stages of training.

The Challenge of Inductive Bias

While CNNs are designed with built-in assumptions about spatial relationships (e.g., nearby pixels are related), ViTs are "blank slates" that use self-attention to model global dependencies from the start. Consequently, ViTs must learn basic spatial features from scratch, necessitating large-scale data. Existing Knowledge Distillation (KD) methods, like DeiT, often focus on final output (logits), neglecting the rich intermediate representations in a CNN's early layers that capture fundamental textures and local patterns.

The DearKD Framework

The authors propose a two-stage training strategy to instill these missing biases into ViTs efficiently.

Overview of the DearKD two-stage distillation framework. Stage I focuses on early knowledge distillation from a CNN teacher, while Stage II allows for intrinsic transformer learning.

Stage I: Early Knowledge Distillation

In the first stage, the ViT is "taught" the inductive biases of a pre-trained CNN teacher.

  • Multi-Head Convolutional-Attention (MHCA): The standard attention mechanism is augmented with relative position encoding, enabling it to mimic convolutional behavior.
  • The Aligner Module: To bridge the architectural gap between CNN feature maps and ViT tokens, an aligner module uses depth-wise convolutions and interpolation to match feature dimensions, allowing for direct intermediate layer distillation via Mean Squared Error (MSE) loss.

Stage II: Intrinsic Learning

After the ViT has acquired basic spatial features, the distillation constraints are relaxed. The model transitions to standard training, allowing the transformer to evolve beyond local constraints and leverage its full capacity for modeling long-range dependencies—the primary strength of the transformer architecture.

Data-Free Extension (DF-DearKD)

For scenarios where real training data is unavailable, the authors extend the framework using DeepInversion to synthesize images from a pre-trained teacher. To prevent the common issue of "mode collapse" in synthetic data, they introduce a boundary-preserving intra-divergence loss. This ensures the generated samples are diverse, pushing "easy" positive samples apart in the latent space to improve the robustness of the student's learning.

Key Results and Insights

The researchers evaluated DearKD on ImageNet-1K across various data scales (10%, 25%, 50%, and 100%).

Performance comparison on ImageNet-1K. DearKD-Ti consistently outperforms the DeiT baseline across all data scales, achieving parity with full-data baselines using only 50% of the training images.
  • Superior Efficiency: DearKD-Ti trained on only 50% of ImageNet achieved 72.3% accuracy, surpassing the baseline DeiT-Ti trained on 100% of the data (72.2%).
  • State-of-the-Art Performance: On the full ImageNet-1K dataset, DearKD-Ti reached 74.8%, a significant +2.6% improvement over standard DeiT.
  • Data-Free Success: In the zero-real-data setting, DF-DearKD achieved 71.2% on ImageNet, coming within 1.0% of the performance of models trained on the full real dataset.

The authors also observed that the "average attention distance" increases as the model moves from Stage I to Stage II. This confirms that the ViT initially focuses on local pixels (mimicking a CNN) before naturally expanding its scope to global context, validating the two-stage approach.

Conclusion

DearKD effectively addresses the data-efficiency problem in Vision Transformers by strategically applying knowledge distillation to early layers and early training epochs. By providing a "convolutional head start" and then allowing for intrinsic transformer evolution, DearKD achieves state-of-the-art results even with limited or entirely synthetic data. Future work will explore broader types of inductive biases and more efficient model inversion techniques.

Summary updated

BibTeX
@inproceedings{chen2022dearkd,
  author = {Xianing Chen and Qiong Cao and Yujie Zhong and Jing Zhang and Shenghua Gao and Dacheng Tao},
  title = {{DearKD: Data-Efficient Early Knowledge Distillation for Vision Transformers}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure