Generating Images by Diffusion (continued)
ECE 57000 — November 16, 2026
Learned noisy scores guide small reverse steps
- Known Gaussian corruption trains a shared noise-conditioned score predictor.
- Small noise resolves detail; larger noise covers regions far from the data.
- A reverse step combines mean correction and fresh noise; one clean guess is not a sample.
Today: continuous SDE/ODE sampling, numerical solvers, and the image-generation system.
Continuous noising is the small-step limit of the Gaussian walk
Discrete diffusion → continuous SDE → probability-flow ODE → solver choices
\[d\widetilde{\boldsymbol{x}}_t=d\mathbf{w}_t,\qquad
\widetilde{\boldsymbol{x}}_0=\boldsymbol{x}.\]
- An SDE adds random increments: \(\Delta\mathbf{w}\sim\mathcal N(\boldsymbol0,hI)\) over an interval \(h\).
- Our time label is noise variance: \(\sigma(t)=\sqrt t\).
- Its marginal remains \(\widetilde{\boldsymbol{x}}_t=\boldsymbol{x}+\sqrt t\,\boldsymbol{\epsilon}\) in distribution.
Continuous-time training still needs one noise draw per example
Draw \(t\sim\rho\) on \([t_{\min},T]\), \(t_{\min}>0\), then form \(\widetilde{\boldsymbol{x}}_t=\boldsymbol{x}+\sqrt t\,\boldsymbol{\epsilon}\).
\[\min_\theta\ \mathbb E\!\left[\lambda(t)
\|\boldsymbol{\epsilon}-\epsilon_\theta(\widetilde{\boldsymbol{x}}_t,t)\|^2\right],
\qquad s_\theta(\widetilde{\boldsymbol{x}}_t,t)=-\frac{\epsilon_\theta(\widetilde{\boldsymbol{x}}_t,t)}{\sqrt t}.\]
No simulated SDE trajectory and no SDE solver are required for this training loss.
The reverse SDE repeatedly combines score drift and random increments
Continuous, \(\tau=T-t\): \(d\widetilde{\boldsymbol{x}}_{T-\tau}=s_\theta(\widetilde{\boldsymbol{x}}_{T-\tau},T-\tau)\,d\tau+d\overline{\mathbf{w}}_\tau\).
![Running mixture target densities with generation from right to left. Fine and coarse reverse Euler paths share initial samples and coupled Brownian increments. The continuous panel is explicitly a fine numerical approximation.]()
Discrete reverse SDE approximation: \(h>0\), fresh \(\boldsymbol\xi\sim\mathcal N(\boldsymbol0,I)\):
\[\widetilde{\boldsymbol{x}}_{t-h}\approx\widetilde{\boldsymbol{x}}_t
+h\,s_\theta(\widetilde{\boldsymbol{x}}_t,t)+\sqrt h\,\boldsymbol\xi.\]
What if we delete the fresh noise from this sampler?
Keep the random initialization and the same mean correction.
What should we expect if every \(\xi\) is set to zero?
A. The same distribution, computed faster
B. A generally different output distribution
C. The same output on every run
B. A valid deterministic sampler also changes the correction.
One model, different sample paths
ODE and SDE samplers can share the same ideal marginals
A reverse step should produce the next less-noisy distribution
![Three exact densities from the running three-Gaussian mixture: current noisy population at t1, next population at t.6, and clean data at t0. The goal is to move a population through these distributions during generation.]()
- The denoiser supplies a direction at each noisy sample: the score of \(p_t\).
- The sampler uses those directions so the whole population follows \(p_t\rightarrow p_{t-h}\).
One sample follows a path; many generated samples form the distribution.
The balance preserves the distribution, not each sample’s destination
The Fokker–Planck equation connects sample motion to changes in probability density:
- Score drift transports probability; random noise spreads probability.
- The matched strengths make their combined change undo the forward noising.
- Starting from the same \(p_T\), each balanced choice follows the same sequence of \(p_t\) distributions.
Same population distributions; different paths and possibly different final images.
Balance score movement and fresh noise to follow the same distributions
For a reverse step \(h>0\), with fresh \(\boldsymbol\xi\sim\mathcal N(\boldsymbol0,I)\): \[\widetilde{\boldsymbol{x}}_{t-h}\approx\widetilde{\boldsymbol{x}}_t
+\underbrace{a\,h\,s_\theta(\widetilde{\boldsymbol{x}}_t,t)}_{a\text{ scales score movement}}
+\underbrace{\beta\sqrt h\,\boldsymbol\xi}_{\beta\text{ scales fresh noise}}.\]
![Four matched ten-step paths with beta1,a1; beta three-quarters,a25/32; beta half,a5/8; and beta0,a1/2. Blue segments show score movement and orange segments fresh noise at the destination time.]()
Required balance: \(\boxed{2a-\beta^2=1}\), or \(a=(1+\beta^2)/2\).
Drift–noise imbalance changes the generated distribution
![Three balanced small-step output histograms agree closely with the target three-Gaussian density. Below, too much drift sharpens the modes, too much noise broadens them, and a balanced but ten-step sampler also has numerical error.]()
Balanced small steps match closely. Imbalance and coarse steps produce different errors.
The same model and starting noise can produce different images
Each pair starts identically. More snapshots show the digit taking shape.
Choosing a numerical sampler
Solver accuracy, computation and downstream quality
Numerical integration turns the learned field into a practical sampler
Write the reverse ODE drift as \(b(\widetilde{\boldsymbol{x}}_t,t)=\tfrac12s_\theta(\widetilde{\boldsymbol{x}}_t,t)\).
Euler proposal: \[\widetilde{\boldsymbol{x}}^{\mathrm E}_{t-h}
=\widetilde{\boldsymbol{x}}_t+h\,b(\widetilde{\boldsymbol{x}}_t,t).\]
Heun correction: \[\widetilde{\boldsymbol{x}}_{t-h}=\widetilde{\boldsymbol{x}}_t+
\frac h2\left[b(\widetilde{\boldsymbol{x}}_t,t)
+b(\widetilde{\boldsymbol{x}}^{\mathrm E}_{t-h},t-h)\right].\]
Evaluate two slopes instead of one; compare cost in network evaluations.
A better solver can improve sampling with exactly the same predictor
![Measured endpoint errors for Euler and Heun on the same analytic mixture ODE versus network-equivalent field evaluations, plus an adaptive SciPy Runge–Kutta result.]()
This isolates solver error. Image quality must also be measured downstream.
Train the denoiser once; choose how to generate images later
During training
Choose what the network learns:
- Data, architecture and conditioning
- Noise levels and loss weights
- Prediction target and scaling
During generation
Reuse the saved denoiser, and choose:
- Deterministic, stochastic or in between
- Number and spacing of steps
- Numerical solver and compute budget
One trained model → many sampler choices, without retraining.
Keep the model’s noise range, time labels, scaling and conditioning compatible.
Karras et al., Elucidating the Design Space of Diffusion-Based Generative Models
From a sampler to an image system
Conditioning, compression and choosing what to measure
Conditioning makes denoising depend on the requested output
For an image paired with a condition \(c\):
\[\widetilde{\boldsymbol{x}}_t=\boldsymbol{x}+\sqrt t\,\boldsymbol{\epsilon},\qquad
\widehat{\boldsymbol{\epsilon}}=\epsilon_\theta(\widetilde{\boldsymbol{x}}_t,t,c).\]
- Train: retain \(c\) with each image while learning noise prediction.
- Generate: supply the same request at every reverse step.
- A class label, text embedding, or layout can provide \(c\); request adherence needs testing.
The codec and denoiser create different sources of error
| Real image \(\to\) encode \(\to\) decode |
Detail lost by the codec |
| Noise \(\to\) latent denoising \(\to\) decode |
End-to-end generation quality and diversity |
| Repeat requests across seeds |
Consistency and condition adherence |
Smaller latent arrays can reduce repeated computation, with a compression tradeoff.