Chapter 5: Sampling & Acceleration
Sampling is the computational bottleneck of diffusion models. This chapter covers the full landscape: from the original ancestral sampling of DDPM, through DDIM's deterministic shortcut and DPM-Solver's high-order ODE integration, to distillation and consistency approaches that collapse hundreds of steps into one or a few. We conclude with classifier-free guidance, the dominant technique for steering sample quality during inference.
Chapter Overview
Training a diffusion model is only half the story. Once we have a learned score function or equivalently a noise predictor , we must sample from the model---starting from pure noise and iteratively denoising until we reach a clean sample . The original DDPM sampler requires sequential neural network evaluations, making generation painfully slow compared to GANs or VAEs that produce samples in a single forward pass.
This has spurred a rich line of research on sampling acceleration. The key insight is that the reverse process defines a probability flow ODE (ordinary differential equation) whose trajectories share the same marginal distributions as the stochastic reverse SDE. We can integrate this ODE with fewer, larger steps using sophisticated numerical methods. Beyond better ODE solvers, distillation methods train a student model to match the teacher's multi-step output in fewer steps, and consistency models learn to map any point on the ODE trajectory directly to its endpoint .
Orthogonal to speed, classifier-free guidance is the standard technique for trading diversity for quality during sampling. By interpolating between conditional and unconditional score estimates, guidance amplifies the influence of the conditioning signal (e.g., a text prompt), producing sharper, more coherent samples at the cost of reduced diversity.
This chapter covers:
- Ancestral Sampling (DDPM): The original stochastic sampler with steps
- DDIM Deterministic Sampling: Non-Markovian generalization enabling fewer steps and deterministic generation
- DPM-Solver & Higher-Order Methods: Fast ODE solvers exploiting the semi-linear structure of diffusion ODEs
- Progressive Distillation: Training a student to halve the number of steps iteratively
- Consistency Models: Direct single-step mapping from any noise level to clean data
- Classifier-Free Guidance: Steering sample quality by blending conditional and unconditional predictions
Chapter Roadmap
Click any topic to jump in
Ancestral Sampling
DDPM's original 1000-step sampling — faithful to the learned reverse process.
Skip-step and higher-order methods
DDIM
Deterministic sampling with stride — skip steps via non-Markovian process.
DPM-Solver
Higher-order ODE solvers — 10-20 steps matching 1000-step quality.
Distillation and one-step
Distillation
Student matches 2 teacher steps in 1 — halving down to 4-8 steps.
Consistency Models
One-step generation — mapping any noisy input to x₀ directly.
CFG Sampling
Amplifying conditional signal during sampling — trading diversity for quality.
Sign up to unlock this chapter
This chapter is part of PixelBank Premium. Create a free account, then upgrade to read the full lesson — concepts, walkthroughs, and exercises.