Quant Memo
Advanced

DDIM and Fast Diffusion Samplers

Standard diffusion models generate an image or sample by undoing noise in hundreds or thousands of tiny steps; DDIM reformulates the same trained model as a deterministic process that can skip most of those steps with little quality loss.

Prerequisites: Denoising Diffusion Probabilistic Models

An ordinary denoising diffusion model (DDPM) generates a sample by starting from pure noise and running a Markov chain of small denoising steps — often 1,000 of them — each one only slightly less noisy than the last, because the model was trained assuming that gradual, one-step-at-a-time schedule. That works but is slow: a thousand forward passes through the network for every single image generated.

DDIM (denoising diffusion implicit models) shows that the same trained network — no retraining required — can be run under a different, non-Markovian sampling process that reaches the same final distribution of images while allowing much bigger jumps between steps, because it removes the randomness that forced small steps in the original formulation. Instead of sampling a new noisy image at each step, DDIM computes a deterministic update, which means the same starting noise always produces the same output image, and it means you can skip from step 1,000 directly to step 950, 900, or further, evaluating the network only 20 or 50 times instead of 1,000, with a visible but often acceptable drop in sample quality.

This determinism has a second use beyond speed: because two different noise vectors map to two different but reproducible images, you can smoothly interpolate between two starting noise vectors and watch the generated image morph continuously between two outputs, something the original stochastic DDPM sampler cannot do cleanly.

DDIM reuses a diffusion model's existing training but samples it deterministically, which permits skipping most of the denoising steps — turning a 1,000-step generation process into one needing only tens of steps, at some cost to quality.

Related concepts

Further reading

  • Song, Meng & Ermon, Denoising Diffusion Implicit Models (2020)
ShareTwitterLinkedIn