PIXELBANKv8.2.1
Menu
Back to Diffusion Models Study Plan
Week 5-6

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 sθ(xt,t)xtlogpt(xt)s_\theta(x_t, t) \approx \nabla_{x_t} \log p_t(x_t) or equivalently a noise predictor ϵθ(xt,t)\epsilon_\theta(x_t, t), we must sample from the model---starting from pure noise xTN(0,I)x_T \sim \mathcal{N}(0, \mathbf{I}) and iteratively denoising until we reach a clean sample x0x_0. The original DDPM sampler requires T=1000T = 1000 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 x0x_0.

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 TT 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

1
Ancestral Sampling

DDPM's original 1000-step sampling — faithful to the learned reverse process.

Fewer steps

Skip-step and higher-order methods

2
DDIM

Deterministic sampling with stride — skip steps via non-Markovian process.

3
DPM-Solver

Higher-order ODE solvers — 10-20 steps matching 1000-step quality.

Extreme acceleration

Distillation and one-step

4
Distillation

Student matches 2 teacher steps in 1 — halving down to 4-8 steps.

5
Consistency Models

One-step generation — mapping any noisy input to x₀ directly.

Steering output
6
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.