Generative AI, from noise to image
Generative AI,from noiseto image
Image generators are trained to remove noise. Run that skill backwards, starting from pure static, and a picture appears.
Slide 1 of 14: Generative AI, from noise to image.
Generative AI,from noiseto image
Image generators are trained to remove noise. Run that skill backwards, starting from pure static, and a picture appears.
To make an image, start with static.
Predicting versus generating
A classifier takes an image and returns a label: “cat”. It answers a question about data it is shown.
A generative model goes the other way. It produces new data that looks like the data it learned from: text, images, audio, video.
The most widely used image generators today are diffusion models.
Adding noise
- 1Start with a training image.
- 2Mix in a little random noise.
- 3Add more. The shapes are still there, faintly.
- 4More. Only the rough layout survives.
- 5After the last step it is pure noise. The original DDPM paper used 1,000 steps.
Training: guess the noise
Take a real image and add a known amount of random noise.
Ask the network: what noise was added? Compare its guess with the real noise, and adjust the weights. This is the same loss and gradient descent as in the neural network deck.
Repeat across a very large number of images and noise levels, until the network can estimate the noise in almost anything.
Removing noise
- 1Start from fresh random noise.
- 2The network predicts the noise, and a little of it is removed.
- 3Repeat. Rough shapes appear first.
- 4Then edges and detail.
- 5The last step leaves a finished image.
Every step removes a little noise. Many small guesses add up to one image.
Faster samplers reach a good image in tens of steps instead of a thousand.
Steering with words
A prompt is turned into numbers by a text encoder. Stable Diffusion 1 uses the text encoder from CLIP, a model trained to match images with their captions.
At every denoising step the network sees those numbers, so each guess about the noise leans toward the prompt.
A setting called guidance controls how hard it leans.
Working small
- Image
- 512 × 512 × 3
- Latent
- 64 × 64 × 4
Denoising millions of pixels is slow. Stable Diffusion works in a compressed latent space instead.
A 512 by 512 colour image becomes a 64 by 64 grid with 4 channels. All of the denoising happens there.
At the end, a decoder turns the latent back into full-size pixels.
“What I cannot create, I do not understand.”
Using it well
- 1BiasModels repeat the patterns in their training data, including stereotypes. Look at what you get, not just whether it is pretty.
- 2LabelsGenerated images can be mistaken for photographs. Say when an image was made by a model.
- 3CreditTraining sets include work by artists and photographers. Consent and copyright for that use are still being argued in courts.
Video · Welch Labs on 3Blue1Brown
The full picture
Welch Labs explains diffusion and CLIP visually, from noise to generated images and video.

Video · Computerphile
On a whiteboard
A friendly, slower explanation of how diffusion turns noise into pictures.

Go further
From no code at all to training your own model.
End of the deckNext deck: How large language models work