Abstract
Large Vision Foundation Models (LVFMs) offer state-of-the-art performance but are too computationally intensive for edge devices. Knowledge Distillation (KD) is typically used to transfer this performance to smaller "student" models, but significant architectural discrepancies often hinder effective learning. We present CustomKD, a novel framework that alternates between customizing teacher features to align with the student's perspective and standard distillation. CustomKD effectively bridges the gap between massive Vision Transformers and tiny edge models, showing superior scaling properties where traditional KD methods fail.
Introduction
The rise of Large Vision Foundation Models (LVFMs) like DINOv2 and CLIP has transformed computer vision. However, their deployment on resource-constrained edge devices remains a challenge due to their massive parameter counts. While Knowledge Distillation (KD) aims to train small student models to mimic these giants, a "model discrepancy" often occurs. When a teacher is a large Vision Transformer (ViT) and the student is a small Convolutional Neural Network (CNN), the student struggles to map the teacher's complex feature space. Paradoxically, increasing the teacher's size often yields diminishing returns for the student in standard KD setups because the representational gap becomes too wide to bridge.
Methods: The CustomKD Framework
CustomKD addresses the architectural gap through a two-stage alternating training process designed to make teacher knowledge more "student-friendly."
- Feature Customization Stage: Instead of forcing the student to adapt to the teacher's raw features, this stage adapts the teacher's output. A small projection layer maps teacher features into the student's representation space, which are then passed through the student's own head classifier. By training only this projection layer on labeled data, the teacher's features are "customized" to be actionable for the specific student architecture.
- Knowledge Distillation Stage: The student is trained to simultaneously imitate task-general knowledge (original foundation model features) and task-specific knowledge (the customized features).
These stages alternate every epoch, ensuring the teacher's features evolve alongside the student's progress. This approach adds no overhead to final inference, as the teacher and projection layers are discarded after training.
Key Results and Scaling
CustomKD demonstrates a unique ability to benefit from larger teachers, a property lacking in many baseline KD methods. As shown in Figure 4, while standard methods like FitNet or Logit distillation often stagnate or even decline when moving from a small to a large teacher, CustomKD shows consistent performance gains.
On the CIFAR-100 benchmark (SSL with 400 labels), CustomKD achieved an error rate of 32.51%, significantly lower than the ~48-49% seen in Soft Target or Logit distillation. In Unsupervised Domain Adaptation (UDA) on OfficeHome, CustomKD reached 74.63% accuracy, outperforming the 46.39% baseline and 65.81% for FitNet. Notably, a tiny 1.48M parameter MobileNetV3 distilled via CustomKD can outperform a 21.5M parameter DINOv2 (ViT-S) trained with linear probing.
Conclusion
CustomKD provides a robust solution for deploying the power of foundation models onto edge devices. By prioritizing the "digestibility" of teacher features for specific student architectures, it overcomes the traditional barriers of model discrepancy. Future work will explore extending this framework to dense prediction tasks like object detection and semantic segmentation, where spatial geometry plays a more critical role.
Summary updated