[Paper Review] TinyViT: Fast Pretraining Distillation for Small Vision Transformers
TinyViT introduces a fast pretraining distillation framework to train tiny vision transformers by transferring knowledge from large pretrained teachers, achieving strong ImageNet and downstream task performance with much fewer parameters.
Vision transformer (ViT) recently has drawn great attention in computer vision due to its remarkable model capability. However, most prevailing ViT models suffer from huge number of parameters, restricting their applicability on devices with limited resources. To alleviate this issue, we propose TinyViT, a new family of tiny and efficient small vision transformers pretrained on large-scale datasets with our proposed fast distillation framework. The central idea is to transfer knowledge from large pretrained models to small ones, while enabling small models to get the dividends of massive pretraining data. More specifically, we apply distillation during pretraining for knowledge transfer. The logits of large teacher models are sparsified and stored in disk in advance to save the memory cost and computation overheads. The tiny student transformers are automatically scaled down from a large pretrained model with computation and parameter constraints. Comprehensive experiments demonstrate the efficacy of TinyViT. It achieves a top-1 accuracy of 84.8% on ImageNet-1k with only 21M parameters, being comparable to Swin-B pretrained on ImageNet-21k while using 4.2 times fewer parameters. Moreover, increasing image resolutions, TinyViT can reach 86.5% accuracy, being slightly better than Swin-L while using only 11% parameters. Last but not the least, we demonstrate a good transfer ability of TinyViT on various downstream tasks. Code and models are available at https://github.com/microsoft/Cream/tree/main/TinyViT.
Motivation & Objective
- Motivate the development of efficient tiny vision transformers for devices with limited resources.
- Enable small ViTs to benefit from large-scale pretraining data via distillation.
- Reduce training memory and compute costs for pretraining distillation.
- Propose a scalable framework to pretrain and compress tiny ViTs while maintaining transfer performance.
Proposed method
- Store sparse teacher logits and data augmentation metadata on disk to enable fast pretraining distillation without repeated teacher forward passes.
- Train small student ViTs with a distillation loss using recovered sparse soft labels from the stored teacher outputs.
- Use a label-free distillation setting that leverages soft teacher predictions rather than ground-truth labels.
- Progressively contract a large seed ViT to generate a family of TinyViT models under parameter and throughput constraints.
- Adopt a hierarchical Swin-like architecture with windowed attention and MBConv blocks to balance accuracy and efficiency.
- Pretrain on ImageNet-21k and finetune on ImageNet-1k, with optional higher-resolution finetuning to boost accuracy.
Experimental results
Research questions
- RQ1Can small vision transformers achieve competitive performance by distilling knowledge from large pretrained models during pretraining?
- RQ2How can distillation be made fast and scalable to avoid the memory/time burdens of large teachers?
- RQ3What is the effect of pretraining distillation on the transferability of tiny ViTs to downstream tasks?
- RQ4How does progressive model contraction impact the accuracy/efficiency trade-off for TinyViT?
Key findings
- TinyViT-21M achieves 84.8% top-1 on ImageNet-1k with 21M parameters after IN-21k pretraining and 30-epoch IN-1k finetuning.
- With higher input resolution, TinyViT reaches 86.5% top-1, slightly outperforming Swin-L while using ~11% of its parameters.
- TinyViT-21M pretrained with distillation on IN-21k transfers well to downstream tasks, e.g., COCO AP of 50.2 for object detection (2.1 points above Swin-T with 28M parameters).
- The fast pretraining distillation framework reduces memory and compute by storing sparse teacher logits and encoding data augmentation, enabling large-batch distillation without loading the teacher during training.
- Using higher-quality teacher models (Florence, CLIP-ViT-L/14, etc.) further improves TinyViT performance, while maintaining practical training costs due to on-disk logits.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.