Skip to content
BIASED

Autoregressive transformers

Block 1 of 8~2 min

Images as text

The topic Autoregressive models left us an exact likelihood and a slow sampler. The chain rule turns an image into a product of one-value conditionals, and a PixelCNN learns them all in one parallel pass. But its masked convolutions see only a local window of the past, with a blind spot inside it, and sampling takes one network pass per value.

Language models solve the same problem for text. A GPT predicts each token from all earlier tokens and is trained on billions of them. Can images be generated the way text is?

The obstacle is length. A 256×256256 \times 256 colour image read one value at a time is a sequence of

256⋅256⋅3=196,608256 \cdot 256 \cdot 3 = 196{,}608

values, while GPT-2 reads at most 1,0241{,}024 tokens. Self-attention compares every position with every earlier one, so its cost per layer grows with the square of the length (the topic Latent diffusion hit the same wall in pixel space).

So we change what a token is. There are two answers, and this topic follows both:

  • a colour from a small palette, one per pixel of a small image (ImageGPT);
  • a code of a learned discrete autoencoder — the VQ-VAE of β-VAE and VQ-VAE, made sharper (VQGAN, DALL·E, Parti).

Once an image is a short sequence of codes, text-to-image generation becomes continuing a caption.

Answers are saved on the server and tied to this browser until you sign in.