AI Hints
Home›Generative AI Tutorial›How AI Creates Images
Generative AI · Lesson 42 of 77

How Diffusion Works

How AI paints a picture from noise.

⏱ 2 min read▶ Video at 1:36:47🎓 Free
Watch this lesson in the Generative AI courseWatch on YouTube ↗Full Generative AI course

How can a machine create a brand new picture, from just a sentence? The answer is one of the most surprising ideas in A I. It starts with pure static noise, like an old television with no signal, and gradually removes the noise, until a picture appears. In this lesson, you will see how.

How Diffusion Works
From the video: How Diffusion Works
  • Start with pure noise
  • Remove noise, step by step
  • A picture appears

Step one: destroying a picture

First, the training idea. Take a real photograph. Now add a little random noise. Then a little more. Again, and again, for many steps, until nothing remains, but pure static. This forward process is easy, and needs no learning. The clever part is that, at every step, we know exactly how much noise we added.

Step one: destroying a picture
From the video: Step one: destroying a picture

Step two: learning to undo it

Now the learning begins. We show a neural network a noisy picture, and ask, what noise was added? It predicts the noise, and we compare it with the truth. Over millions of images, the network gets very good at it. In effect, it learns what real pictures look like, from the inside, because to remove noise correctly, it must know what should be there instead.

Step two: learning to undo it
From the video: Step two: learning to undo it

Step three: creating from nothing

And now the magic. To create a new picture, we start with pure random noise. The network predicts the noise, and we remove a small part of it. Then again. And again. About fifty times. With each step, shapes emerge from the static. First, rough colours, then outlines, then details. At the end, a brand new image, that never existed before. Different starting noise, gives a different picture.

Step three: creating from nothing
From the video: Step three: creating from nothing

Why this works so well

Diffusion became the dominant way to make images, for good reasons. Training is stable, unlike older methods. It produces sharp, detailed, and varied pictures. It can be guided, by text, and by other images. And it scales, bigger models, and more data, keep improving quality. Famous examples include Stable Diffusion, D A L L E, Midjourney, and Imagen.

Stable to trainreliable results
Sharp and detailedhigh quality pictures
Easy to guideby text or other images
Scales wellbigger means better

Summary

Good. Diffusion models learn by adding noise to real pictures, and training a network to undo it. To create, they start from pure noise, and remove it step by step, until an image emerges. Next, how a sentence steers this process, so that the picture matches your words.

Key takeaways
  • Add noise to train, remove noise to create
  • About 50 denoising steps
  • Different noise, different picture
Next up: Text to Image — how words steer the picture