Skip to content
mlmentorship

Diffusion models

Construct one noisy training pair, recover a clean estimate, and distinguish noise prediction from dependent reverse sampling.

Published · 8 min read ·Role-specific ·Intermediate
Reading depth

Gaussian diffusion learns reverse transitions for a fixed process that corrupts clean data with noise.

Summary

Why can training jump directly to one noise level while generation needs dependent updates? Take clean scalar , retained signal variance , and sampled standard-normal noise . A predictor returns . We will compute its training error and clean estimate, then identify what a sampler still needs.

Learning objective

Train at one sampled noise level; generate through a dependent chain

Train at one sampled noise level; sample through a chainA training example can use only its sampled time t. Generation depends on successive reverse transitions; it cannot parallelize away those dependencies.Training samples a time; generationfollows timeTraining: choose one noise time forthis examplex0txtlossGeneration: each output feeds thenext stepz3z2z1x0The reverse chain retains predecessordependencies.
Derivation
Diffusion training uses one sampled timestep while generation chains reverse steps The training lane starts with clean data x zero and sampled Gaussian noise epsilon. A closed-form equation jumps directly to an independently selected noisy state x t without constructing earlier states. One call to the time-conditioned network predicts epsilon, and its error against the known sampled noise trains the shared parameters. The sampling lane starts from Gaussian noise x T. It calls the same time-conditioned network repeatedly; each reverse update produces x t minus one, which is required before the next call, until a clean sample x zero is produced. TRAINING: choose one independent noise level per example known clean data x0 clean sample sample t and ε t ~ Uniform ε ~ N(0, I) direct jump xt in closed form √ᾱtx0 + √(1−ᾱt)ε one call εθ(xt, t) predict noise ε̂ MSE(ε, ε̂) update θ the sampled ε is the available target; no forward or reverse chain is unrolled SAMPLING: each computed state is input to the next reverse step start from noise xT N(0, I) εθ(xT, T) predict noise ε̂ update xT−1 computed state εθ(xt, t) predict noise ε̂ … x0 generated clean sample many dependent predictor calls: xt−1 must exist before the next call One shared time-conditioned network learns across noise levels; only generation chains its calls.
compare the arrows in the two lanes. Training knows clean data and sampled noise, so one marginal draw supplies a target. Generation knows neither target. Each noise prediction feeds a separate reverse update, whose result becomes the next input. Skipping levels requires compatible solver coefficients. Sources: DDPM and DDIM.
Check: Why does training need one sampled noise level while generation must wait for each preceding state?
Read it this way: A training example can use only its sampled time t. Generation depends on successive reverse transitions; it cannot parallelize away those dependencies.
Can the second reverse transition run without the first transition’s output?

The forward process

Choose , define , and let . Independent forward Gaussian increments give

Composition multiplies the signal coefficients. The noise variance recurs as . Thus the marginal is . It approaches standard normal only when residual signal becomes negligible for the data distribution.

Training

Sample data, a time index and independent . Construct directly and minimize . This simplified objective need not equal every time-weighted variational bound. Our fixture gives and squared error . The model sees , not the sampled target noise.

Change the requirement: predict clean data instead. For , convert using

The estimate is ; using the true noise would recover two. Noise MSE equals clean-data MSE multiplied by under this conversion. Changing prediction targets without their loss weights and sampler coefficients changes the training problem. At zero retained signal, this inverse formula is singular.

Sampling (reverse process)

Start from an appropriate Gaussian prior and compute dependent reverse states:

Here is fresh standard-normal transition noise, with at the final step by convention. The variance is a declared model or sampler choice. One choice is ; it is not the only supported variance. A noise prediction alone supplies neither the update coefficients nor the next state. Using adjacent-step DDPM coefficients for an arbitrary timestep jump is not justified.

Conditional generation

Change the requirement: strengthen a condition using a model trained to support unconditional prediction. Classifier-free guidance combines

Conditional prediction two, unconditional prediction one and produce . The alternative convention writes unconditional plus times the conditional difference. Guidance changes the sampled distribution; it is not simply a speed setting.

Transfer: ten transitions with two denoiser evaluations each require twenty evaluations, absent reuse. Batching the pair changes execution scheduling, not the number of logical evaluations.

Latent diffusion (Stable Diffusion)

An additional learned encoder maps data to a smaller latent; diffusion models that latent distribution. The decoder maps generated latents back to the data space. Latent diffusion changes the representation and reconstruction limits, not the Gaussian composition identity. Compression ratio and channel count depend on the autoencoder. Text cross-attention and protein conditioning, as in RFdiffusion, are distinct application choices.

Sample quality vs. step count

Measure quality, coverage, latency and denoiser evaluations for the actual model, schedule, guidance and solver. More evaluations do not universally improve every metric. DDIM, consistency models and distillation require compatible updates or learned objectives. Their reported speedups are not universal equivalence rules.

Common pitfalls

Likelihood bounds and likelihood estimates evaluate probability assignment under stated approximations. FID evaluates feature-distribution statistics; it is not a likelihood estimate or a complete coverage test. Noise, clean-data and velocity parameterizations require matching time-dependent conversions. The forward corruption here is fixed; the learned reverse remains an approximation. Foundations: DDPM and Sohl-Dickstein et al..