Simple Algorithm
Deep Learning · Emergence · 28 min

The Design Space of Diffusion Models

Noise schedules, preconditioning, samplers and diffusion transformers.

DDPM, score-based SDEs and DDIM were derived from different theories, and their code tangled together choices that have nothing to do with each other. Karras et al. (2022) rewrote them as one recipe with independent dials: the coordinates of the ODE, the scaling of the network's inputs and outputs, the weighting of noise levels, the sampler. Setting each dial deliberately cut the network evaluations needed per sample by factors of 3 to 300 and set new benchmark records.

What you’ll learn

  • Write any Gaussian diffusion model as a denoiser D(x;σ)D(\mathbf x;\sigma) and a probability-flow ODE in σ\sigma, and explain why the noise schedule changes only the ODE's coordinates, not its solutions.
  • Derive EDM's preconditioning cin,cskip,coutc_{\text{in}},c_{\text{skip}},c_{\text{out}} and loss weight from unit-variance requirements, and relate them to ϵ\boldsymbol\epsilon-, x0\mathbf x_0- and v\mathbf v-prediction.
  • Compare noise schedules and loss weightings through the log-SNR, including the cosine schedule, the shift with image resolution and zero terminal SNR.
  • Implement EDM's Heun sampler, derive the exponential-integrator form behind DPM-Solver, and compare U-Net and transformer backbones.

One ODE in many coordinates

Write the noisy sample in the variance-exploding coordinates of Diffusion Models, x=x0+σϵ\mathbf x=\mathbf x_0+\sigma\boldsymbol\epsilon, so that the data blurred to noise level σ\sigma is p(x;σ)=pdata∗N(0,σ2I)p(\mathbf x;\sigma)=p_{\text{data}}*\mathcal N(\mathbf 0,\sigma^2I). The trained network is a denoiser Dθ(x;σ)≈E[x0∣x]D_{\boldsymbol\theta}(\mathbf x;\sigma)\approx\E[\mathbf x_0\mid\mathbf x], the minimizer of E∥D(x0+σϵ;σ)−x0∥2\E\norm{D(\mathbf x_0+\sigma\boldsymbol\epsilon;\sigma)-\mathbf x_0}^2, and Tweedie's formula turns it into the score, which gives the probability-flow ODE in its simplest form (Karras et al., 2022):

∇xlog⁡p(x;σ)=D(x;σ)−xσ2,dxdσ=−σ ∇xlog⁡p(x;σ)=x−D(x;σ)σ\nabla_{\mathbf x}\log p(\mathbf x;\sigma)=\frac{D(\mathbf x;\sigma)-\mathbf x}{\sigma^2},\qquad\frac{d\mathbf x}{d\sigma}=-\sigma\,\nabla_{\mathbf x}\log p(\mathbf x;\sigma)=\frac{\mathbf x-D(\mathbf x;\sigma)}{\sigma}
Integrated from σmax⁡\sigma_{\max} down to 00, the ODE carries samples of p(x;σmax⁡)≈N(0,σmax⁡2I)p(\mathbf x;\sigma_{\max})\approx\mathcal N(\mathbf 0,\sigma_{\max}^2I) to the data. Note that (x−D)/σ(\mathbf x-D)/\sigma is just the predicted noise ϵ^\hat{\boldsymbol\epsilon}.

Earlier models used other clocks and rescaled x\mathbf x: a variance-preserving model works with αˉ x\sqrt{\bar\alpha}\,\mathbf x on its own schedule. EDM's general ODE has a noise schedule σ(t)\sigma(t) and a scale s(t)s(t), and Karras et al. show that every such choice is a reparameterization of the same canonical ODE: σ(t)\sigma(t) relabels time and s(t)s(t) rescales space. With an exact denoiser and exact integration, all of them carry a given noise sample to the same output. The choices matter only through the errors a numerical solver makes, which grow with the curvature of the trajectories in the chosen coordinates. That separation is what made a systematic search possible:

