Fundamentals

What is a diffusion model?

A diffusion model generates data by learning to reverse a noising process, turning random static into an image one denoising step at a time.

A diffusion model is trained on a deliberately destructive process. Take a real photograph, add a small amount of random noise, then add a bit more, and keep going for hundreds of steps until nothing is left but static. That is the forward process, and it requires no learning at all because adding noise is trivial.

The model learns the other direction. Given a noisy image and a note about how noisy it is, predict what noise was added. Do that well enough and you can run the process backwards: start from pure static, predict the noise, subtract a bit of it, and repeat. After enough steps a coherent image emerges from what began as randomness.

Text conditioning is what makes it useful. During training the model also sees a description of each image, encoded by a separate text model. At generation time your prompt is encoded the same way and fed in at every denoising step, which biases each prediction toward images that match your words. This is why a prompt influences the whole image rather than being pasted in at the end.

Diffusion replaced GANs as the dominant approach for image generation because it trains more stably and covers a much wider range of outputs. GANs were notorious for mode collapse, where the generator learns to produce a handful of convincing images and ignores the rest of the distribution. Diffusion models do not have that failure mode, which is why they can handle prompts about almost anything.

Worth remembering

Try it in the generator

The advanced panel exposes the negative prompt, scheduler, inference steps and seed. Twenty images free, no account needed.

Start generating

Frequently asked questions

Why does generation take several seconds?
Because it is not one calculation but many. Each denoising step is a full pass through a large neural network, and a typical generation runs 20 to 50 of them.
Is the image copied from training data?
No. The model stores learned statistical patterns, not the images themselves; the entire model is far smaller than its training set. It starts from fresh random noise every time, which is why the same prompt with different seeds gives different pictures.
What is the difference between a diffusion model and a GAN?
A GAN generates an image in a single forward pass and is trained against a discriminator. A diffusion model generates iteratively over many steps. Diffusion is slower but trains more reliably and produces far more varied output.

Related terms

Back to the glossary, or apply it on a use case or an art style.