Diffusion Models from the Ground Up: One Chain of Failures and Fixes
Diffusion models are not one algorithm. They are a family of objectives plus a family of samplers, and nearly every piece of that stack was bought by naming one specific failure in the piece before it. Read that way, the noising chain, the regression loss, the fast sampler, the velocity field and the guidance formula stop looking like unrelated techniques. They are one idea, destroy structure in many small steps and learn to rebuild it a step at a time, plus a chain of repairs that is still running.
Three relations keep coming back in that chain. The state at any noise level can be drawn in closed form. Training is a regression on the noise that produced that state. And at sampling time the conditioned prediction is extrapolated away from the unconditioned one.
Each generative family fixed the previous complaint and handed on a new one
Every stage of the diffusion stack exists because the stage before it failed in one nameable way, which makes the subject a repair history rather than a catalogue, and the history has an open end.
All four generative families answer the same question, how to sample from a distribution you only know through examples, and they differ in what they optimise.

Caption: Four structures side by side: a second network scoring samples, an encoder and decoder, an invertible map, and a chain of noisy states with a reverse arrow underneath. With no axes and no numbers, the figure carries only the shape of each family. Row labels are the lecture's; the artwork is Lil'Log's.Lil'Log
The adversarial row removes the reconstruction target entirely: a generator maps noise to a sample, a discriminator scores how real it looks, and the generator is never shown a training image directly, only gradients flowing back through the discriminator. The VAE row keeps a pixel-wise reconstruction term plus a KL penalty on the latent. Flow-based models pay for an exact likelihood with an invertible architecture. The diffusion row destroys the data with a chain of small Gaussian steps and learns to walk the chain backwards.
Each family states its own complaint. The lecture's diagnosis of the VAE is blunt: its samples are blurry, and the reason is structural, since a pixel-wise target under a Gaussian latent rewards hedging on the fine detail a decoder cannot commit to. The adversarial family fixes that and pays for it elsewhere. The 2014 paper says its generator benefits from "not being updated directly with data examples, but only with gradients flowing through the discriminator", and it names the price in its own limitations: the discriminator "must be synchronized well with G during training", or G collapses many noise values onto one output, the case its authors call the Helvetica scenario.GAN 2014
That collapse is a structural property of a two-player objective with a synchronisation requirement, not a 2014 measurement. The paper reports no non-convergence count and no mode-collapse statistic, and its theory is explicitly non-parametric, requiring the discriminator to reach its optimum at every step. The game that will not settle is what you get when the training signal is another network's current opinion instead of a fixed target.

Caption: The inner loop drawn as densities: a data curve, a generative curve and a discriminator curve on one axis. Training moves the generative curve onto the data curve and flattens the discriminator towards one half, where it can no longer tell them apart. Neither side simply wins.GAN 2014
The diffusion family inherits the blur problem solved and takes on a cost problem instead. Its 2015 statement is qualitative: the computational cost is the cost of the network evaluations times the number of time steps, so a chain with thousands of steps is thousands of network calls per sample. That sentence becomes a measured complaint five years later.
The endpoint is November 2026 and it is not a closed link. One preprint from that month puts a hierarchical diffusion transformer under the same loss; another measures what models trained this way actually generalise to, and the answer is discouraging outside the training range. Both are days old and neither ends the story.

Caption: The lecture's own map: a forward path and a noise schedule feed a denoiser and a diffusion loss, and sampling branches into classifier guidance and classifier-free guidance. At 204 by 121 pixels with its bottom row cut off, this is a thumbnail for orientation, not a figure with readable detail.
Breaking one hard mapping into many small ones is what makes the reverse step learnable
The trick is not a cleverer network. It is a reformulation: one impossible jump from noise to data becomes T easy jumps, and because reversing a small Gaussian step is still Gaussian, each easy jump can be fitted by regression.
The 2015 paper states the construction in its abstract: the method will "systematically and slowly destroy structure in a data distribution through an iterative forward diffusion process", then "learn a reverse diffusion process that restores structure in data".Sohl-Dickstein 2015
Concretely, the forward direction is a Markov chain of small steps,
$$x_t = \sqrt{1-\beta_t},x_{t-1} + \sigma_t,\epsilon, \qquad \epsilon \sim \mathcal{N}(0, I)$$
so each step keeps most of the previous state and adds a little noise, and the reverse direction is a learned transition $p_\theta(x_{t-1}\mid x_t)$ that has to undo one step at a time.

Caption: One two-dimensional toy distribution at three moments. The top row shreds structure, the middle row learns to restore it, and the bottom row shows the learned drift doing the restoring, its arrows pointing back towards the spiral arms. The middle row is a trained model, not the forward kernel run backwards.Sohl-Dickstein 2015
The reverse step is learnable because reversing a small-step continuous diffusion has the same functional form as the forward process, a result the paper takes from Feller's work on the Kolmogorov equations. Small forward steps make the reverse step Gaussian too, so the problem reduces to predicting a mean and a covariance, and in the paper's words "the task of estimating a probability distribution has been reduced to the task of performing regression". That sentence is the hinge of the whole field: once the reverse step is a Gaussian with unknown parameters, a network can be trained on it with squared error.

Caption: The chain as one object with two directions. The solid arrow is the learned denoising step the sampler runs, the dashed arc is the known noising kernel, and the red note marks the conditional nobody can write down, which is why a network exists. The dotted box shows the segment the next chapter's derivation is about; the figure carries no noise schedule.Lil'Log
One chain, two directions, one unknown. The reverse direction is the model, and the forward direction is a known noising kernel; in this 2015 formulation the Gaussian $\beta_t$ are themselves learned by gradient ascent on the bound.
Training collapses to one noise draw per step, and the sampler it feeds falls out of the bound
The objective everyone actually trains is a one-line regression on a state you can jump to directly, and the sampling update it drives is a derived quantity rather than a guess.
Two obvious losses fail. Fitting the next state backwards, $L = |\epsilon_\theta(x_t,t) - x_{t-1}|^2$, only teaches local information about one link of the chain. Unrolling the chain, with T forward and T backward steps per update, is correct and unaffordable, since the cost per update now scales with chain length.
The way out is a closed form. Because the forward chain is Gaussian and linear, the state at any step comes directly from the data image and one noise sample,
$$x_t = \sqrt{\bar\alpha_t},x_0 + \sqrt{1-\bar\alpha_t},\epsilon, \qquad \bar\alpha_t = \prod_{s=1}^{t}(1-\beta_s)$$
so no chain has to be replayed to reach noise level $t$. The DDPM paper states the consequence plainly: the forward process "admits sampling $x_t$ at an arbitrary timestep $t$ in closed form", which is what makes gradient descent on randomly chosen terms of the loss possible.DDPM
This is the first of the three relations. In software terms it is the difference between indexing an array and walking a list from the head: the closed form returns the state at any $t$ in one evaluation, so a training step can draw $t$ at random instead of replaying $t$ transitions. Once that is legal, the loss can be written against the noise,
$$L = \mathbb{E}{t,x_0,\epsilon}\left|\epsilon - \epsilon\theta!\left(\sqrt{\bar\alpha_t}x_0 + \sqrt{1-\bar\alpha_t}\epsilon,\ t\right)\right|^2$$
which is the second relation, the noise-prediction loss.
The weighting question is where most retellings drift. The paper does not train the true variational bound; it drops the per-step weights because the setup "causes the simplified objective to down-weight loss terms corresponding to small $t$", which train the network on very small amounts of noise. Down-weighting them lets it "focus on more difficult denoising tasks at larger $t$", and the paper reports better sample quality. Training the true bound gives better codelengths and worse samples, which it also says out loud. On unconditional CIFAR-10 at 32 by 32 the gap is FID 13.51 against 3.17, on 50,000 samples.

Caption: The two printed algorithms side by side, and everything worth seeing is the asymmetry: the training box touches one uniformly drawn timestep per update, while the sampling box walks every step from T down to 1, one network evaluation each.DDPM
One process, two algorithms, and they are not the same size. Training is cheap per step because of the closed form. Sampling is expensive because it really does walk the chain.
Where the sampling update comes from
This subsection can be skipped on a first pass. Nothing structural depends on it, but a reader who stays sees that the sampler was derived rather than assumed.
One of the split terms, $L_T$, is fixed by the schedule and drops out, since it contains nothing to learn. The remaining KL terms compare two Gaussians and can be evaluated exactly. The Bayes line is what makes it tractable: conditioned on the data image, the reverse transition is a product of two known Gaussians, and a product of two Gaussians in the same variable is a Gaussian. Reading its mean off the exponent gives exactly the update the sampler had been using all along. Lilian Weng's explainer walks the same steps in order, including the decomposition $L_\mathrm{VLB} = L_T + L_{T-1} + \dots + L_0$.Lil'Log

