Unit 6 of 7 · about 3 hours · explain
Diffusion sampling schedules, cost and guidance
A trained denoiser is not yet a generator. Sampling cost and conditioning decide whether the model is usable, and both are set after training.
You'll be able to
- Explain why ancestral sampling needs about 1000 serial U-Net evals and what DDIM changes.
- Compare step-count versus quality trade-offs including the 50-step DDIM point and cascades.
- Distinguish classifier guidance from classifier-free guidance and predict the stereotyping effect of overweighting.
Covers
Read
In this order, only the parts listed
0 of 2 done
- Implementation: U-Net, time embedding, DDIM and cascadesUnderstanding Deep Learning - generative models
Section 18.6 with Algorithms 18.1 and 18.2 and Notebooks 18.3 and 18.4 (pp. 363 to 368)
- Conditioning and guidanceUnderstanding Deep Learning - generative models
Sections 18.6.3 and 18.6.4 with Equation 18.41 on classifier guidance and the classifier-free paragraph (pp. 365 to 368)
Read for schedule, step-count and guidance mechanics at recognition depth. Do not train a large image model here.
Focus on
- One U-Net maps to an estimate at one noise level, conditioned on a sinusoidal time embedding. Ancestral sampling (Algorithm 18.2) calls it serially about 1000 times per image, so cost scales with steps, not with parameters alone.
- DDIM is a deterministic integrator of the probability-flow ODE: it drops per-step noise and gives good samples in about 50 steps on the book example. The Notes add latent-space diffusion as the further speedup used by Stable Diffusion.
- Classifier guidance adds times from a separate noisy classifier (Eq 18.41). Classifier-free guidance trains with randomly dropped labels and mixes conditional and unconditional scores at sample time.
- Overweighting the conditioning improves apparent quality but produces stereotyped outputs. The book draws the same trade as GAN truncation: less variety for cleaner exemplars.
Common mistakes · 3
- Calling DDIM faster per step. The gain is fewer steps with a different integrator, not a cheaper network; one DDIM step costs about the same as one ancestral step.
- Reading guidance scale as likelihood tempering. It reweights the conditional score at sample time and changes coverage; it does not retrain the density.
- Comparing step counts across different noise schedules. Fifty steps under one schedule is not the same compute-quality point as fifty under another; always fix the schedule first.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Why is diffusion sampling slow, in one line of arithmetic?Answer
Each reverse step needs one full U-Net eval and good ancestral images need about 1000 serial steps, so one sample costs about 1000 network passes.
2.What does DDIM change?Answer
It integrates the probability-flow ODE deterministically without per-step noise, so the book gets good samples in about 50 steps. It is still slower than most GAN sampling.
3.Contrast classifier guidance with classifier-free guidance.Answer
Classifier guidance adds the gradient of a separately trained noisy classifier (Eq 18.41). Classifier-free guidance folds the class into the denoiser, drops it at random during training, and mixes conditional and unconditional predictions at sample time.
4.What happens when conditioning is over-weighted?Answer
Higher apparent quality but stereotyped, low-variety samples. UDL notes the same quality-variety trade as GAN truncation.
Practice
- Stanford CS231n Assignment 3 Q3: DDPM notebook (conditional)
Q3 Denoising Diffusion Probabilistic Models,
DDPM.ipynbin the starter code (https://cs231n.github.io/assignments/2026/assignment3.zip); attempt the forward-process and loss parts only, after the VAE gateUse it as a mechanics check if diffusion sampling still feels vague. It is not a second required generative implementation; stop before large-scale image training.
You're done when
You can cost a sampler in U-Net evals, explain the 1000 versus 50 step points, and state which guidance form a config uses from its sampling code.
Only when you can do this without notes.
Leads to
Notes
Resources · 1 for this unit, 4 more in the section
- Understanding Deep Learning - generative modelsSimon J. D. Prince · primary
Read Chapter 14 for evaluation limits, 15 for GANs, 17 for VAE and ELBO, and 18 for diffusion. Read Chapter 16 only for flow recognition. Use notebooks 17.1-17.3 and 18.1-18.4 as mathematical and visual practice.
Also in this section
- D2L - GAN and DCGAND2L authors · support
Use gan.md and dcgan.md for one bounded adversarial exposure. The required implementation remains a small VAE with separate reconstruction and KL terms on a two-dimensional mixture or binarized MNIST subset.
- Deep-ML candidate - VAE, GAN and diffusion problemsDeep-ML · optional
After the platform admission check, use at most one of 393 VAE Loss, 1384 Reparameterization, 174 1D GAN or 303 Forward Diffusion as a changed-prompt drill.
- Stanford CS231n - diffusion assignment sliceStanford University · optional
Use the Assignment 3 diffusion component only after the VAE gate if diffusion mechanics remain weak. It is not a second required generative implementation.
- Progressive Distillation for Fast Sampling of Diffusion ModelsarXiv · reference
Read Section 4 only for the velocity parameterization and why it stays stable at zero signal-to-noise ratio. Leave Algorithms 1 and 2 and the distillation results for later.