Sampling from Diffusion Models
What you'll learn: How diffusion models generate images by starting with pure noise and iteratively removing it step-by-step.
The Core Idea
Sampling from a diffusion model is the process of generating new images from scratch. You begin with a sample of pure random Gaussian noise—think of it as visual static—and then apply the learned reverse diffusion process repeatedly, gradually denoising the image until you arrive at a clean, realistic output.
This is where all your training pays off: the model has learned to predict and remove noise at each timestep, and now you chain these predictions together to transform chaos into structure.
The Iterative Procedure
The sampling process follows these steps:
- Start at pure noise: Sample
x_T ~ N(0, I), whereTis your final timestep (maximum noise level) - Walk backward through time: For each timestep from
Tdown to1:- Feed the current noisy image and the timestep into your trained denoiser
- The model predicts what noise to remove
- Update the image by removing that predicted noise
- Optionally add a small amount of random noise (except at the final step) to maintain proper uncertainty
- Output the result: After all timesteps,
x_0is your generated image
Why It Works
Each reverse step undoes a tiny bit of the forward diffusion corruption. Because you trained the model on every intermediate noise level, it knows how to denoise at each stage. The Markov chain structure means each step only depends on the current state, making the process tractable.
Think of it like restoring an old photograph: you don't fix everything at once—you gradually reduce blur, remove scratches, and enhance details in controlled stages.
Key Takeaway: Sampling from diffusion models is an iterative denoising process that starts from pure Gaussian noise and applies the learned reverse diffusion steps sequentially to generate high-quality images.