DialWhat it controlsTypical earlier choiceEDM
Schedule σ(t)\sigma(t), scale s(t)s(t)coordinates of the ODE, hence its curvatureVP: σ(t)\sigma(t) from a β\beta ramp with shrinking s(t)s(t); VE: σ(t)=t\sigma(t)=\sqrt tσ(t)=t\sigma(t)=t, s(t)=1s(t)=1
Time stepswhere the solver spends its evaluationsuniform in tt (VP), geometric in σ\sigma (VE)σi=(σmax⁡1/ρ+iN−1(σmin⁡1/ρ−σmax⁡1/ρ))ρ\sigma_i=\big(\sigma_{\max}^{1/\rho}+\tfrac{i}{N-1}(\sigma_{\min}^{1/\rho}-\sigma_{\max}^{1/\rho})\big)^\rho, ρ=7\rho=7, σ∈[0.002,80]\sigma\in[0.002,80]
Solvererror per network evaluationEulerHeun's second-order method, optionally with added noise
Preconditioningwhat the raw network sees and outputsϵ\boldsymbol\epsilon-predictioncin,cskip,coutc_{\text{in}},c_{\text{skip}},c_{\text{out}} (next step), cnoise=14ln⁡σc_{\text{noise}}=\tfrac14\ln\sigma
Training noise ptrain(σ)p_{\text{train}}(\sigma) and weight λ(σ)\lambda(\sigma)where training effort goesuniform in tt (VP) or in ln⁡σ\ln\sigma (VE); λ=1/σ2\lambda=1/\sigma^2ln⁡σ∼N(−1.2,1.22)\ln\sigma\sim\mathcal N(-1.2,1.2^2), λ=1/cout2\lambda=1/c_{\text{out}}^2
Simplified from Karras et al. (2022), Table 1. With all dials set, a CIFAR-10 model reached FID 1.79 (class-conditional) and 1.97 (unconditional) with 35 network evaluations per sample.

Why σ(t)=t\sigma(t)=t? Then dx/dt=(x−D(x;t))/td\mathbf x/dt=(\mathbf x-D(\mathbf x;t))/t, so one Euler step from any (x,t)(\mathbf x,t) to t=0t=0 lands exactly on D(x;t)D(\mathbf x;t): the tangent always points at the current denoised estimate. That estimate barely moves at high noise, where it sits near the dataset mean, or at low noise, where the image is settled, so trajectories are nearly straight at both ends and curve only in a middle band of σ\sigma. EDM's sketch with data at ±1\pm1 shows exactly this, whereas variance-preserving trajectories flatten out at large σ\sigma and variance-exploding ones curve everywhere. DDIM already used these coordinates. Together with Heun's method and the step schedule, they reduced the evaluations needed for high-quality samples by 7.3 times for a VP model, 300 times for a VE model and 3.2 times for DDIM-style sampling of ADM.

Preconditioning and the loss

A network asked to output DD directly would see inputs whose scale ranges from the data's, σdata=0.5\sigma_{\text{data}}=0.5 for images in [−1,1][-1,1], to over a hundred times larger. Noise prediction writes D=x−σFθD=\mathbf x-\sigma F_{\boldsymbol\theta} instead, which at large σ\sigma multiplies every error of the network by σ\sigma and forces it to cancel the input's noise almost exactly. EDM mixes a skip connection and the network's output with σ\sigma-dependent coefficients:

Dθ(x;σ)=cskip(σ) x+cout(σ) Fθ(cin(σ) x; cnoise(σ)),L=Eσ,x0,n[λ(σ) cout(σ)2⏟effective weight∥Fθ(⋅)−x0−cskip(σ)(x0+n)cout(σ)⏟effective target∥2]D_{\boldsymbol\theta}(\mathbf x;\sigma)=c_{\text{skip}}(\sigma)\,\mathbf x+c_{\text{out}}(\sigma)\,F_{\boldsymbol\theta}\big(c_{\text{in}}(\sigma)\,\mathbf x;\ c_{\text{noise}}(\sigma)\big),\qquad\loss=\E_{\sigma,\mathbf x_0,\mathbf n}\Big[\underbrace{\lambda(\sigma)\,c_{\text{out}}(\sigma)^2}_{\text{effective weight}}\Big\|F_{\boldsymbol\theta}(\cdot)-\underbrace{\frac{\mathbf x_0-c_{\text{skip}}(\sigma)(\mathbf x_0+\mathbf n)}{c_{\text{out}}(\sigma)}}_{\text{effective target}}\Big\|^2\Big]
The loss λ(σ)∥Dθ(x0+n;σ)−x0∥2\lambda(\sigma)\norm{D_{\boldsymbol\theta}(\mathbf x_0+\mathbf n;\sigma)-\mathbf x_0}^2 rewritten in terms of the raw network FθF_{\boldsymbol\theta}, with n∼N(0,σ2I)\mathbf n\sim\mathcal N(\mathbf 0,\sigma^2I).
DerivationPreconditioning from unit variances
  1. cin(σ)2(σdata2+σ2)=1⟹cin(σ)=1σ2+σdata2c_{\text{in}}(\sigma)^2\big(\sigma_{\text{data}}^2+\sigma^2\big)=1\quad\Longrightarrow\quad c_{\text{in}}(\sigma)=\frac{1}{\sqrt{\sigma^2+\sigma_{\text{data}}^2}}

    Assume each coordinate of the data has variance σdata2\sigma_{\text{data}}^2 and the noise is independent of the data. Require the network's input to have unit variance:

  2. cout(σ)2=(1−cskip)2 σdata2+cskip2 σ2c_{\text{out}}(\sigma)^2=(1-c_{\text{skip}})^2\,\sigma_{\text{data}}^2+c_{\text{skip}}^2\,\sigma^2

    Require the effective target to have unit variance too. Its numerator is (1−cskip)x0−cskipn(1-c_{\text{skip}})\mathbf x_0-c_{\text{skip}}\mathbf n:

  3. cskip(σ)=σdata2σ2+σdata2,cout(σ)=σ σdataσ2+σdata2c_{\text{skip}}(\sigma)=\frac{\sigma_{\text{data}}^2}{\sigma^2+\sigma_{\text{data}}^2},\qquad c_{\text{out}}(\sigma)=\frac{\sigma\,\sigma_{\text{data}}}{\sqrt{\sigma^2+\sigma_{\text{data}}^2}}

    Any error of FθF_{\boldsymbol\theta} reaches DθD_{\boldsymbol\theta} multiplied by coutc_{\text{out}}, so choose cskipc_{\text{skip}} to make coutc_{\text{out}} as small as possible. Setting the derivative −2(1−cskip)σdata2+2cskipσ2-2(1-c_{\text{skip}})\sigma_{\text{data}}^2+2c_{\text{skip}}\sigma^2 to zero:

  4. λ(σ)=σ2+σdata2(σ σdata)2\lambda(\sigma)=\frac{\sigma^2+\sigma_{\text{data}}^2}{(\sigma\,\sigma_{\text{data}})^2}

    Finally, give every noise level the same effective weight, λ(σ)cout(σ)2=1\lambda(\sigma)c_{\text{out}}(\sigma)^2=1, which also equalizes the initial loss across σ\sigma:

Predict before you look

At the noise level σ=σdata\sigma=\sigma_{\text{data}}, what is the skip coefficient cskipc_{\text{skip}}, the weight on the noisy input in the denoiser's output?

Show the answer

0.5

cskip=σdata2/(σdata2+σdata2)=12c_{\text{skip}}=\sigma_{\text{data}}^2/(\sigma_{\text{data}}^2+\sigma_{\text{data}}^2)=\tfrac12, and cout=σdata/2≈0.354c_{\text{out}}=\sigma_{\text{data}}/\sqrt2\approx0.354 for σdata=0.5\sigma_{\text{data}}=0.5. Below this level cskip→1c_{\text{skip}}\to1 and the network only predicts a small correction, essentially the noise; above it cskip→0c_{\text{skip}}\to0 and cout→σdatac_{\text{out}}\to\sigma_{\text{data}}, so the network predicts the clean image itself. The parameterization slides between noise and data prediction according to which is easier.

