TwiddleLab / Artificial Intelligence / Generative AI: Making New Things
From Pure Noise to Picture
What you will learn
- Diffusion sampling starts from pure noise. At every step the denoiser guesses the noise and part of it is removed.
- Shape and colour appear first, fine details last.
- More denoising steps give a cleaner picture but take more time: time = steps × time per step.
- The seed picks the starting noise. Same model and same seed give the same picture.
How the lesson goes
Many AI images start as pure static. When it clears, what shows up first?
Watch a critter appear out of pure noise.
Each step the denoiser guesses the noise, and part of it is removed.
Fewer steps are faster. How few can you use and still get sharpness 90?
Each step takes 0.1 s. Choose the number of steps.
With few steps each jump removes a lot of noise at once, and the denoiser's guess at high noise is blurry, so the result stays soft. Here 30 steps of 0.1 s, 3 seconds, is the fewest that reaches 90.
This is diffusion sampling.
Noise in, many small clean-ups, a picture out.
What appears early, and what late?
Use the snapshots. Drag each chip to Early or Late.
At high noise the denoiser's best guess is a blurry average, which already fixes where the critter is and its colour. Fine details only become guessable once most of the noise is gone.
Two machines, same model. Make them draw the same critter, then two different ones.
Set the seeds and press Run both.
Code: a seed works the same way in Python.
Tap what the second run prints, then Check.
Computers make random numbers with a formula. The seed sets its starting point, so the same seed gives the same sequence, here 3, 2, 4. That is why a seed can reproduce a picture.
One step takes 0.2 s. How long do 30 steps take?
Tap your answer, then Check.
Each step is one run of the denoiser, so the time grows with the number of steps: 30 × 0.2 s = 6 s.
Seed hunt: find a critter for each wanted poster.
Try seeds from 1 to 20. A match pins itself to its poster. Fewer tries, more stars.
Previous lesson: Add Noise, Learn to Undo · Next lesson: Text to Image · Part of the course: Generative AI: Making New Things
Lessons are interactive and need JavaScript. Turn it on to play them.