Skip to content
AI360XpertBeta
Core ML

Visual explainer

Diffusion Models

Learn a reverse process from known Gaussian corruption. Trace noise prediction, scaled sampling updates, guidance and the limit of recovering an original sample.

A diffusion model must represent distinct data patterns.
A diffusion model must represent distinct data patterns.

Diffusion models learn to generate data by reversing a known corruption process. During training, a network sees noisy data and its noise level; during generation, a sampler repeatedly uses the learned predictions to transform a fresh noise sample. A generated result need not recover any particular training example.

Our synthetic dataset has two equally likely patterns: A = (1, −1) and B = (−1, 1). These are two normalized coordinates, not photographs. Horizontal positions 1 and 2 identify the coordinates; vertical position shows value, with the faint baseline at zero. Lines connect coordinate values to make each pattern visible, not to imply intermediate pixels. Both panels share a scale of 70 drawing units per value unit. The model must represent alternatives, rather than return one average template. One-pass generation is not inherently impossible; the GAN visual shows a different sampling mechanism.

Add Known Noise

Forward corruption scales the signal and adds known Gaussian noise.
Forward corruption scales the signal and adds known Gaussian noise.

Track A through a training example. Each small profile uses the same value scale and the same left/right coordinate order. The first profile is the scaled signal, the second the scaled noise, and the last their sum. The DDPM paper specifies the forward Gaussian process; its closed form lets us sample a selected noise level directly.

Let βₜ be the noise variance for forward step t, αₜ = 1 − βₜ, and let ᾱₜ be the product of α values through t. With a standard normal noise vector ε:

xt=αˉtx0+1−αˉtϵ.x_t = \sqrt{\bar{\alpha}_t}x_0 + \sqrt{1-\bar{\alpha}_t}\epsilon.

Choose ᾱₜ = 0.64, so the coefficients are 0.8 and 0.6. For the illustrative draw ε = (−1, 1), xₜ = (0.8, −0.8) + (−0.6, 0.6) = (0.2, −0.2). The figure uses x(t) for xₜ to keep labels readable in fallback fonts. Noise does not simply erase a fixed percentage of pixels. When ᾱ becomes very small, the noisy distribution approaches standard Gaussian noise; our 0.64 example is not pure noise.

Learn the Corruption Draw

Noise prediction trains against the known corruption draw.
Noise prediction trains against the known corruption draw.

The dashed profile with square endpoints is the actual ε = (−1, 1) used to corrupt A. The solid profile with circles is an illustrative prediction, ε̂ = (−0.8, 0.8). Both use the same coordinate positions and value scale. Their vertical endpoint gaps are 0.2 each.

Training samples a clean example, a noise level t and Gaussian ε. The network receives xₜ and t, and its parameters are updated to reduce the difference between predicted and known noise. Mean squared error per coordinate here is ((−0.8 + 1)² + (0.8 − 1)²) / 2 = 0.04. The DDPM simplified objective averages this kind of error over training examples, noise and time. The sampled ε is supervised information during training, not supplied to the network at generation time.

Guide the Noise Prediction

Classifier-free guidance extrapolates noise predictions.
Classifier-free guidance extrapolates noise predictions.

This detail switches to a noise-prediction vector plane, not image space or a generated trajectory. All arrows start at zero and use 180 drawing units per component. U is an unconditional noise estimate (1, 0); C is a conditional estimate (0.5, 0.5) for the same noisy state and time. The dashed chord joins their endpoints and extends past C.

Classifier-free guidance combines predictions without a separate classifier. In the convention ε_guided = U + s(C − U), setting s = 2 gives (0, 1), the vertical mint arrow. This s equals 1 + w in the paper. A condition can be a class or text in an appropriately trained model. The sampler uses the guided noise estimate inside its update; this arrow is not the direction an image moves. Guidance can trade diversity against condition adherence or fidelity, and stronger guidance is not a correctness guarantee.

Estimate the Clean Signal

A noise prediction gives an estimate of the clean signal.
A noise prediction gives an estimate of the clean signal.

Return to A's two-coordinate example and the imperfect prediction from frame 3. The dashed square-ended profile is the actual clean signal; circles show the estimate. The shared value scale reveals the estimate's reduced magnitude.

Rearrange the forward equation:

x^0=xt−1−αˉtϵ^αˉt.\hat{x}_0 = \frac{x_t-\sqrt{1-\bar{\alpha}_t}\hat{\epsilon}}{\sqrt{\bar{\alpha}_t}}.

Here ((0.2, −0.2) − 0.6(−0.8, 0.8)) / 0.8 = (0.85, −0.85). Each coordinate misses the original by 0.15. Subtracting ε̂ without these coefficients would give a different answer. A clean-signal estimate from an intermediate noisy state is not by itself a complete one-step generative sampler.

Compute a Reverse Mean

A reverse mean uses a scaled noise correction.
A reverse mean uses a scaled noise correction.

