AI Diffusion Tutorial: Forward, Reverse, Sampling

TL;DRDiffusion works in two phases: a forward process adds noise, a reverse process learns to remove it.

Training has a forward process that gradually adds Gaussian noise to real images until they're pure noise — and a model learns the reverse: predict and remove the noise step by step. At generation, you run only the reverse process from random noise. Fewer, larger denoising steps (via better samplers) speed it up. Understanding the noise-in/noise-out symmetry demystifies how diffusion "creates".

Key points

Common mistakes

Try it: Describe the forward and reverse diffusion processes.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>forward (train): image → +noise → ... → pure noise
reverse (gen):  noise → −noise (learned) → image</pre></body></html>
Open the interactive lesson →
Image Generation · Diffusion Models Controlnet · Guiding Generation