Skip to main content
QUICK REVIEW

[Paper Review] Training data-efficient image transformers & distillation through attention

Hugo Touvron, Matthieu Cord|arXiv (Cornell University)|Dec 23, 2020
Currency Recognition and DetectionComputer Science130 citations
TL;DR

The paper trains convolution-free vision transformers on ImageNet only with data-efficient methods, introduces a transformer-specific distillation token, and shows competitive accuracy and transfer performance compared to convnets, including strong ImageNet results with distillation.

ABSTRACT

Recently, neural networks purely based on attention were shown to address image understanding tasks such as image classification. However, these visual transformers are pre-trained with hundreds of millions of images using an expensive infrastructure, thereby limiting their adoption. In this work, we produce a competitive convolution-free transformer by training on Imagenet only. We train them on a single computer in less than 3 days. Our reference vision transformer (86M parameters) achieves top-1 accuracy of 83.1% (single-crop evaluation) on ImageNet with no external data. More importantly, we introduce a teacher-student strategy specific to transformers. It relies on a distillation token ensuring that the student learns from the teacher through attention. We show the interest of this token-based distillation, especially when using a convnet as a teacher. This leads us to report results competitive with convnets for both Imagenet (where we obtain up to 85.2% accuracy) and when transferring to other tasks. We share our code and models.

Motivation & Objective

  • Demonstrate that convolution-free vision transformers can reach competitive ImageNet performance using only ImageNet data and modest compute.
  • Introduce a transformer-specific distillation method based on a distillation token to transfer knowledge from a teacher.
  • Evaluate the impact of different teachers (convnets vs transformers) on distillation and overall performance.
  • Assess transfer learning capabilities of DeiT models on downstream image classification benchmarks.

Proposed method

  • Adopt a ViT-like architecture (DeiT) with patch tokens, a class token, and a new distillation token.
  • Train on ImageNet1k on a single 8-GPU node (53 hours pre-training; ~3 days total) with strong data augmentation to enable data efficiency.
  • Propose and formalize distillation strategies: soft distillation (KL divergence with temperature) and hard distillation (teacher’s hard label), plus a transformer-specific distillation token.
  • Show that the distillation token interacts with class/distillation tokens via self-attention and enables effective knowledge transfer from teachers.
  • Fine-tune at higher resolution using distillation, and perform late fusion of class and distillation classifiers during testing.
  • Provide ablations on hyperparameters, data augmentation, and training regimes to identify key ingredients for data-efficient training.

Experimental results

Research questions

  • RQ1Can vision transformers be trained effectively on ImageNet without external data or massive pre-training?
  • RQ2Does a transformer-specific distillation token improve student performance over vanilla distillation or no distillation?
  • RQ3How does the choice of teacher (convnet vs transformer) affect distillation gains?
  • RQ4Do DeiT models pre-trained on ImageNet transfer competitively to downstream tasks compared to convnets and other transformers?

Key findings

  • DeiT models trained on ImageNet1k alone achieve competitive top-1 accuracy with no external data (e.g., DeiT-B reaches 83.1% on 224 with 300-epoch pre-training).
  • With distillation via the proposed distillation token, DeiT achieves up to 85.2% top-1 on ImageNet-1k, outperforming a ViT-B model pre-trained on JFT-300M under similar conditions.
  • Convnet teachers generally yield better distillation performance than transformer teachers, indicating stronger inductive biases aid training of transformers.
  • The distillation-based DeiT models offer favorable trade-offs between accuracy and throughput, often rivaling or surpassing EfficientNet on ImageNet when trained on ImageNet alone.
  • DeiT models transfer effectively to downstream tasks (CIFAR-10/100, Flowers-102, Stanford Cars, iNaturalist) and perform on par with competitive convnet models after ImageNet pre-training.
  • Longer training schedules for distilled models yield continued gains, whereas non-distilled models tend to saturate earlier.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.