Paper 20~8 min readGoogle · 2020
Paper Breakdown

Vision Transformer,
explained.

For a decade, computer vision meant convolutions — the CNN was the only serious way to see. Transformers had conquered language, but everyone "knew" images were different: they needed the special machinery of convolution. This paper called the bluff. Chop an image into little squares, pretend each square is a word, and feed the lot to a plain Transformer. With enough data, it worked — and the CNN's monopoly ended.

Video breakdown
The animated walkthrough is in production.
Read the full breakdown below in the meantime ↓
01

The CNN monopoly

Since AlexNet in 2012, convolutional neural networks owned computer vision. Convolutions bake in assumptions that fit images beautifully: locality (nearby pixels relate), translation equivariance (a cat is a cat wherever it appears), and a hierarchy from edges to shapes to objects. These "inductive biases" are why CNNs learn efficiently from modest data.

Meanwhile Transformers had taken over NLP by throwing out recurrence in favor of pure attention. The obvious question hung in the air — could attention replace convolution too? — but the consensus was no: images have millions of pixels, and letting every pixel attend to every other is computationally impossible, and Transformers lack the vision-friendly biases CNNs have baked in.

02

The big idea: an image is worth 16×16 words

The workaround is almost cheeky. You can't treat each pixel as a token — too many. So don't. Cut the image into a grid of fixed-size patches (say 16×16 pixels each). A 224×224 image becomes just 196 patches. Now treat each patch as a "word" and the image as a short sentence of a couple hundred tokens — a length Transformers handle with ease.

That's the entire trick. The paper's title says it outright: An Image is Worth 16×16 Words. Once an image is a sequence of patch-tokens, you can feed it to the same Transformer encoder that reads text, with essentially no vision-specific changes.

03

Turning patches into tokens

Each patch is a little block of pixels. Flatten those pixels into a vector and pass it through a single linear projection — a learned matrix that maps the raw pixels into a patch embedding, the visual equivalent of a word embedding. Because a Transformer has no built-in sense of order, you also add a positional embedding to each patch so the model knows where in the grid it came from.

Image → patches → tokens → Transformer
[class]patch 1patch 2patch NTransformer

The result is a sequence of embeddings — exactly the input a Transformer expects. From here, standard multi-head self-attention lets every patch look at every other patch, so the model can relate the top-left of an image to the bottom-right in a single layer, something a CNN only achieves after stacking many layers.

04

The [class] token

How do you get a single label out of a bag of patch representations? ViT borrows BERT's trick: prepend one extra learnable token — the [class] token — to the sequence. It carries no pixels of its own; it's a blank slot whose job is to gather information.

As the Transformer's layers mix information through attention, this token accumulates a summary of the whole image. After the final layer, you read off its vector and attach a small classification head to predict the label. One token in, one summary out — clean and architecture-agnostic.

05

The catch: it's hungry for data

There's no free lunch. By discarding convolution, ViT also discards its helpful biases. It doesn't assume nearby patches are related or that objects can move — it has to learn all of that from examples. On a mid-sized dataset like ImageNet alone, ViT actually loses to a comparable CNN, precisely because the CNN's baked-in assumptions are a head start.

The magic appears at scale. Pre-train ViT on a truly enormous dataset — hundreds of millions of images (JFT-300M) — and it not only catches up but surpasses the best CNNs. With enough data, the model learns the right visual structure itself, and its freedom from rigid biases becomes an advantage rather than a handicap.

The trade-off

Inductive bias vs. data. CNNs encode strong priors, so they need less data but are constrained by those priors. ViT encodes almost none, so it needs a lot of data — but given that data, it can learn better representations than the priors would allow.

06

The results

Pre-trained on JFT-300M and fine-tuned on standard benchmarks, ViT matched or beat state-of-the-art CNNs (like the best ResNets) on ImageNet and friends — at lower pre-training compute. It proved, concretely, that convolution was not a requirement for top-tier vision; it was one option among others.

SetupViT vs CNN
Small data (ImageNet only)CNN wins (bias helps)
Medium data (ImageNet-21k)roughly even
Large data (JFT-300M)ViT wins, at less compute

An intriguing bonus: analysis of ViT's attention showed that even in early layers, some heads attend globally across the whole image — learning a kind of long-range "receptive field" that CNNs only build up gradually. The model discovered its own way to see.

07

The limits

ViT's dependence on gigantic pre-training datasets was a real barrier — few teams have JFT-300M. The plain design also struggles with high-resolution images and dense tasks like detection and segmentation, where the fixed patch grid is coarse. And self-attention over many patches is quadratic in cost, which bites as images (and patch counts) grow.

Follow-up work rushed to fix these: DeiT showed ViT could be trained data-efficiently with distillation; hierarchical designs like the Swin Transformer reintroduced locality and multi-scale structure for detection and segmentation. Pure ViT was a proof of concept more than a final answer.

08

Why it still matters

ViT broke the assumption that vision needs its own special architecture, and in doing so it helped unify AI around one backbone: the Transformer now processes text, images, audio, and video with the same core machinery. That convergence is why multimodal models feel natural — everything is just a sequence of tokens.

Its fingerprints are everywhere downstream: CLIP's image encoder, the vision half of multimodal LLMs, and modern image and video generators all lean on Transformer-over-patches. When a single model can look at a picture and read a caption in the same representation space, it's because ViT showed a patch could be a token.

The bigger picture

Text became tokens (Attention), images became patch-tokens (ViT) — once everything is a sequence of tokens, one architecture can fuse them. ViT is a key step toward the multimodal models we use now.

Frequently asked

Quick answers

What is a Vision Transformer?

A 2020 model that applies the standard Transformer to images by splitting them into patches, treating each patch as a token, and using self-attention — with almost no vision-specific design.

How does ViT tokenize an image?

It cuts the image into a grid of patches, flattens and linearly projects each into an embedding, prepends a [class] token, and adds positional embeddings before the Transformer.

Is ViT better than a CNN?

On small data, CNNs win thanks to built-in biases. Pre-trained on very large datasets, ViT matches or beats top CNNs at lower compute.

Why does ViT need so much data?

It has few built-in assumptions about images, so it must learn spatial structure from scratch — powerful, but data-hungry.

What is the [class] token?

An extra learnable token (from BERT) whose final vector summarizes the image; a classification head reads it to predict the label.

An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale · Dosovitskiy, Beyer, Kolesnikov, et al. · ICLR 2021 · read the original paper on arXiv → · Vibe Engines · 2026
Finished this one? 0 / 30 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns