EDM: Elucidating the Design Space of Diffusion-Based Generative Models
Split a diffusion model into independent choices (noise schedule, step spacing, solver, network scaling, loss) and pick each one on its own.
Karras et al. rewrite the major diffusion model families as one denoiser and one differential equation, then optimize sampling and training separately to reach record image quality in 35 network passes per image.
Explaining the paperElucidating the Design Space of Diffusion-Based Generative ModelsSwap the sampler on a diffusion model somebody else trained and cut generation from 256 network calls to 35 at the same image quality; then retrain the denoiser with a balanced loss to set new records on CIFAR-10 and ImageNet.
Diffusion models generate images by starting from random pixel static and running a neural network repeatedly to strip the noise away until a coherent picture appears. By mid-2022, three widely used families did this in ways that looked like separate mathematical worlds. DDPM (Denoising Diffusion Probabilistic Models) and Nichol and Dhariwal's Improved DDPM (iDDPM) framed noising as a 1,000-step discrete Markov chain derived from a variational lower bound. Song et al.'s score SDE formulation replaced the discrete chain with a continuous stochastic differential equation (SDE, a velocity rule plus continuous random kicks) in two variants: VP (variance-preserving, which shrinks the image as noise is added so total pixel variance stays near 1) and VE (variance-exploding, which adds noise onto an unscaled image so variance grows without shrinking the signal). DDIM (Denoising Diffusion Implicit Models) kept DDPM's trained weights and derived a deterministic (noise-free) sampling path that skipped most of the 1,000 steps. Because each paper derived its noise schedule, step spacing, network scaling, and training loss together from one theory, every model shipped as a locked bundle, leaving researchers unable to tell which choices mattered and which were incidental.
Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine at NVIDIA broke those bundles apart. First, they put all three families into one shared notation: a single denoiser network plugged into a single ordinary differential equation (ODE, a deterministic velocity rule with no random kicks after the starting noise), with every remaining choice listed in one table so rows can be mixed independently across columns. Second, they replaced only the sampler on three pre-trained models they did not retrain, measuring image quality by FID (Fréchet Inception Distance, which compares the distribution of 50,000 generated images against all available real images in the feature space of an Inception-v3 classifier; lower is better, 0 means identical distributions, and random variation is around ±2%, so the paper runs each evaluation three times and reports the minimum) and speed by NFE (number of function evaluations, counting how many forward passes of the neural network produce one image; lower is proportionally faster). On CIFAR-10 (60,000 tiny 32×32 color photos across 10 object classes), the new deterministic sampler cut NFE by 7.3× on pre-trained VP (from 256 to 35 calls) and 300× on pre-trained VE (from 8,192 to 27 calls); on ImageNet-64 (1.28 million 64×64 color photos across 1,000 classes), it cut NFE by 3.2× on DDIM (from 250 to 79 calls).
Third, the authors redesigned training itself: a first-principles scaling wrapper around the network's inputs, outputs, and skip connection, a loss weight that equalizes every noise level at initialization, a log-normal distribution that focuses training on intermediate noise levels, and geometric image augmentations conditioned so they never leak into generated samples. Retrained with those choices, the models set new records of FID 1.79 on class-conditional CIFAR-10 (down from 1.85 by StyleGAN-XL) and 1.97 unconditional (down from 2.10) at 35 deterministic network calls, and FID 1.36 on class-conditional ImageNet-64 (down from 1.48 by cascaded diffusion) without classifier-free guidance (a sampling technique that strengthens class conditioning by contrasting conditional and unconditional predictions) or a separate super-resolution stage.
How EDM unifies diffusion models
Picture a dataset of real images, such as CIFAR-10 photos scaled so every pixel lies in with per-pixel standard deviation around 0.5. Each 32×32 RGB image is a single point in a 3,072-dimensional space, and the whole dataset forms a sparse, high-dimensional cloud with probability density . Adding independent Gaussian noise of standard deviation to every pixel blurs that cloud into a smooth density , much like applying a wider and wider Gaussian blur to a relief map. At tiny noise (), the blurred distribution is indistinguishable from real images. At huge noise (), an image signal of amplitude 0.5 buried under static of amplitude 80 is swamped, so is practically indistinguishable from pure Gaussian noise .
Sampling reverses that blur: draw a starting image of pure noise with standard deviation , and walk it through decreasing noise levels so that at each level the sample follows , landing on a draw from when .
To determine which direction to move a noisy image at noise level , EDM builds everything around a plain denoiser . Given a noisy input formed by adding Gaussian noise of standard deviation to a real image , the ideal denoiser minimizes the expected squared pixel error separately at every noise level:
In (2), is an uncorrupted training image, is random noise at scale , and the squared norm sums the squared error across all pixels. Because the function that minimizes squared error is always the conditional expectation (the average over all answers compatible with the input), the ideal denoiser does not pick a single crisp image when noise is heavy. Instead, it outputs a weighted average of every training image , weighted by the Gaussian probability that noise of size could have turned into the observed . For a finite dataset of images, Appendix B.3 writes that exact ideal denoiser in closed form:
Work a tiny 1-D example with three data points at −1.25, −0.35, and 1.05, and ask what the ideal denoiser outputs at when . Evaluating the Gaussian density at the three points gives weights 0.0119, 0.4357, and 0.1881. The distant point at −1.25 contributes under 2% of the total weight, leaving , a blend sitting between −0.35 and 1.05 and pulled closer to −0.35. Now raise to 80: every data point is tiny compared with the Gaussian width, all three weights become nearly identical, and outputs the dataset mean −0.183 regardless of . Shrink toward zero and the single closest point takes 100% of the weight, so snaps onto it. Every ideal denoiser therefore has three regimes: it snaps to the nearest data point at low noise, blends nearby candidates at intermediate noise, and collapses to the dataset mean at high noise.
The score function, , is the gradient of the log density: at any point , it is a vector pointing uphill toward denser regions of the blurred image cloud. Computing directly is impossible because it requires integrating a normalizing constant over all 3,072 pixel dimensions, yet differentiating its logarithm makes that constant vanish. Differentiating the Gaussian mixture directly (denoising score matching, the foundation of NCSN, Noise Conditional Score Networks) produces an exact identity connecting the score to the ideal denoiser:
Read (3) geometrically: subtract the current noisy point from the denoiser's guess to get a vector pointing toward uncorrupted images, then divide by the noise variance (not , because differentiating the Gaussian exponent brings down ). In the 1-D example at and , the score is , pointing left toward the two nearby data points. Because a network trained by plain regression on (2) immediately yields the score through (3), EDM converts every diffusion model in the literature, including score networks and noise predictors, into one common denoiser interface .
With the score available at every noise level, how do we move a sample from down to ? Song et al. proved that random Gaussian noising has a deterministic twin called the probability-flow ODE. Picture a cloud of particles expanding outward like gas as noise increases: instead of kicking each particle randomly, a deterministic velocity field pushes every particle outward along the uphill-reversed density gradient at the exact rate needed to reproduce the same blurred density at every time . Choose any noise schedule that specifies the noise level at time . The velocity rule that preserves the marginals forward and backward in time is:
The derivative is how fast noise rises with . Forward in time (), the minus sign nudges downhill away from dense data so the cloud spreads out; backward in time (), the signs flip and the ODE pulls uphill toward the data. Now substitute (3) into (1) and pick the simplest schedule possible, , so time equals the noise level itself and . The in the denominator of (3) cancels one factor of , leaving:
This velocity has a direct geometric reading: moving backward from toward 0 steers straight toward the denoiser's current estimate , scaled by . Continuing the 1-D worked example at and , the velocity is . One backward Euler step of size down to lands at . Generation repeats that update from to , substituting a trained neural network for the ideal denoiser .
DDPM and VP models add a second coordinate function. Rather than adding noise of standard deviation 80 directly onto unscaled images, VP-style methods keep total pixel variance near 1 by multiplying the state by a shrinking scale schedule , tracking where is the unscaled variable. Applying the product rule to adds a radial scaling drift and rescales the score argument by so the underlying blurred density stays independent of :
Appendix B.2 proves that every published probability-flow ODE reduces to (4) for some pair of coordinate functions and . Changing only re-clocks time; changing only stretches the state axis. Neither alters the sequence of blurred distributions a sample passes through. Putting VP, VE, iDDPM+DDIM, and EDM into one table exposes every remaining decision as an independent row:
| Table 1 (abridged) | VP | VE | iDDPM + DDIM | EDM |
|---|---|---|---|---|
| ODE solver | Euler | Euler | Euler | Heun (2nd order) |
| time steps | linear in t | geometric in σ | every k-th of 1000 | Eq. (5), ρ = 7 |
| schedule σ(t) | √(exp(½β_d t² + β_min t) − 1) | √t | t | t |
| scaling s(t) | 1/√(exp(½β_d t² + β_min t)) | 1 | 1 | 1 |
| c_skip(σ) | 1 | 1 | 1 | σ_d² / (σ² + σ_d²) |
| c_out(σ) | −σ | σ | −σ | σ σ_d / √(σ² + σ_d²) |
| c_in(σ) | 1/√(σ² + 1) | 1 | 1/√(σ² + 1) | 1/√(σ² + σ_d²) |
| c_noise(σ) | 999 · σ⁻¹(σ) | ln(½σ) | index of nearest level | ¼ ln σ |
| training σ | t ~ U(10⁻⁵, 1) | ln σ ~ U(ln 0.02, ln 100) | one of 1000 levels | ln σ ~ N(−1.2, 1.2²) |
| weight λ(σ) | 1/σ² | 1/σ² | 1/σ² | (σ² + σ_d²) / (σ σ_d)² |
The top four rows of Table 1 specify sampling, while the bottom six specify training: four fixed scaling functions (, , , and ) wrapping the raw network (derived in the preconditioning section below), the training noise distribution, and the per-noise-level loss weight . VP uses constants and , which put its noise level at at 152.17 and its signal scale at 0.0066 (keeping the scaled noisy state at unit variance). VE spans from 0.02 to 100; EDM spans 0.002 to 80 with . Because the sampler only ever calls as a black box, the top four sampling rows can be swapped independently of how the network in the bottom six rows was trained.
Why time equals the noise level
In exact continuous math, every valid choice of and in (4) generates the same final image distribution. In practice, a computer solves (4) in a small finite number of steps, replacing each smooth curve with straight line segments. Every straight segment incurs truncation error proportional to how sharply the true trajectory bends over that interval. If a coordinate system bends the trajectories into curved arcs, a solver needs hundreds of tiny steps to follow them; if a coordinate system makes the trajectories nearly straight lines, a handful of long steps lands in the same place. Which pair straightens the trajectories most?
Check what happens under and . Taking a single straight-line Euler step from any point all the way to subtracts times the velocity , so cancels and the landing point is identically . At every moment along the path, the trajectory's tangent line aims straight at the denoiser's current estimate of the denoised image. Recall the three regimes from Section 1: at high noise, stays parked near the dataset mean as drops; at low noise, stays locked onto a single data point. Because the target the tangent aims at barely shifts in either regime, the solution paths are nearly straight lines at both high and low noise, curving only in a narrow middle band where the denoiser transitions from "average image" to "this specific image".
Now compare the two older alternatives. VE uses (the mathematically convenient heat-diffusion clock where variance grows linearly with ). Plotting the same unscaled paths against stretches high noise and compresses low noise into parabolic arcs; because , the starting slope is half the average slope to zero, so a single Euler step to lands only halfway to . VP adds the shrinking scale factor on top, squeezing the high-noise fan toward the origin and curving every trajectory even harder.
Figure 1 plots exact solutions of (4) for the three-point 1-D dataset in the coordinate plane of each schedule. Switch between the three schedule tabs and hover across a curve to compare the dashed tangent landing at with the hollow amber ring marking : they coincide everywhere only for .
Switching the coordinate schedule alone yields huge speedups on pre-trained networks: keeping the VP CIFAR-10 checkpoint untouched and changing only the sampler's schedule to with cuts NFE from 255 down to 35 at nearly identical FID (2.88 to 2.93), and on pre-trained VE it cuts NFE from 191 to 27 while lowering FID from 4.23 to 3.73 (Figure 4 below), whereas DDIM already used and so its curve stays unchanged.
How to space the sampling steps
Even on nearly straight paths, a solver must pick discrete noise levels at which to query the network. Uniform steps in fail badly: Appendix D.1 measures the local error of uniform steps of width 1.25 on the VE CIFAR-10 model and finds a root-mean-square error (RMSE, the square root of the average squared pixel error; lower is better) of about 0.56 per pixel whenever , huge on a pixel range, against negligible error at high noise. Fine textures and edges crystallize at low , and dividing by in the ODE amplifies errors there, so step widths must shrink monotonically as noise drops.
EDM parameterizes that shrinking step schedule with a single exponent by interpolating linearly between and , raising the result back to the -th power, and appending a final zero level:
The endpoints are fixed at and . Setting recovers evenly spaced steps in ; raising packs more levels into the low-noise end, approaching VE's constant-ratio geometric spacing as . Plugging in EDM's CIFAR-10 default and gives the exact sequence 80, 57.6, 40.8, 28.4, 19.4, 12.9, 8.40, 5.32, 3.26, 1.92, 1.09, 0.585, 0.296, 0.140, 0.060, 0.023, 0.0075, 0.002, then 0. Seven of those 18 nonzero ticks sit below . The first step divides noise by 1.39 and the last nonzero step divides by 3.76 (rounded to 3.8), whereas a geometric spacing would divide by a constant 1.87 every time; therefore invests more steps at high noise than geometric spacing and far more at low noise than uniform spacing.
In Figure 2, drag from 1 to 20 and from 2 to 64 to watch how ticks crowd the low-noise end on the linear axis while spreading evenly across decades on the log axis.
Appendix D.1 finds that nearly equalizes per-step Heun truncation error across the noise levels, holding RMSE between 0.0030 and 0.0045 at every step. Yet measured FID keeps improving as rises into the range 5 to 10, because small numerical errors near visibly degrade fine image detail whereas errors near occur where the starting radius 80 is already somewhat arbitrary. Karras et al. fix for every experiment that follows. When sampling a model trained on a discrete set of noise levels (such as Dhariwal and Nichol's 1,000-step ADM, or Ablated Diffusion Model, ImageNet-64 checkpoint), each continuous from (5) is rounded to the nearest noise level the network saw during training.
How Heun's method cuts sampling calls
With the schedule and step spacing fixed, the remaining deterministic decision is the ODE integrator. Euler's method evaluates the slope once at the start of a step and walks straight along it for the full width , leaving a local truncation error of order . On the curved middle band where the denoiser pivots from the dataset mean toward a specific image, the slope at the start of the step lags behind the slope at the end.
Heun's second-order method (also known as improved Euler or the explicit trapezoidal rule) corrects that lag in two passes. First, take a trial Euler step from to . Second, evaluate the denoiser again at the trial landing point to measure the slope there, then re-take the step from the original starting point using the average of the two slopes. That cuts local error from to at the cost of one extra network evaluation per step. On the final step from down to , evaluating the slope at would divide by zero, so Algorithm 1 skips the second evaluation on the last step and reverts to plain Euler. Because steps cost two calls and the last step costs one, Heun steps cost network evaluations: 18 steps cost 35 NFE, 40 steps cost 79 NFE, and every Heun NFE in the paper is odd. With and , Algorithm 1 reduces to ten lines of code:
# Algorithm 1 with sigma(t)=t, s(t)=1 (generate.py:25-60, S_churn=0)
t = edm_levels(N=18, rho=7, smin=0.002, smax=80) # Eq. (5), shape [19], t[18]=0
x = randn(B, 3, 32, 32) * t[0] # [B, 3, 32, 32], std = 80
for i in range(18): # 2*18 - 1 = 35 calls of D
d = (x - D(x, t[i])) / t[i] # [B, 3, 32, 32], Eq. (1)+(3)
xe = x + (t[i + 1] - t[i]) * d # [B, 3, 32, 32], Euler trial
if t[i + 1] > 0: # skip 2nd call at t = 0
d2 = (xe - D(xe, t[i + 1])) / t[i + 1] # [B, 3, 32, 32], end slope
xe = x + (t[i + 1] - t[i]) * (d + d2) / 2 # Heun trapezoidal update
x = xeContinue the 1-D worked example from Section 1 to see the correction in numbers. Starting at and , the initial slope was 0.305, and the trial Euler step to landed at 0.139. Querying the denoiser at returns , producing an end slope of , nearly five times steeper than the start slope. Averaging 0.305 and 1.46 gives 0.883, so Heun updates to , tracking the bend toward −0.35 far more closely than Euler's 0.139.
Figure 3 compares Euler and Heun on a two-dimensional toy dataset of six clusters using the same 14 starting points and levels. Drag across its full range from 1 to 40, including the low-step failure modes. At , both solvers take a single Euler step to and collapse all 14 samples onto the center of the clusters (RMSE 2.128). At , one Heun trajectory shoots off the canvas: its trial Euler step lands near the center at , where the denoiser already pulls strongly toward one cluster, and averaging that steep end slope across a wide step of width 7.6 overshoots past the cluster. At equal network calls ( Heun steps against Euler steps), Heun catches Euler at and then pulls far ahead: at (23 NFE), Heun's endpoint RMSE is 0.046 versus 0.26 for 24-step Euler; at (35 NFE), it drops to 0.017 versus 0.24.
Figure 4 plots the paper's real-model measurements (Table 3 and Fig. 2) on three pre-trained checkpoints: Song et al.'s VP and VE CIFAR-10 models and Dhariwal and Nichol's ADM ImageNet-64 checkpoint. Re-implementing each original deterministic sampler (grey) inside Algorithm 1 (violet) already lowers FID by a small margin (VP 2.85 at 256 NFE to 2.79 at 512; VE 5.45 to 4.78 at 8,192; ImageNet-64 2.85 at 250 to 2.73 at 384) by fixing small oversights in the original codebases and handling DDIM's discrete levels directly. Turning on Heun and (amber) cuts NFE across all three models: VP reaches 2.88 at 255 NFE, VE reaches 4.23 at 191, and ImageNet-64 reaches 2.64 at 79. Switching to and (teal) brings VP to 2.93 at 35 NFE and VE to 3.73 at 27 NFE, generating 26.3 CIFAR-10 images per second on one NVIDIA V100 GPU. At the leftmost columns, under the same VP schedule, Euler still beats Heun at 7 to 8 NFE (156.3 vs 286.8) and 15 to 16 NFE (43.6 vs 70.6) because two calls per step leave Heun too few steps; Heun pulls ahead from roughly 19 to 20 NFE upward. Running a black-box adaptive RK45 solver (Dormand-Prince 4th/5th-order Runge-Kutta, blue) on the same schedule requires 115, 93, and 131 NFE for comparable FID, so adaptive step-size control costs more evaluations than the fixed discretization.
Appendix D.2 checks whether other two-stage second-order Runge-Kutta methods beat Heun by evaluating the second slope at a fraction across the step: midpoint (), Ralston (), and Heun (). Measured FID bottomed out at , which evaluates past without theoretical backing, so the authors kept . Heun also lands its second call exactly on the grid level , a level a discretely trained model like ImageNet-64 ADM has already seen, whereas midpoint and Ralston query unvisited levels in between.
Why adding noise back can help
Deterministic ODE sampling lets you invert a real image back into its exact starting noise, yet both Score SDE and DDIM observed lower (better) FID when fresh random noise was injected during sampling. If the probability-flow ODE and the reverse-time SDE share the exact same marginal distributions in theory, why would adding randomness back improve image quality?
To answer that, Karras et al. decompose any marginal-preserving SDE into two pieces: the probability-flow ODE (1), which changes the noise level, plus a Langevin diffusion term, which keeps the noise level fixed while swapping old noise for fresh noise. Picture a particle sitting at fixed noise level : jiggling it with random Gaussian kicks while simultaneously pulling it uphill along the score leaves the overall noise variance unchanged, yet any particle that drifted off the true blurred density relaxes back onto it. Combining the two gives the paper's generalized SDE:
In (6), is a standard Wiener process (continuous Gaussian white noise), with the plus sign moving forward in time and the minus sign moving backward for generation (Anderson's 1982 time-reversal theorem flips only the sign of the deterministic noise-decay term). By identity (3), the decay term equals , stripping away a fraction of the current noise at rate , while the Wiener term injects the exact matching variance of fresh noise. Any non-negative rate preserves the marginals. Song et al.'s VP and VE SDEs correspond to one specific choice, , which makes the score term cancel out of the forward SDE; nothing makes that rate optimal for finite-step sampling.
With an exact denoiser and infinitesimal steps, a sample stays strictly on and churn buys nothing; with finite steps and an imperfect neural denoiser, earlier steps accumulate small distributional errors, and the Langevin swap in (6) removes those errors. Too much churn, however, adds its own discretization error and magnifies imperfections in .
Algorithm 2 implements stochastic sampling without falling back to a textbook Euler-Maruyama SDE solver. At step and noise level , it splits the update into two marginal-preserving sub-steps: first, temporarily step backward to a higher noise level by adding fresh Gaussian noise of standard deviation ; second, take one Heun ODE step from down to . Unlike Euler-Maruyama, which evaluates the denoiser at the pre-noise state and then adds noise, Algorithm 2 evaluates at the post-noise state . In the limit of tiny steps the two match; at large steps they differ significantly.
Four heuristic constants govern how much noise is injected and where:
Each constant guards against a specific failure mode. Dividing by keeps the total churn budget roughly stable across step counts, while clamping at forces , guaranteeing that the injected standard deviation never exceeds (never adding more new noise than already exists). Restricting churn to turns noise injection off at very low and very high noise levels, where Appendix E.1 observes colors drifting toward oversaturation. Setting just above 1 (1.003 to 1.007) partially prevents fine detail from washing out under heavy churn. The authors state a hypothesis for both artifacts: a learned -trained denoiser regresses toward the mean, stripping a little too much noise and inducing a non-conservative vector field (one that is not the exact gradient of any scalar log-density). Iterating add-noise-then-denoise 2,000 to 10,000 times degrades learned networks severely while an analytic denoiser on the same data preserves detail; the exact root cause is left open.
In concrete numbers from Appendix E.2 (Table 5), the pre-trained CIFAR-10 VP checkpoint tuned to , , and ; at steps (383 NFE), that gives , , and fresh noise of standard deviation on every active step. Pre-trained ImageNet-64 tuned to , , and , giving and fresh noise of at steps (511 NFE). Figure 5 runs Algorithm 2 on the six-cluster toy so you can see the sawtooth noise climbs and the corresponding 2-D jogs directly.
Figures 6 and 7 plot the paper's Table 4, Fig. 4, and Fig. 15 benchmarks. Tuning all four constants per model drops pre-trained CIFAR-10 VP from FID 2.93 (at 35 deterministic NFE) to 2.27 (at 383 stochastic NFE, beating VP's original SDE sampler at 2.55 / 768 NFE), pre-trained VE from 3.73 (27 NFE) to 2.23 (767 NFE, vs original 2.46 / 1,024 NFE), and pre-trained ADM ImageNet-64 from 2.64 (79 NFE; ADM's own published score was 2.07) all the way down to 1.55 at 511 NFE. With zero retraining, swapping the sampler matched classifier-free guidance (1.55) and closed in on StyleGAN-XL (1.52) and cascaded diffusion (1.48). Figure 7 shows the U-shaped tradeoff behind those numbers: FID falls as climbs from 0 until discretization and denoiser drift bend the curve back up, and turning on and shifts the entire valley lower.
Karras et al. flag a methodological risk here. Because , , , and had to be grid-searched separately for each checkpoint, those four numbers compensate for quirks of that specific trained network. Evaluating new architectures or training losses under a stochastic sampler risks measuring how well churn heuristics patch each model's errors rather than measuring the underlying denoiser itself, which is why EDM evaluates all training ablations below with the deterministic sampler.
How EDM preconditions the network
Turning from sampling to training, consider what happens if you train a raw neural network to output directly. Standard deep networks train most reliably when their inputs, activations, and regression targets all have standard deviation close to 1. Yet a noisy image has per-pixel standard deviation 0.5 at tiny noise and 80 at , a 160× swing in input scale, while the target image stays at 0.5 throughout.
Earlier methods handled this only partway. VP and DDPM divided the input by (for VP that factor equals ; VE did not scale inputs at all) and trained a raw network to predict unit-variance noise , reconstructing the denoised image as . Why does pure noise prediction break down at large ? At , reconstructing multiplies every tiny error in by 80: to recover a 0.5-amplitude image hidden inside 80-amplitude static, the network must cancel the noise to better than one part in 160. At high noise, predicting the signal directly is far easier; at low noise, where is already almost the original image, predicting the small noise residual is far easier.
EDM lets a fixed -dependent skip connection shift the network smoothly between those two regimes. Instead of representing directly, the denoiser wraps a raw network with four fixed scalar functions (containing zero learnable parameters, so gradients reach only):
In (7), normalizes the noisy input entering , turns into a well-scaled scalar conditioning input, passes a fraction of straight around the network, and scales the network's output before adding it back. Substituting (7) into the weighted denoising objective (2) over noise levels drawn from and pulling outside the squared norm exposes the exact weight and target that is trained against:
Three first-principles constraints in Appendix B.6 determine , , and with no free tuning parameters, using the design constant for images. First, forcing unit-variance inputs requires dividing by the standard deviation of , whose variance is . Second, forcing unit-variance targets requires setting equal to the variance of the target numerator , which sums the squared weights times and . Third, any error in gets multiplied by inside (7), so choosing to minimize that quadratic (setting its derivative to zero) keeps error amplification as small as possible. Together with an empirically chosen log-conditioning map for (which maps smoothly into ), those constraints yield:
Evaluating the effective target of (8) across noise levels shows how the regression target shifts from noise at low to signal at high . At , and , making the target : 100% of its variance is noise, so acts as a pure noise predictor whose output is divided by 100 before touching . At (the median training noise level), , , and , making the target , a mix of 27% signal variance and 73% noise variance. At , and the target splits 50/50 between signal and noise. At , and , turning the target into (99.8% signal variance), so the skip shuts off and predicts the unit-variance signal.
Hover across Figure 8 to inspect all four functions, the loss weight , and the exact signal-versus-noise variance split at any , and drag to move the 50/50 crossover.
On CIFAR-10, switching to EDM preconditioning alone (config D in Table 2 below) shifts FID by −0.02 to +0.27, almost flat. On 64×64 VE models, however, preconditioning rescues unstable training: FID on FFHQ-64 (70,000 64×64 human face portraits) drops from 41.62 to 3.39, and FID on AFHQv2-64 (roughly 15,000 64×64 animal face photos) drops from 15.04 to 3.81. Keeping inputs, targets, and error amplification bounded across five orders of magnitude of makes training stable enough to redesign the loss without divergence.
Which noise levels to train on
Look back at the effective per-sample weight in (8). To give every noise level equal footing at the start of training, EDM sets to cancel exactly:
With that weight, every sample has effective weight 1. Because the final layer of is initialized to zero (), the wrapped denoiser starts at , and Appendix B.6 shows that the expected loss at initialization is identically 1.0 across every (confirmed by the flat grey curve in Figure 9). Under the older weighting , initial loss varies by orders of magnitude across noise levels, so gradients from extreme noise levels overwhelm the rest of the batch.
Balancing the initial loss exposes a clear measurement of where learning happens. Figure 9 plots the per-level loss after training (paper Fig. 5a). At very low noise on CIFAR-10, trained loss stays high: 0.94 at and 0.52 at , because separating sub-pixel static from real image texture is both difficult and visually irrelevant. At very high noise, trained loss stays high too: 0.67 at , 0.92 at , and 0.99 at , because the optimal denoiser hovers near the dataset mean while each training target is a single image far from that mean. Only in the middle band can gradient updates drive the loss down: CIFAR-10 loss falls below 0.35 across and bottoms out at 0.098 near (FFHQ-64 bottoms out at 0.070 near ).
Rather than spreading training compute uniformly across log-decades like VE, EDM concentrates samples right over that valley using a log-normal distribution: with and . That places the median noise level at , puts 66% of draws inside , 6.7% below 0.05, and 16% above 1, while sampling outside roughly once in 60,000 draws. Drag and in Figure 9 to align the amber sampling bell with the measured loss valleys.
One training step draws a noise level per image from the log-normal, corrupts each image at its own , runs the wrapped network (7), applies the balancing weight , and backpropagates into only:
# One EDM training step (training/loss.py:66-80); CIFAR-10, batch of 4
y = batch # [4, 3, 32, 32], images in [-1, 1]
ln_s = -1.2 + 1.2 * randn(4) # [4], ln(sigma) ~ N(P_mean, P_std^2)
sigma = exp(ln_s).view(4, 1, 1, 1) # [4, 1, 1, 1], e.g. [0.30,0.05,1.9,0.11]
n = sigma * randn_like(y) # [4, 3, 32, 32], per-image noise
D = precond(F, y + n, sigma) # [4, 3, 32, 32], Eq. (7) wrapper
lam = (sigma**2 + 0.25) / (0.5 * sigma)**2 # [4, 1, 1, 1], lambda = 1 / c_out^2
loss = (lam * (D - y)**2).mean() # Eq. (2)/(8); grad flows to F onlyCheck the concrete numbers for the four-image batch in the listing. The four sampled noise levels 0.30, 0.05, 1.9, and 0.11 receive loss weights of 15.1, 404, 4.3, and 86.6, and the effective regression targets passed to span from 99% noise variance (at ) to 94% signal variance (at ). Adding this loss and sampling distribution on top of preconditioning (config E in Table 2) delivers the largest single FID drop among EDM's three training contributions on CIFAR-10: unconditional VP drops from 2.29 to 2.05 and VE from 3.10 to 1.99. Concurrent work by Choi et al. (P2 weighting) changed alone and observed a smaller gain; Karras et al. attribute EDM's larger jump to reshaping and together on top of preconditioning.
Small datasets such as CIFAR-10, FFHQ-64, and AFHQv2-64 still let a 56-million-parameter denoiser memorize training images and overfit. EDM borrows six geometric augmentations (flips, rotations, scalings, and translations) from StyleGAN2-ADA (adaptive discriminator augmentation, built for GANs, Generative Adversarial Networks), applying them to each training image before adding noise (dataset x-flips are turned off, augmentation x-flips run at 100%, and the other geometric transforms fire with probability 12% on CIFAR-10 and 15% on FFHQ-64 and AFHQv2-64). Why do rotated or cropped images not leak into generated samples? EDM encodes the exact augmentation parameters applied to each image as a nine-dimensional conditioning vector fed into during training, then sets that vector to all zeros at sampling time so the network produces strictly un-augmented images on request. Table 2 traces the full ablation sequence from Song et al.'s baseline (config A) to non-leaking augmentation (config F), evaluated with EDM's deterministic sampler at 35 NFE on CIFAR-10 and 79 NFE at 64×64:
| FID, Table 2 | CIFAR-10 cond. VP | VE | CIFAR-10 uncond. VP | VE | FFHQ-64 VP | VE | AFHQv2-64 VP | VE |
|---|---|---|---|---|---|---|---|---|
| A baseline (Song et al.) | 2.48 | 3.11 | 3.01 | 3.77 | 3.39 | 25.95 | 2.58 | 18.52 |
| B + adjusted hyperparameters | 2.18 | 2.48 | 2.51 | 2.94 | 3.13 | 22.53 | 2.43 | 23.12 |
| C + redistributed capacity | 2.08 | 2.52 | 2.31 | 2.83 | 2.78 | 41.62 | 2.54 | 15.04 |
| D + EDM preconditioning | 2.09 | 2.64 | 2.29 | 3.10 | 2.94 | 3.39 | 2.79 | 3.81 |
| E + EDM loss (λ, p_train) | 1.88 | 1.86 | 2.05 | 1.99 | 2.60 | 2.81 | 2.29 | 2.28 |
| F + non-leaky augmentation | 1.79 | 1.79 | 1.97 | 1.98 | 2.39 | 2.53 | 1.96 | 2.16 |
Configs B and C establish a modern baseline before EDM's own changes enter. Config B moves from 4 to 8 GPUs, raises batch size from 128 to 512 at 32×32 (256 at 64×64), lifts the CIFAR-10 learning rate from 0.0002 to 0.001 (kept at 0.0002 at 64×64) with a 10-million-image linear ramp-up, disables gradient clipping, standardizes the EMA (exponential moving average, a slowly smoothed copy of the network weights used at sampling time) half-life to 0.5 million images, and grid-searches dropout per dataset (13% on CIFAR-10, 5% on FFHQ-64, 25% on AFHQv2-64). Each run sees 200 million images (about 400,000 steps at batch 512) in roughly two days at 32×32 and four days at 64×64. Config C removes the 4×4 resolution blocks (which mostly overfit) and doubles the 32×32 resolution blocks from 128 to 256 channels while leaving 16×16 and 8×8 at 256 channels (Table 7; Appendix F.3 slips once and writes 16×16 before listing the actual channel counts in the next sentence), leaving about 56 million parameters at 32×32 and 62 million at 64×64. By config F, the VP and VE columns differ only in their U-Net backbone architecture (DDPM++ versus NCSN++), and their CIFAR-10 FIDs converge within 0.01 (1.79 vs 1.79 conditional; 1.97 vs 1.98 unconditional).
What the full EDM recipe achieves
Combined, the sampling and training recipes reach FID 1.79 on class-conditional CIFAR-10 and 1.97 unconditional at 35 deterministic network evaluations, beating the prior records of 1.85 (StyleGAN-XL) and 2.10 (Vahdat et al.). To test scaling to a large, diverse dataset, the authors took Dhariwal and Nichol's unchanged 296-million-parameter ADM architecture and retrained it on class-conditional ImageNet-64 using config E (without augmentation regularization) for two weeks (~2.5 billion images, ~600,000 iterations) on 32 NVIDIA Ampere GPUs at batch size 4,096 with mixed precision (FP16/FP32), learning rate 0.0001, and an EMA half-life of 50 million images. That single model reached record FID 1.36 against the previous best of 1.48, without classifier-free guidance or a cascaded upsampler.
Putting the two halves of the paper together uncovered an unexpected reversal in stochastic sampling. On the older pre-trained checkpoints, stochastic churn lowered FID by 0.7 to 1.5 points. After EDM retraining on CIFAR-10, that curve flips completely: deterministic sampling () achieves the lowest FID (1.97 on VP, 1.92 on VE at 511 NFE, 1.79 conditional), and adding any amount of churn makes image quality strictly worse. On the much more diverse 1,000-class ImageNet-64 dataset, stochasticity still helps even after EDM retraining, pulling FID from 2.22 deterministic down to the record 1.36, yet the optimal halves from roughly 75–80 down to 40 and the relative benefit shrinks. Figure 10 plots the paper's Fig. 5b and 5c sweeps so you can inspect that flip directly across all four models.
The authors interpret this interaction in terms of denoiser error: churn exists to correct mistakes made by an imperfect denoiser, so a better-trained network on a relatively compact dataset leaves too little error for churn to offset its own discretization error, whereas a 1,000-class dataset keeps a 296M-parameter denoiser imperfect enough that modest churn still helps. The exact interplay between training objectives and stochastic sampling remains an open question.
Karras et al. list four concrete limits of the study. First, the four stochastic constants remain per-model grid-search heuristics, and the cause of excessive-churn color and detail degradation is still an unproved hypothesis (non-conservative learned vector fields). Second, whether adaptive ODE or SDE solvers can eventually beat a tuned fixed schedule remains open. Third, every parameter in Table 1 was tuned at 32×32 and 64×64 pixels and may need re-tuning at higher resolutions, where production pipelines rely on super-resolution cascades, latent spaces, or larger backbones. Fourth, running the project consumed roughly 250 MWh of electricity on an in-house cluster of NVIDIA V100 GPUs. Even with those limits, EDM's Table 1 recipe became the default parameterization for subsequent diffusion research, from Consistency Models and rCM distillation to DiffusionBlocks, all of which adopt , the step schedule, the four preconditioning functions around , and log-normal training noise levels.
Questions you might still have
Why does the ODE step use (x - D)/t instead of the score?
They are the same quantity rewritten. Eq. (3) sets the score equal to (D - x) / sigma^2, and Eq. (1) multiplies the score by -sigma_dot * sigma. With sigma(t) = t that product is -t, which cancels one power of t and leaves velocity (x - D) / t. Expressing the sampler through D lets one loop drive any trained network as a denoiser, regardless of whether the network originally predicted noise, score, or pixels.
If the ODE and SDE share the same marginal distributions, why does stochastic sampling ever beat deterministic sampling?
They share the same marginals only when the denoiser D is exact and steps are infinitesimal. With finite steps and an imperfect learned network, each step leaves the sample slightly off the true marginal at that noise level. The Langevin noise swap in Eq. (6) relaxes samples back toward the correct marginal, undoing accumulated drift. It also adds its own discretization error and interacts badly with non-conservative learned denoisers, so the optimal amount of noise injection has to be tuned per model.
Can the EDM sampler run on a DDPM or iDDPM model trained earlier?
Yes. Section 3 of the paper tests this directly on three pre-trained checkpoints, including the 1,000-step ADM model by Dhariwal and Nichol (which uses the Improved DDPM formulation). Table 1 supplies the adapter: c_noise converts sigma into the timestep index the checkpoint expects, c_in and c_out match its input and output scaling, and each continuous level t_i is rounded to the nearest discrete noise level the model trained on. The DDPM and Improved DDPM explainers on this site cover the discrete-time training side.
Is sigma_data = 0.5 measured separately for each dataset?
No, it is a fixed design constant. Images are scaled to [-1, 1], where 0.5 is a rough per-pixel standard deviation, and the code exposes sigma_data with that default. Appendix B.6 only requires an approximate value to place the c_skip = 1/2 crossover in the middle of the useful noise range and keep targets near unit variance.
Why draw training noise levels from a log-normal instead of uniform in log sigma?
Uniform sampling in log sigma over [0.02, 100] (the VE default in Table 1) spends equal compute on every decade, including tiny sigma where the network cannot separate imperceptible noise and huge sigma where the optimal prediction is nearly the dataset mean. A log-normal with P_mean = -1.2 and P_std = 1.2 puts its median at 0.30 and 66% of draws inside [0.1, 1], right over the valley where the trained loss curves in Figure 9 actually drop.
Does Heun always beat Euler at the same number of network evaluations?
Not at the very smallest budgets. On the pre-trained VP model under the same schedule, Euler reaches FID 156.3 at 8 NFE while Heun gets 286.8 at 7 NFE, and Euler gets 43.6 at 16 NFE against Heun 70.6 at 15 NFE, because spending two calls per step leaves Heun only four to seven steps. From roughly 19 to 20 NFE upward Heun pulls ahead on both VP and ImageNet-64, and paired with sigma(t) = t it comes within 0.15 FID at 35 NFE of what Euler reaches at 512.
How fast is 35 NFE in wall-clock time?
The paper measures 26.3 CIFAR-10 images per second on a single NVIDIA V100 GPU with the 35-NFE deterministic sampler. The 79-NFE budget used at 64x64 resolution requires roughly 2.3 times as many forward passes per image before accounting for the larger network and higher pixel count.
What goes wrong if S_churn is turned up too high?
Fine texture washes out and colors drift toward oversaturation. Appendix E.1 demonstrates this on CIFAR-10 and ImageNet by repeating add-noise-then-denoise thousands of times at a fixed noise level. The authors hypothesize that a learned L2 denoiser removes slightly too much noise (regression toward the mean) and induces a slightly non-conservative field; inflating injected noise slightly with S_noise above 1 counteracts part of that loss, while an analytic denoiser on the same data shows no degradation.
Footnotes & further reading
- The paper: Karras, Aittala, Aila, Laine, Elucidating the Design Space of Diffusion-Based Generative Models (NVIDIA, NeurIPS 2022). Official code and pre-trained models: the sampler is
edm_sampleringenerate.py, the wrapper isEDMPrecondintraining/networks.py, and the loss isEDMLossintraining/loss.py. - VP and VE formulations, reverse-time SDE, and probability-flow ODE: Song, Sohl-Dickstein, Kingma, Kumar, Ermon, Poole, Score-Based Generative Modeling through Stochastic Differential Equations (arXiv:2011.13456, ICLR 2021).
- Discrete-time diffusion family: Ho, Jain, Abbeel, Denoising Diffusion Probabilistic Models (arXiv:2006.11239); Nichol and Dhariwal, Improved Denoising Diffusion Probabilistic Models (arXiv:2102.09672); Song, Meng, Ermon, Denoising Diffusion Implicit Models (arXiv:2010.02502).
- Score matching and denoising score matching: Hyvärinen, Estimation of Non-Normalized Statistical Models by Score Matching (JMLR 2005); Vincent, A Connection Between Score Matching and Denoising Autoencoders (2011).
- Earlier Heun and adaptive SDE diffusion sampling: Jolicoeur-Martineau, Li, Piché-Taillefer, Kachman, Mitliagkas, Gotta Go Fast When Generating Data with Score-Based Models (2021). Numerical ODE solver background: Süli and Mayers, An Introduction to Numerical Analysis (2003).
- The ImageNet-64 ADM checkpoint and architecture: Dhariwal and Nichol, Diffusion Models Beat GANs on Image Synthesis (arXiv:2105.05233). Non-leaking augmentation pipeline: Karras, Aittala, Hellsten, Laine, Lehtinen, Aila, Training Generative Adversarial Networks with Limited Data (2020).
- Concurrent perception-prioritized loss weighting: Choi, Lee, Shin, Kim, Kim, Yoon, Perception Prioritized Training of Diffusion Models (CVPR 2022). Downstream systems built on EDM's design space include Consistency Models, rCM distillation, and DiffusionBlocks.
How could this explainer be improved? Found an error, or something unclear? I read every message.