papers / vit2020
Next task →
Research Papers/CNN and vision/An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
CNN and vision · #5 · seminal

An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale

Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai et al. · 2020 · ICLR (2021)
reproduction difficulty: highComputer VisionTransformersDeep Learning

1. Research problem

Convolutions build in strong image priors; it was unclear whether a generic attention architecture could learn vision from data alone.

2. Motivation

The authors wanted to test whether the transformer's success in language transfers to images when pretraining at sufficient scale.

3. Previous approaches

CNNs dominated vision; earlier attention-augmented models still retained convolutional backbones and relied on them heavily.

4. Core contribution

Showed that a pure transformer applied to sequences of image patches matches or beats strong CNNs when pretrained on large datasets, with lower compute.

5. Mathematical formulation

Split an image into non-overlapping patches, linearly project each to a token, add positional embeddings, prepend a class token, and apply a standard transformer encoder.

6. Methodology

Pretrain with supervised classification at varying data scales and fine-tune on downstream benchmarks; compare compute against ResNets.

7. Architecture

Transformer encoder with multi-head self-attention and MLP blocks, with learned 1D position embeddings.

8. Experimental setup

Pretraining on ImageNet and JFT-300M, transfer to ImageNet, CIFAR, and VTAB-style tasks.

9. Datasets

ImageNet, JFT-300M, CIFAR-10/100, VTAB.

10. Results

With sufficient pretraining data, ViT exceeded comparable ResNets at lower pretraining compute and became the foundation for later vision models.

11. Limitations

Requires very large pretraining datasets to outperform CNNs; lacks translation equivariance and locality priors, and attention cost grows quadratically with patch count.

12. Critical analysis

Demonstrated that architectural priors can be traded for data and compute, reshaping vision architecture research.

13. Implementation tasks

  • 1.Implement patch embedding and a small ViT and train on CIFAR-10 from scratch.
  • 2.Compare performance with limited versus large pretraining data.
  • 3.Visualize attention maps and class-token responses.

14. Follow-up work

  • 1.Swin Transformer: Hierarchical Vision Transformer using Shifted Windows (Liu et al., 2021)
  • 2.Training data-efficient image transformers and distillation through attention (Touvron et al., 2020)

15. Open research questions

  • 1.Which convolutional inductive biases are truly necessary for small datasets?
  • 2.How should positional information be encoded for high-resolution images?
16. Reproduce it. Record the hypothesis, configuration, dataset, metrics and discrepancies in the Experiment Tracker. A reproduction is not complete until you have run the experiments, performed at least one ablation and documented the differences from the reported numbers.