← All lessons
0185

Vision Transformers

CNNs ruled vision for a decade by sliding filters across pixels. Vision Transformers took a shortcut: cut the image into small square patches, treat each patch as a TOKEN, add positions, and feed the sequence into the exact same transformer you already know. No convolution — the paper's title said it: an image is worth 16×16 words.

Step through the three views: image → patches → token sequence. Then hover a patch: attention connects it to every other patch at once, so the sky can consult the grass in a single layer — something a CNN needs many stacked layers to do. This shared token language is also what makes multimodal models possible: image tokens and text tokens flow through one transformer together.

1. an image

Check yourself

A CNN's filter sees only a small neighbourhood at a time. What does a ViT patch see in a single attention layer, and what does that cost?

Go deeper (free): ViT paper — An Image is Worth 16x16 Words

Next: Decision Trees