The familiar parameterizations are corners of this family. ϵ\boldsymbol\epsilon-prediction is cskip=1c_{\text{skip}}=1, cout=−σc_{\text{out}}=-\sigma; predicting x0\mathbf x_0 outright is cskip=0c_{\text{skip}}=0, cout=1c_{\text{out}}=1; and with σdata=1\sigma_{\text{data}}=1, EDM's coefficients reproduce, up to the sign of the output, v\mathbf v-prediction (Salimans & Ho, 2022), which Continuous Flows & Flow Matching identifies with flow matching on the variance-preserving path.

Where to train. With these weights the loss starts out equal at every σ\sigma, but after training it can be pushed well below its initial value only at intermediate noise levels: at very low σ\sigma the noise is vanishingly small and irrelevant, and at very high σ\sigma the best answer is close to the dataset average and far from any single example. EDM therefore draws ln⁡σ∼N(−1.2,1.22)\ln\sigma\sim\mathcal N(-1.2,1.2^2), centered near σ≈0.3\sigma\approx0.3. These training changes plus a non-leaky augmentation scheme took the class-conditional CIFAR-10 FID from 2.48 to 1.79 at 35 evaluations.

Noise schedules and the signal-to-noise ratio

Every schedule is a map from time to the log-SNR λ=log⁡(αˉ/(1−αˉ))\lambda=\log\big(\bar\alpha/(1-\bar\alpha)\big), which in EDM's coordinates is simply λ=−2ln⁡σ\lambda=-2\ln\sigma. Once the weighting is fixed, the schedule decides where training examples and sampling steps fall along λ\lambda.

DDPM's linear β\beta schedule spends them badly at low resolution: as the predict in Diffusion Models showed, half of the signal variance is gone a quarter of the way through, and the last third of the chain is almost pure noise. Nichol & Dhariwal (2021) found that a 64×6464\times64 ImageNet model trained with it barely lost FID when the first 20% of the reverse process was skipped. Their cosine schedule αˉt=f(t)/f(0)\bar\alpha_t=f(t)/f(0), f(t)=cos⁡2 ⁣(t/T+s1+s⋅π2)f(t)=\cos^2\!\big(\tfrac{t/T+s}{1+s}\cdot\tfrac\pi2\big), makes αˉ\bar\alpha fall almost linearly in the middle and change little near both ends; without the small offset s=0.008s=0.008 its log-SNR is −2log⁡tan⁡(πt/2)-2\log\tan(\pi t/2). The same paper learned the reverse variances, interpolating between βt\beta_t and β~t\tilde\beta_t in log space with a small weight (0.0010.001) on the true ELBO, which kept FID near its best with 100 sampling steps of a model trained with 4,000.

DerivationWhy larger images need more noise (Hoogeboom, Heek & Salimans, 2023)
  1. xˉt=α xˉ0+σs ϵˉ,ϵˉ∼N(0,1)⟹SNRpooled(t)=s2 SNR(t)\bar x_t=\alpha\,\bar x_0+\frac{\sigma}{s}\,\bar\epsilon,\quad\bar\epsilon\sim\mathcal N(0,1)\qquad\Longrightarrow\qquad\mathrm{SNR}_{\text{pooled}}(t)=s^2\,\mathrm{SNR}(t)

    Average-pool a noisy image xt=αx0+σϵ\mathbf x_t=\alpha\mathbf x_0+\sigma\boldsymbol\epsilon over s×ss\times s blocks. The signal of a block is α\alpha times the average of its pixels; its noise is the average of s2s^2 independent noises, with variance σ2/s2\sigma^2/s^2:

  2. SNRd×d shift(t)=SNR64×64(t)⋅(64d)2,a shift of the log-SNR by 2log⁡64d\mathrm{SNR}^{\,\text{shift}}_{d\times d}(t)=\mathrm{SNR}_{64\times64}(t)\cdot\Big(\frac{64}{d}\Big)^2,\qquad\text{a shift of the log-SNR by }2\log\frac{64}{d}

    The network's downsampling layers work with such pooled images. On a large image, the coarse structure, which is decided at those resolutions, is therefore far less corrupted at a given step than on a small image, and much of the chain is spent after the global layout is fixed. Hoogeboom et al. define the schedule at a reference resolution of 64×6464\times64 and shift it for a d×dd\times d image:

