A diffusion model is trained to recover data from noise. To create a picture, it starts with random noise and turns it into an image over dozens of steps, while a text description determines what the image should look like.
How it works
During training, Gaussian noise is gradually added to real images until only noise remains, and the neural network learns to predict that noise at each step. Generation runs in reverse: the model estimates the noise in the current image, a scheduler subtracts part of it, and this repeats until a clean result emerges. The number of steps is set by the num_inference_steps parameter; the DDPM paper used 1,000 steps, while 25 are enough in the Diffusers documentation examples.
Latent diffusion
Working with pixels is expensive, so in latent diffusion an autoencoder (VAE) first compresses the image into a compact latent representation, and the noise is removed there. In Stable Diffusion 1.x, the latent representation is 8 times smaller in height and width than the image: 512×512 pixels become 64×64. A text prompt is turned into vectors by a text encoder and mixed in through attention layers. The guidance_scale parameter (7.5 in the documentation example) determines how strictly the model follows the prompt.
What a pipeline consists of
| Component | What it does |
|---|---|
| Text encoder | turns the prompt into conditioning vectors |
| Denoising network | predicts the noise in the latent representation at each step (a UNet or a transformer) |
| Scheduler | decides how much noise to remove at a step and defines the set of steps |
| VAE | converts the latent representation into the final image |
Diffusion probabilistic models were proposed by Sohl-Dickstein and co-authors in 2015, the DDPM method by Jonathan Ho, Ajay Jain and Pieter Abbeel in 2020, and the latent variant by Robin Rombach and co-authors in 2021. Examples of open-weight models are Stable Diffusion and FLUX.
Sources
the term is written from these pages- Ho, Jain, Abbeel: Denoising Diffusion Probabilistic Models (DDPM)arxiv.org/abs/2006.11239(opens in a new tab)
- Rombach и др.: High-Resolution Image Synthesis with Latent Diffusion Modelsarxiv.org/abs/2112.10752(opens in a new tab)
- Hugging Face Diffusers: Understanding pipelines, models and schedulershuggingface.co/docs/diffusers/en/using-diffusers/write_own_pipeline(opens in a new tab)
Verified 18 Nov