Caption: The graphical model, and a figure routinely read backwards. The solid left-to-right chain is the learned denoising direction, from noise towards data; the single dashed arc running back is the fixed noising kernel. It shows one generic step and its predecessor, not a schedule.DDPM
The fix for slow sampling was a different sampler, and the same steps recast as a velocity field
Once the sampler is separate from the weights, sampling speed stops being a training problem and becomes a geometry problem about trajectories. The flow branch is the same idea reparameterised, not a competing theory of generation.
Every sample needs one network evaluation per step, and the 2020 quality settings wanted a thousand steps. The DDIM paper puts numbers on it: "around 20 hours to sample 50k images of size 32 × 32 from a DDPM, but less than a minute to do so from a GAN on a Nvidia 2080 Ti GPU", with 256 by 256 estimated at nearly a thousand hours on the same card.DDIM

Caption: Cost against step count for the same trained model sampled at different lengths. Both axes are logarithmic and the curves rise roughly linearly in steps, which turns the twenty-hour figure into a shape. The chart plots hours, not quality, and compares no two models.DDIM
The repair is not a better network. DDIM observes that the training objective depends only on the marginals of the forward process, not on the joint, and that many inference processes share those marginals. It defines a family in which each reverse step is also conditioned on the data image, hence non-Markovian, and shows that every member's objective equals the DDPM objective up to a constant, so an already trained model is the optimum for the whole family and nothing is retrained.
One parameter, written $\eta$, controls how much fresh noise enters each step. At $\eta = 1$ the sampler is the original stochastic one; at $\eta = 0$ the trajectory becomes deterministic. That deterministic limit is the setting that holds up best at small step counts, and it enables two capabilities: interpolating in noise space, and running the deterministic map backwards to encode a real image to its latent and decode it back. On CIFAR-10 the reconstruction error falls from 0.014 at 10 steps to 0.0001 by 500.
The trained weights behave like a compiled artefact and the sampler like the runtime that drives it. The same artefact runs under a different runtime with a different execution schedule, and nothing in it is recompiled.
The same steps, written as a field
Flow matching learns a velocity field that transports a source distribution into the target, then integrates it. The loss regresses the velocity that carries a paired source point to its target,
$$L = \mathbb{E}\left|v_\theta(x_t,t) - (x_1 - x_0)\right|^2$$
and sampling is an ordinary differential equation, for instance $x_{t+h} = x_t + h,v_\theta(x_t,t)$ with Euler's method. Training pairs are random and their straight-line paths visibly cross, yet sampled trajectories do not. The resolution is averaging: the network learns a marginal field that averages over every pairing through a point, and one velocity per point means one trajectory.
The important word is containment. Gaussian probability paths form a family parameterised by a mean schedule and a variance schedule, and the standard variance-preserving and variance-exploding diffusion paths are specific members. The paper's own conclusion is that training a diffusion path with the flow-matching objective gives a "more robust and stable alternative for training diffusion models".Flow Matching

Caption: Two fields at four moments of one transport. In the top strip, from a diffusion path, the arrows turn as time advances; in the bottom strip, from an optimal-transport path, the direction is essentially constant, which is why those paths are straight. These are analytic conditional fields, not trained output.Flow Matching
Curvature is the remaining problem. A fixed-step solver must resolve the bends, so a curved path forces many small steps even when the sampler is deterministic. Rectified flow supplies the measurement and the repair. Straightness is defined as
$$S(Z) = \int_0^1 \mathbb{E}\left|(Z_1 - Z_0) - \dot{Z}_t\right|^2 dt$$
with $S = 0$ the ideal. Reflow retrains the model on the coupling its own flow induces: run the learned ODE, pair each source with the endpoint it actually reaches, regress the velocity on that new pairing, repeat. A bound shows that the minimum straightness over the first K rectifications falls as $O(1/K)$, so the sequence of retrainings, not one clever loss, does the work.