Predict before you look

By what factor must the SNR be divided at every step so that a 512×512512\times512 image, viewed at the 64×6464\times64 scale, sees the same noise as a 64×6464\times64 image does under the reference schedule?

Show the answer

64

Pooling 512×512512\times512 down to 64×6464\times64 averages 8×88\times8 blocks, multiplying the SNR by 82=648^2=64, so the schedule must divide it by 64, a log-SNR shift of 2ln⁡8≈4.162\ln8\approx4.16. Chen (2023) reached the same conclusion empirically: the best schedule becomes noisier as images grow, and simply scaling the input data down by a constant works across sizes.

Samplers: step placement, order and noise

EDM's step schedule interpolates between σmax⁡=80\sigma_{\max}=80 and σmin⁡=0.002\sigma_{\min}=0.002 uniformly in σ1/ρ\sigma^{1/\rho}. With ρ=1\rho=1 the levels are uniform in σ\sigma; larger ρ\rho crowds them toward small σ\sigma. For N=18N=18 levels, ρ=7\rho=7 puts 7 of them below σ=1\sigma=1, against 1 for uniform spacing. Karras et al. found that ρ=3\rho=3 nearly equalizes the truncation error of every step, yet ρ\rho between 5 and 10 gives clearly better images: errors made near σmin⁡\sigma_{\min}, where detail forms, cost the most. The solver is Heun's method, an Euler step followed by a trapezoidal correction, with local error O(h3)\order{h^3} instead of Euler's O(h2)\order{h^2} at the cost of a second evaluation per step:

python
import torch

@torch.no_grad()
def edm_sample(D, shape, N=18, sigma_min=0.002, sigma_max=80.0, rho=7.0):
    i = torch.arange(N)
    sig = (sigma_max ** (1 / rho) + i / (N - 1) * (sigma_min ** (1 / rho) - sigma_max ** (1 / rho))) ** rho
    sig = torch.cat([sig, torch.zeros(1)])         # sigma_N = 0
    x = torch.randn(shape) * sig[0]
    for s, s_next in zip(sig[:-1], sig[1:]):
        d = (x - D(x, s)) / s                      # dx/dsigma at s
        x_next = x + (s_next - s) * d              # Euler step
        if s_next > 0:                             # Heun's correction
            d_next = (x_next - D(x_next, s_next)) / s_next
            x_next = x + (s_next - s) * 0.5 * (d + d_next)
        x = x_next
    return x                                       # 2N - 1 evaluations of D

D(x, sigma) is the preconditioned denoiser. The last step, to σ=0\sigma=0, has no correction, so N=18N=18 costs the 35 evaluations of EDM's CIFAR-10 results. With the exact denoiser of a small mixture of Gaussians in place of a network, this loop reproduces the mixture.

Adding noise back. EDM's stochastic sampler first raises the noise level of the current sample by a factor 1+γi1+\gamma_i, with fresh noise, and then takes the ODE step down. Injecting and removing noise lets later steps correct earlier errors, in the manner of Langevin dynamics, but too much of it erodes detail and drifts colors toward oversaturation, which Karras et al. attribute to learned denoisers being slightly non-conservative. So they add noise only within a band of noise levels, never more than is already present (γi≤2−1\gamma_i\le\sqrt2-1), and inflate it slightly. With their improved training, deterministic sampling was best on CIFAR-10, while ImageNet 64×6464\times64 still gained: FID 1.36 at 511 evaluations, a record at the time.

