07 · 2020 · Start from noise, end with a picture

Diffusion

Drop ink in water and it spreads until it is uniform. Diffusion models learn to run that film backwards. Training adds noise to real examples bit by bit. A network learns, at each noise level, to predict the noise, so it can be subtracted.

To generate, start with pure static and remove a little noise a hundred times. A shape emerges. Image generators work the same way with millions of pixels instead of the 2D points here, and with your text as extra guidance.

How it works

  1. Noising (the easy direction). Mix each point with random noise. After 100 small steps nothing of the original shape remains.
  2. Learn to undo one step. Show the network a noisy point and the step number, and ask it to guess the noise that was added.
  3. Generate. Start from random static. Repeatedly ask the network for the noise, subtract some, add a touch of fresh randomness, and step down one level.
  4. Steer. This network also receives the shape you chose (spiral, heart, moons, smiley), just as a text prompt steers an image model.

Try it

runs in your browser
noise level 0

Shape

Direction

Things to try

From 2D points to pictures

Ho, Jain and Abbeel’s 2020 paper showed that this recipe produces high-quality images. Stable Diffusion, DALL·E 2 and Midjourney followed in 2022, as did diffusion models for audio, video and molecules.

Why it works so well

Each step is an easy problem (clean up a little noise), but a hundred easy steps compose into a hard one (draw a picture from nothing). Unlike earlier generators, training is stable and covers many kinds of output.

This model

A small 3-layer network of 128 units, trained for about a minute on four shapes. It sometimes leaves stray points near the edges: with more training and capacity those disappear.