Caption: Rectified-flow trajectories for noise-to-cat generation and human-to-cat transfer at increasing Euler step counts. Panels after a second rectification are visibly near straight, which is why one step suffices; the first rectification still needs a few. The grid carries no straightness value and no quality metric.Rectified Flow
The conditions matter more than the headline. Reflow helps in the small-step regime, roughly under 80 steps for CIFAR-10, and hurts at large step counts because the velocity estimate accumulates error; the first rectification works from about two Euler steps, the second from one. Nor is it universal: the paper states that variance-preserving and sub-variance-preserving ODE paths are curved and cannot be straightened by reflowing at all, a two-dimensional toy result rather than a theorem. Straightness is reported graphically, with no scalar before-and-after values.Rectified Flow
The solver side is a short menu: Euler at one evaluation per step, Heun as a predictor-corrector second-order variant, RK4 at four. The lecture's own comparison puts Euler's error at two steps a factor of 10.4 above RK4's.
A network quietly ignores your condition, so the pressure goes on at sampling time and the loss never changes
Guidance is a property of sampling, not of training. A condition fed into the network can be learned around, and the fix presses harder in the direction the condition indicates while sampling, using predictions the same network already makes.
Nothing in the loss forbids the failure. Give a denoiser a class label and it can minimise the regression loss while barely using the label, since most of the noise variance has nothing to do with the class. The first repair puts a second network to work: a classifier $p_\phi(y\mid x_t)$ trained on noisy images at every noise level, whose gradient is added to the mean of each reverse step,
$$x_{t-1} \sim \mathcal{N}!\left(\mu + s,\Sigma,\nabla_{x_t}\log p_\phi(y\mid x_t),\ \Sigma\right)$$
where $\mu$ and $\Sigma$ come from the denoiser. Only the mean is pushed. Scaling the gradient is equivalent to conditioning on a sharpened classifier proportional to $p(y\mid x_t)^s$, so a larger $s$ concentrates sampling on the classifier's modes.ADM

Caption: Three panels on one axis of classifier-gradient scale for a class-conditional ImageNet 128 by 128 model, and they disagree about which direction is good. FID and its spatial variant bottom out near a scale of one then climb; the Inception score and precision keep rising; recall falls from about 0.66 to 0.27.ADM
That classifier is the part about to be removed. It is a second network, trained separately on noisy images, for every dataset and schedule, and it needs labels. Classifier-free guidance deletes it: one model is trained with the condition and with the condition randomly dropped, using an empty token in place of the label, and at sampling time the conditioned prediction is extrapolated away from the unconditioned one,
$$\hat{\epsilon} = \epsilon_\theta(x_t\mid\varnothing) + s\left(\epsilon_\theta(x_t\mid y) - \epsilon_\theta(x_t\mid\varnothing)\right)$$
The unconditional branch is not a second model. It is this model with the condition replaced by nothing, and the objective is untouched, so the only changes are a dropout during training and a mixing rule during sampling.CFG

Caption: The operation behind the formula: three class components start as one merged blob and are pulled apart and narrowed as guidance rises. Sharpening and mode separation happen together, which is the trade-off in one picture. A two-dimensional toy with solved guided densities, not classifier-free output.CFG
This is the third of the three promised relations, and the one worth memorising: the closed form tells you where to train, the noise-prediction loss tells you what to regress, and the guided prediction tells you how to spend the model twice at sampling time.

Caption: The same knob traced as a frontier: Inception score on the horizontal axis, FID on the vertical, each line a sweep over guidance weights for one model. Moving along a line buys one metric with the other; exact values belong to the paper's table, not the points.CFG
The numbers on class-conditional ImageNet 64 by 64 make the knob concrete, for the model trained with an unconditional probability of 0.1. A weight of 0.1 gives FID 1.55 with an Inception score of 66.1; a weight of 4.0 gives FID 26.22 with an Inception score of 260.2. One axis of variation moves both metrics a long way, which is why guidance is a fidelity and diversity dial rather than an improvement. The paper also names the cost it cannot avoid: two forward passes per sampling step.
The backbone changed, the two relations survived, and the skills still fail outside their range
What survived six years is the set of relations, not the network. The 2026 generator under the same loss is a diffusion transformer with a learned token hierarchy, and the live failure has moved from training stability and sampling speed to what the learned skills cover.
The architecture replaces a fixed patch grid with a learned hierarchy. A linear patch projection produces image tokens; between transformer stages, a grouping stage projects token features to unit-length queries and keys, computes a symmetric affinity, and merges groups by average linkage while affinity stays above a threshold. Because the criterion is representational rather than spatial, distant patches can land in one group. Each group becomes a compact token, the bottleneck blocks run on those, and ungrouping mixes group outputs back to their positions with soft weights while skip projections restore fine detail. A compression budget, folded into the loss with a small coefficient, regulates the average retained fraction across the batch.

