Syllabus Lesson 189 of 246 · Module 17: Noise in, pictures out (diffusion)
Module 17: Noise in, pictures out (diffusion)

Fewer steps (DDIM)

Why it matters 100 network calls per picture is slow, and real models use 1000. DDIM (Song, Meng and Ermon, 2021) skips steps: it jumps from x_t straight to a much earlier step, with no fresh noise, using the same trained network. How few steps can you get away with?

The course's digit model was trained once (difflab.recorded_digit_model()). difflab.sample_digits(model, labels, w=2.0, steps=k) draws one picture per label with k DDIM steps (steps=None runs all 100 DDPM steps). The judge from Module 15 scores them: closeness to the nearest real digit (real digits 1.04).

Call the Curve

Before measuring, guess the closeness at 2, 5, 10, 20 and 100 steps. Papers and blog posts often say quality drops visibly below 50 steps. Measure it on this model.

Words and symbols in this lesson
x0, x_t
the clean data, and the same data after t steps of noise
eps
the bell-curve noise that was added; the network learns to predict it
DDPM
sampling by stepping back through every step, with fresh noise each time
DDIM
sampling by jumping between a few steps, with no fresh noise
Your turn

Fill my_guess (five closeness numbers), then fill measured with the real closeness at each step count, and set fewest_good to the fewest steps whose closeness is within 0.05 of the 100-step result.

Spotted a problem in this lesson? Report it · Ask about this lesson

This exercise opens soon

Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.