TL;DR
The authors introduce DeiT (Data-efficient image Transformers), a training strategy that allows Vision Transformers (ViT) to achieve state-of-the-art results using only the standard ImageNet-1k dataset. By introducing a novel distillation token, they enable Transformers to learn effectively from Convolutional Neural Network (CNN) teachers, surpassing previous benchmarks without requiring hundreds of millions of private images.
What Problem Does This Paper Address?
For years, Convolutional Neural Networks (CNNs) have been the kings of computer vision due to their "inductive biases"—built-in assumptions like locality (pixels near each other are related) and translation invariance. When the Vision Transformer (ViT) arrived, it showed that "attention-only" models could match or beat CNNs, but with a massive catch: they were incredibly data-hungry.
Original ViT models required pre-training on Google’s private JFT-300M dataset (300 million images) to perform well. When trained on the standard ImageNet-1k (1.2 million images), they lagged significantly behind CNNs. This created a barrier to entry, as only organizations with massive datasets and compute clusters could train top-tier vision models. This paper tackles the challenge of making Transformers "data-efficient"—achieving high performance using only publicly available datasets and modest academic-scale compute.
Methods
The researchers built upon the standard ViT architecture but introduced two major innovations to improve data efficiency:
- The Distillation Token: In a standard Transformer, a "class token" (CLS) is used to aggregate information for the final classification. The authors added a second special token: the distillation token. This token interacts with the image patches and the CLS token through self-attention. Its specific job is to reproduce the label predicted by a "teacher" model (typically a high-performing CNN).
- Hard-Label Distillation: Instead of using "soft" probabilities from the teacher (the standard approach), the authors found that using the teacher's "hard" prediction (the single best category) as a ground-truth label worked significantly better for Transformers.
- Aggressive Training Recipe: To compensate for the lack of inductive bias, the authors utilized a heavy suite of data augmentations (Rand-Augment, Mixup, Cutmix) and regularization techniques (Stochastic Depth, Repeated Augmentation).
Crucially, they demonstrated that these models could be trained on a single 8-GPU node in less than three days, a massive reduction in the resources typically associated with high-end Transformer training.
Datasets
The primary training and evaluation were performed on:
- ImageNet-1k: The standard benchmark for image classification.
- ImageNet-V2 & ImageNet-Real: Used to test the robustness and generalization of the models on different test distributions.
- Transfer Learning Benchmarks: CIFAR-10, CIFAR-100, Oxford-102 Flowers, Stanford Cars, and iNaturalist-18/19 were used to show that DeiT generalizes well to niche tasks.
Key Insights and Ideas
- CNNs make better teachers: Surprisingly, a Transformer student learns better from a CNN teacher than from another Transformer. The authors hypothesize that the student "inherits" the CNN’s inductive biases through distillation, effectively learning the "rules of vision" that Transformers usually struggle to find on their own.
- The tokens diverge: By the end of the network, the CLS token and the distillation token are highly correlated but not identical. They focus on slightly different aspects of the image, and "fusing" their predictions at test time yields the best results.
- Transformers are "optimization-sensitive": Unlike CNNs, which are relatively robust to hyperparameter choices, Transformers require a very specific recipe of augmentation and initialization to converge when data is scarce.
Key Results
- Top-tier Accuracy: A base DeiT model (DeiT-B) trained only on ImageNet-1k achieved 83.1% top-1 accuracy.
- Distillation Boost: When distilled from a RegNet (CNN) teacher, the same model reached 84.4% top-1 accuracy.
- Efficiency: DeiT-B is highly competitive with the popular EfficientNet family in terms of the trade-off between accuracy and throughput (images processed per second).
- State of the Art: When fine-tuned at a higher resolution (384x384), DeiT reached 85.2% top-1 accuracy, outperforming the original ViT that was trained on 300x more data.
Limitations and Future Work
While the paper successfully democratizes Transformer training, some limitations remain:
- Dependence on Augmentation: The performance is highly dependent on a complex "bag of tricks" for data augmentation. Without these, the model's performance collapses.
- Teacher Dependency: The best results require a pre-trained CNN teacher. While this is common, it means the Transformer is still somewhat "tethered" to the convolutional paradigm it aims to replace.
- Hardware Specifics: Throughput was measured on V100 GPUs; performance on edge devices or different architectures (like TPUs) may vary due to how attention mechanisms are optimized in hardware.
The authors suggest that future research should focus on further refining the distillation process and exploring how these data-efficient Transformers perform on even more complex tasks like object detection and segmentation.
Summary updated