Caption: Where the bottleneck sits. Token count falls to a compact core, the central transformer blocks run there, and two ungrouping stages restore the counts in reverse order, each with a skip path from the matching encoder level. Narrower boxes mean fewer tokens; feature width is fixed.HiT

Caption: The one place where grouping is shown rather than asserted, on six numbered tokens: an affinity matrix, a hard zero-or-one membership after average linkage at a threshold, then soft weights. The caption states the values are illustrative, so this is a mechanism sketch, not a measurement on real images.HiT
The sentence that matters here is not about grouping. The paper retains the baseline's diffusion objective, timestep distribution and conditioning-dropout protocol, and its group-guidance extension reduces exactly to standard classifier-free guidance when both capacity multipliers are 1. The loss from 2020 and the guidance relation from 2022 are still doing the work under a completely different body. It is a four-day-old preprint marked Under Review, and its own table contains a better latent-space row than its own pixel-space number, so it is a direction rather than a ranking.HiT

Caption: Generalisation measured rather than asserted. Interpolation inside the shaded training range is essentially perfect; immediately outside it the curve decays, and the dashed benchmark shows what copying the nearest training value would score. Bands are one standard deviation over seeds, widest where seeds disagree.VGL
The counterweight comes from a controlled lab rather than a benchmark. Six visual skills are rendered from explicit rules at 64 by 64 with the value grid known exactly and every training subset chosen by the experimenter, so extrapolation is a clean distribution shift and a model that falls back to the nearest training value is directly visible. Models train from scratch with the standard noise-prediction objective on a DiT backbone and are scored by rule-based extractors.
| Skill | In range | Interpolation | Extrapolation |
|---|---|---|---|
| Size (radius) | 100.0 | 96.8 ± 0.7 | 51.5 ± 7.5 |
| Position | 100.0 | 97.4 ± 3.2 | 29.7 ± 16.8 |
| Rotation | 100.0 | 100.0 ± 0.0 | 68.0 ± 28.9 |
| Count | 100.0 | n/a | 52.5 ± 34.5 |
Accuracy in per cent, mean over seeds. The decay is immediate and specific: for size every seed succeeds through a radius of 24 pixels and fails from 27, a few pixels outside the training range; for position accuracy falls from 49 per cent at 4.6 pixels outside the range to 11 per cent at 5.8 pixels outside. Growing the dataset from 10,000 to 80,000 images moves extrapolation only within seed noise, so the gap is not a data-volume problem. Coverage is what helps: the number of distinct skill combinations in training matters more than samples per combination, because each new combination shows a new pairing while extra samples repeat one already seen.VGL
The scope is narrow and the authors say so: synthetic data, one backbone, carry-over to natural images left open. It is a measurement, not a verdict.
Two things follow for a reader facing an unfamiliar paper from this period. The questions that used to organise the field are largely settled, so a paper reporting a faster sampler or a better backbone is repairing a late link of the chain, not the first. And the open link is coverage: if a model interpolates perfectly inside its training range and decays just outside, then the interesting claims are about which values and combinations the training data contained, and the interesting failures appear a few pixels or a few degrees past the edge.
参考文献
- What are Diffusion Models? (Lil'Log) — https://lilianweng.github.io/posts/2021-07-11-diffusion-models/
- Generative Adversarial Nets — arXiv:1406.2661
- Deep Unsupervised Learning using Nonequilibrium Thermodynamics — arXiv:1503.03585
- Denoising Diffusion Probabilistic Models — arXiv:2006.11239
- Denoising Diffusion Implicit Models — arXiv:2010.02502
- Flow Matching for Generative Modeling — arXiv:2210.02747
- Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow — arXiv:2209.03003
- Classifier-Free Diffusion Guidance — arXiv:2207.12598
- Diffusion Models Beat GANs on Image Synthesis — arXiv:2105.05233
- Hierarchical Diffusion Transformer for End-to-End Image Generation — arXiv:2611.22962
- Do Diffusion Models Learn to Generalize Basic Visual Skills? — arXiv:2611.22427