What the last step does. The widget's sampler ends, like DDPM's and EDM's, by jumping from the smallest noise level straight to the denoised estimate. Watch what that costs:

DerivationExponential integrators and DPM-Solver (Lu et al., 2022)
  1. x(σt)=x(σs)+∫σsσtϵ^ dσ=x(σs)−∫νsνte−ν ϵ^ν dν\mathbf x(\sigma_t)=\mathbf x(\sigma_s)+\int_{\sigma_s}^{\sigma_t}\hat{\boldsymbol\epsilon}\,d\sigma=\mathbf x(\sigma_s)-\int_{\nu_s}^{\nu_t}e^{-\nu}\,\hat{\boldsymbol\epsilon}_\nu\,d\nu

    In EDM's coordinates the ODE is dx/dσ=ϵ^(x;σ)d\mathbf x/d\sigma=\hat{\boldsymbol\epsilon}(\mathbf x;\sigma), the predicted noise. Integrate exactly from σs\sigma_s down to σt\sigma_t and change variables to ν=−ln⁡σ\nu=-\ln\sigma, half the log-SNR (Lu et al. call it λ\lambda):

  2. zt=atas zs−at∫νsνte−ν ϵ^θ(z^ν,ν) dν\mathbf z_t=\frac{a_t}{a_s}\,\mathbf z_s-a_t\int_{\nu_s}^{\nu_t}e^{-\nu}\,\hat{\boldsymbol\epsilon}_{\boldsymbol\theta}(\hat{\mathbf z}_\nu,\nu)\,d\nu

    In variance-preserving coordinates z=a x\mathbf z=a\,\mathbf x, with signal scale at=1/1+σt2=αˉta_t=1/\sqrt{1+\sigma_t^2}=\sqrt{\bar\alpha_t}, this is Lu et al.'s exact solution: the linear part of the ODE, at/asa_t/a_s, is handled exactly and only an exponentially weighted integral of the network remains.

  3. x(σt)=x(σs)+(σt−σs) ϵ^(x(σs);σs)⟺zt=atas zs−1−αˉt (eh−1) ϵ^θ(zs,s)\mathbf x(\sigma_t)=\mathbf x(\sigma_s)+(\sigma_t-\sigma_s)\,\hat{\boldsymbol\epsilon}(\mathbf x(\sigma_s);\sigma_s)\quad\Longleftrightarrow\quad\mathbf z_t=\frac{a_t}{a_s}\,\mathbf z_s-\sqrt{1-\bar\alpha_t}\,\big(e^{h}-1\big)\,\hat{\boldsymbol\epsilon}_{\boldsymbol\theta}(\mathbf z_s,s)

    Freeze ϵ^\hat{\boldsymbol\epsilon} at its value at νs\nu_s. The integral becomes e−νs−e−νt=σs−σte^{-\nu_s}-e^{-\nu_t}=\sigma_s-\sigma_t, and the step is Euler's method in σ\sigma, which is exactly deterministic DDIM; in variance-preserving coordinates, with h=νt−νsh=\nu_t-\nu_s, it is Lu et al.'s DPM-Solver-1:

  4. Keeping kk terms of a Taylor expansion of ϵ^\hat{\boldsymbol\epsilon} in ν\nu, with intermediate evaluations to estimate the derivatives, gives DPM-Solver-kk, whose error at the end of sampling is O(hmax⁡k)\order{h_{\max}^k} under regularity assumptions on the network (Lu et al., Theorem 3.2, proved for k≤3k\le3). On CIFAR-10 it reached FID 4.70 with 10 evaluations and 2.87 with 20. Heun's method assumes ϵ^\hat{\boldsymbol\epsilon} smooth in σ\sigma; exponential integrators assume it smooth in log⁡σ\log\sigma.