These profiles retain the same scale. To isolate the reverse rule, now assume an exact noise prediction ε̂ = (−1, 1) for this one state. Choose αₜ = 0.8, βₜ = 0.2, and ᾱₜ = 0.64. Their consistency requires ᾱ at the previous step to be 0.64 / 0.8 = 0.8.

The DDPM noise parameterization computes:

μθ(xt,t)=1αt(xt−βt1−αˉtϵ^).\mu_\theta(x_t,t)=\frac{1}{\sqrt{\alpha_t}}\left(x_t-\frac{\beta_t}{\sqrt{1-\bar{\alpha}_t}}\hat{\epsilon}\right).

The correction inside the parentheses gives (0.533333, −0.533333); dividing by √0.8 gives mean (0.596285, −0.596285). The printed magnitudes round to 0.20, 0.53 and 0.60. This is a reverse transition mean, not a claim that the original has already been restored. The exact ε assumption is only a controlled arithmetic example.

Follow the Dependency Chain

Reverse sampling needs each previous state before the next update.
Reverse sampling needs each previous state before the next update.

At generation time, start from a fresh Gaussian sample at the noisy end of a suitable schedule. A network prediction and sampler rule produce the next state, which becomes the input to the following call. The boxes are indexed states, not measured quality scores or elapsed time. In this chosen sequential sampler, the next call needs the preceding result; the same learned network is reused across steps.

Network evaluations cost computation, so the sampler and number of evaluations matter. Training steps and generation steps need not match: DDIM develops sampling on a selected subsequence with corresponding update rules. Simply deleting arbitrary steps from a DDPM loop is not that construction. There is no universal thousand-step requirement or guaranteed quality gain from adding steps. For a strict latency budget, evaluate a suitable faster sampler or another generator on the actual task and hardware.

Draw Around the Mean

A stochastic reverse step adds fresh noise around its mean.
A stochastic reverse step adds fresh noise around its mean.

Zoom into the first coordinate only of frame 6. The circle marks mean 0.596285. Diamonds show two possible reverse draws; the x axis now uses 400 drawing units per value unit. The two-headed displacement shows equal offsets around that mean. This is a change of projection and scale, not the earlier two-coordinate profile.

One DDPM variance choice is σₜ² = βₜ(1 − ᾱₜ₋₁) / (1 − ᾱₜ). Our values give 0.2 × 0.2 / 0.36 = 1/9, so σₜ = 1/3. The stochastic transition is xₜ₋₁ = μ + σₜz, with a fresh standard Gaussian z. First-coordinate draws z = −0.6 and +0.6 yield 0.396285 and 0.796285, rounded in the picture. This new draw is different from the training corruption ε. Variance choices and endpoint handling depend on the sampler; deterministic DDIM has different behavior.

Low Signal Magnifies Error

Predicting clean data amplifies noise error at low signal levels.
Predicting clean data amplifies noise error at low signal levels.

The left column is ᾱ, the squared signal coefficient. Both bars use 400 drawing units per absolute clean-coordinate error, starting at zero. Hold the magnitude of a noise-prediction error fixed at 0.2. The clean-estimate formula multiplies that error by sqrt((1 − ᾱ) / ᾱ).

At ᾱ = 0.64, the clean error is 0.15. At ᾱ = 0.04, it is approximately 0.979796. These are computed sensitivities, not measured errors from a trained model. Low-signal estimates can be unreliable even when noise error looks modest; later predictions may revise an early clean estimate.

Where It Breaks

A noisy state cannot uniquely reveal its original clean sample.
A noisy state cannot uniquely reveal its original clean sample.

Project the original equal-probability patterns onto their first coordinate, −1 or +1. At ᾱ = 0.64, both can produce the same observed noisy value zero: 0.8(−1) + 0.6(4/3) = 0 and 0.8(+1) + 0.6(−4/3) = 0. Noise values in the picture round to ±1.33; the equations use exact thirds. Symmetric Gaussian likelihoods leave the two origins equally likely.

The conditional mean of ε is then zero, giving clean estimate zero, which is neither original mode. The sign is lost: the observation does not identify which clean sample created it. A reverse sampler can draw a plausible alternative, but cannot promise to recover the original or reconstruct missing facts. Denoising can generate useful data; visual plausibility is not evidence of factual recovery.

The Quick Version

  • Diffusion models learn a reverse process for a data distribution.
  • Forward corruption scales signal and adds known Gaussian noise.
  • Noise prediction learns from sampled examples, time and corruption draws.
  • Classifier-free guidance combines conditional and unconditional noise estimates.
  • Clean-signal estimates require both subtraction and rescaling.
  • A DDPM reverse mean uses schedule-dependent coefficients.
  • Sequential sampler calls depend on preceding noisy states.
  • Stochastic reverse transitions can add fresh Gaussian noise.
  • Low signal levels amplify noise-prediction error in clean estimates.
  • Denoising cannot uniquely recover an original hidden by ambiguous noise.