A vision transformer (ViT) applies transformer processing to images by turning visual data into a sequence of numeric vectors. Instead of treating an image as a sentence, it breaks the image into small square patches, processes those patches together, and uses their relationships to build a coherent interpretation or output. Transformers are useful here because they can connect information across the whole image rather than only nearby pixels. section 6.3 section 6.3.1
A typical image-to-image path works like this:
- Split the image into square tiles called patches. section 6.3.1
- Convert each patch’s pixel values into a vector of numbers. section 6.3.1
- Use a small preprocessing network, such as a CNN or linear layer, before passing the vectors to the transformer. section 6.3.1
- Convert transformer outputs back into patch-shaped vectors and combine them into an image. section 6.3.1
This replaces text tokenization and unembedding with image-specific patch extraction and patch combination. No image vocabulary or sampling process is required. The same general pattern also supports multimodal systems: images can become text descriptions, text can become images, or different input and output modalities can be combined. section 6.3.1 section 6.3.2
From image understanding to image generation
An image-captioning model accepts an image and produces text such as “This picture shows a stop sign surrounded by murky water.” An image-generation model reverses the direction: a prompt such as “Draw me a picture of a stop sign in a flood zone” produces an image. These systems remain constrained by their training examples. A request such as “Draw anything but an adorable cat” may still produce a cat because the model learned strong associations between the word “cat” and cat imagery, not the abstract instruction to exclude it. section 6.3.2 section 6.3.3
Figure 6.12 On the left, this simplified diagram shows how text input is tokenized and embedded before going to the transformer. An unembedding layer then converts the transformer output into the desired text representation. The input and output will be images when performing a computer vision task. The transformer stays the same, but then we modify the method for breaking the image into a sequence of vectors to perform patch extraction instead of tokenization. The LLM produces image output using a patch combiner, analogous to the unembedding layer for text LLMs.
Compare the text-model pipeline with the vision pipeline: tokenization becomes patch extraction, and unembedding becomes patch combination. section 6.3.1