Guided sampling is harder on high-order solvers: large guidance scales amplify the network's output and its derivatives, which shrinks the step sizes at which those solvers stay stable, and early high-order samplers did worse than DDIM at strong guidance. DPM-Solver++ (Lu et al., 2022b) solves the ODE with the data prediction DD instead of ϵ^\hat{\boldsymbol\epsilon}, uses thresholding and a multistep variant, and reports high-quality guided samples in 15 to 20 steps.

Backbones: U-Nets and transformers

The U-Net, refined. Dhariwal & Nichol (2021) ablated DDPM's U-Net on ImageNet 128×128128\times128 and settled on attention at the 32×3232\times32, 16×1616\times16 and 8×88\times8 resolutions instead of 16×1616\times16 only, more attention heads (64 channels per head), BigGAN-style residual blocks for up- and downsampling, and adaptive group normalization, which alone lowered FID from 15.08 to 13.06 in their ablation. This ADM architecture, with classifier guidance, beat BigGAN-deep's FID on ImageNet at several resolutions, and matched it with as few as 25 DDIM steps.

Transformers. DiT (Peebles & Xie, 2023) cuts the I×I×CI\times I\times C latent of a pretrained autoencoder into p×pp\times p patches, giving (I/p)2(I/p)^2 tokens, adds sine–cosine position embeddings, and applies standard transformer blocks conditioned by adaLN-Zero (Guidance & Conditioning). Across 12 configurations of size and patch size, FID tracked forward-pass compute closely, with a correlation of −0.93-0.93 with Gflops: higher compute, whether from depth, width or more tokens, consistently gave lower FID. Halving pp quadruples the tokens and the compute while barely changing the parameter count. DiT-XL/2, at 118.6 Gflops, reached FID 2.27 on class-conditional ImageNet 256×256256\times256 with guidance.

BackboneStrengthsCosts
U-Net (DDPM, ADM, latent diffusion)multi-scale features and skip connections suit dense, image-shaped outputs; strong at moderate computemany hand-designed choices; attention only at low resolutions
Diffusion transformer (DiT and successors)uniform blocks that scale predictably with compute; text and image tokens can share one sequenceattention cost grows with the square of the token count, so it relies on a compressive latent space and patches
As of the mid-2020s, published large text-to-image models increasingly use transformer backbones, for example the rectified-flow transformer of Esser et al. (2024), which processes text and image tokens in one sequence; U-Nets remain common at moderate scale and in pixel space.

Key takeaways

  • Every Gaussian diffusion model is a denoiser D(x;σ)D(\mathbf x;\sigma) plus the ODE dx/dσ=(x−D)/σd\mathbf x/d\sigma=(\mathbf x-D)/\sigma; schedules and scalings reparameterize it, leaving exact solutions unchanged and altering only discretization error. With σ(t)=t\sigma(t)=t trajectories are nearly straight at both ends.
  • EDM's preconditioning follows from unit-variance inputs and targets plus minimal error amplification: cin=1/σ2+σdata2c_{\text{in}}=1/\sqrt{\sigma^2+\sigma_{\text{data}}^2}, cskip=σdata2/(σ2+σdata2)c_{\text{skip}}=\sigma_{\text{data}}^2/(\sigma^2+\sigma_{\text{data}}^2), cout=σσdata/σ2+σdata2c_{\text{out}}=\sigma\sigma_{\text{data}}/\sqrt{\sigma^2+\sigma_{\text{data}}^2}, λ=1/cout2\lambda=1/c_{\text{out}}^2; ϵ\boldsymbol\epsilon-, x0\mathbf x_0- and v\mathbf v-prediction are special cases.
  • Training effort belongs at intermediate noise levels (EDM: ln⁡σ∼N(−1.2,1.22)\ln\sigma\sim\mathcal N(-1.2,1.2^2)); every common objective is a weighted integral of ELBOs, and only the weight on each log-SNR matters.
  • Schedules are maps to log-SNR: the cosine schedule fixes the linear schedule's wasted noisy tail, larger images need the SNR divided by the square of the downsampling factor, and the last step should reach zero SNR.
  • Heun's method with steps crowded toward low noise (ρ=7\rho=7) and exponential integrators such as DPM-Solver, whose first-order case is DDIM, sample well in tens of evaluations; DiT's FID tracks forward-pass compute.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Under EDM's preconditioning, what does the raw network FθF_{\boldsymbol\theta} effectively predict at very high noise, σ≫σdata\sigma\gg\sigma_{\text{data}}?

  1. The noise ϵ\boldsymbol\epsilon, scaled by σ\sigma
  2. The clean image, scaled by 1/σdata1/\sigma_{\text{data}}: cskip→0c_{\text{skip}}\to0 and cout→σdatac_{\text{out}}\to\sigma_{\text{data}}
  3. Nothing: its output is multiplied by zero
  4. The noisy input itself
