Cut an image into 16×16 patches and a plain Transformer beats CNNs
88.55%ImageNet top-1 with ViT-H/14
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
Dosovitskiy et al., Google ResearchICLR 20217 slides, 2 min
Figure 1, from the paper2/7
Patches become tokens; the rest is a standard encoder
Split the image into fixed patches, flatten and project each, add position embeddings and a learnable class token, then feed the sequence to an unmodified Transformer encoder.
Before and after3/7
Vision had been built around convolutions
CNNs
Locality and translation equivariance are hard-coded into every layer. These priors help with little data but constrain what the model can learn.
Vision Transformer
Almost no image-specific bias: global attention from the first layer. With enough pretraining data, learned patterns beat the built-in priors.
Large-scale training trumps inductive bias.
How it works4/7
From pixels to a class label
1
Patchify
The image is cut into a grid of 16×16-pixel patches, each flattened and linearly projected to a vector.
2
Add position and class token
Learned position embeddings mark where each patch came from; a prepended class token gathers the summary.
3
Encode and classify
Standard Transformer layers process the sequence; an MLP head reads the final class token.
Results5/7
Better accuracy for less pretraining compute
MethodImageNet top-1↑TPUv3-core-days↓
BiT-L (ResNet)87.549.9k
Noisy Student88.412.3k
ViT-L/1687.760.68k
ViT-H/144× less compute88.552.5k
All pretrained on JFT-300M. Compute counts TPUv3 cores times days of pretraining.
The catch6/7
Data hungry by design
Weak on small datasets
Pretrained only on ImageNet-1k, ViT trails comparable ResNets; it needs 14M to 300M images to shine.
Classification only
Detection and segmentation were left for future work.
Self-supervision lagged
Masked patch prediction pretraining trailed supervised pretraining by 4 points on ImageNet.
Takeaways7/7
Why it matters
A standard Transformer on image patches matches or beats top CNNs when pretrained at scale.
With enough data, learned attention outperforms the hard-coded locality of convolutions.
ViT is the image encoder inside CLIP, most VLMs and diffusion transformers.
1/7
26 upvotes on Hugging Face 7 slides, 2 min
Google ResearchTreats an image as a sequence of 16×16 patches and feeds it to a standard Transformer. Pretrained on 300M images, ViT-H/14 reaches 88.55% on ImageNet with about 4× less pretraining compute than BiT.