Show the answer

B. The clean image, scaled by 1/σdata1/\sigma_{\text{data}}: cskip→0c_{\text{skip}}\to0 and cout→σdatac_{\text{out}}\to\sigma_{\text{data}}

As σ→∞\sigma\to\infty, cskip=σdata2/(σ2+σdata2)→0c_{\text{skip}}=\sigma_{\text{data}}^2/(\sigma^2+\sigma_{\text{data}}^2)\to0 and cout=σσdata/σ2+σdata2→σdatac_{\text{out}}=\sigma\sigma_{\text{data}}/\sqrt{\sigma^2+\sigma_{\text{data}}^2}\to\sigma_{\text{data}}, so D≈σdataFθD\approx\sigma_{\text{data}}F_{\boldsymbol\theta}: the network outputs the (normalized) clean image, and its errors are not amplified by σ\sigma as they would be under noise prediction.

Question 2

Two samplers use the same trained denoiser D(x;σ)D(\mathbf x;\sigma) but different schedules σ(t)\sigma(t) and scalings s(t)s(t), and both integrate the probability-flow ODE exactly from the same noise. How do their outputs compare?

  1. They differ, because each schedule defines a different target distribution
  2. The variance-preserving one is more accurate, because it keeps the scale fixed
  3. They are identical: every choice reparameterizes time and space in the same canonical ODE, so only discretization errors depend on it
  4. They differ by a random amount, because the ODE is stochastic
Show the answer

C. They are identical: every choice reparameterizes time and space in the same canonical ODE, so only discretization errors depend on it

Karras et al. show that σ(t)\sigma(t) relabels time and s(t)s(t) rescales space in one canonical ODE. Exact solutions coincide; what the schedule changes is the curvature of trajectories in the solver's coordinates, and so the truncation error of a finite number of steps.

Question 3

In EDM's step schedule, ρ=3\rho=3 nearly equalizes the truncation error of each step, yet ρ\rho between 5 and 10 gives better images. What does that suggest?

  1. Errors at low noise levels, where fine detail is formed, matter more for image quality than errors of the same size at high noise
  2. Larger ρ\rho uses more network evaluations
  3. Truncation error is irrelevant to image quality
  4. High-noise steps should be shortened instead
Show the answer

A. Errors at low noise levels, where fine detail is formed, matter more for image quality than errors of the same size at high noise

Larger ρ\rho shortens the steps near σmin⁡\sigma_{\min} at the expense of longer steps near σmax⁡\sigma_{\max}. That it helps although it makes per-step errors unequal means errors made late in sampling are costlier, as Karras et al. concluded.

Further reading

  • T. Karras, M. Aittala, T. Aila & S. Laine, "Elucidating the design space of diffusion-based generative models," NeurIPS (2022).
  • A. Nichol & P. Dhariwal, "Improved denoising diffusion probabilistic models," ICML (2021).
  • E. Hoogeboom, J. Heek & T. Salimans, "simple diffusion: End-to-end diffusion for high resolution images," ICML (2023).
  • C. Lu, Y. Zhou, F. Bao, J. Chen, C. Li & J. Zhu, "DPM-Solver: A fast ODE solver for diffusion probabilistic model sampling in around 10 steps," NeurIPS (2022).
  • W. Peebles & S. Xie, "Scalable diffusion models with transformers," ICCV (2023).