When a model explains data through a hidden cause , the log-likelihood needs an integral over every that nobody can compute; so pick a simple distribution and maximise the ELBO, , which is always below by exactly the gap , so raising it trains the model and fits to the posterior at once.
Fig. 1: the bound is the evidence minus the gap, on one model where every number is exact. The column on the right is in nats, split into (teal) and the gap (orange).
You need: Bayes' rule and Gaussians (Probability for ML, sections 1, 2 and 5; Monte Carlo and the law of large numbers in section 4) and KL divergence with its forward and reverse directions (Information theory for ML, sections 3 and 4). The models built on the ELBO are taught on their own pages: Autoencoders and VAEs, Diffusion from zero and Flow matching and rectified flow; this page is the mathematics they share, with the derivations they cite in section 7.
A latent-variable model tells a two-step story: draw a hidden value (the latent variable) from a simple prior , then draw the data from the likelihood or decoder , with the parameters we train (in a VAE, a network's weights). We only ever see , so the probability of an observation is the marginal likelihood or evidence, the joint added up over every :
Maximum likelihood (Probability for ML, section 7) needs and its gradient, so it needs this integral for every example.
Prior ; decoder with ; we observe . Here the integral has a closed form: is a sum of two independent Gaussians (variances 1 and 0.25), so and
that is . Every number in sections 2 to 5 is measured against this (src/recompute.py recomputes each one).
Why it is usually impossible. Model A is solvable only because a Gaussian pushed through a straight line stays Gaussian. Make the mean a network's output, , and nothing cancels: Kingma and Welling name exactly this case, intractable "in cases of moderately complicated likelihood functions , e.g. a neural network with a nonlinear hidden layer" (Auto-Encoding Variational Bayes, section 2.1). A grid of 100 points per axis costs decoder calls for a 2-D latent and for a 16-D one. Naive Monte Carlo (draw from the prior, average ) is unbiased, but almost every prior sample explains a given image terribly, so the average is dominated by rare lucky draws.
Where latents appear. A Gaussian mixture ( is the cluster; the integral is a sum of terms, easy, and its posterior is EM's responsibilities); a VAE ( a continuous vector of 2 to a few hundred numbers, decoder a network: intractable); a diffusion model (the latents are 1,000 progressively noisier copies of the image, , each as large as the image: intractable); also topic models, probabilistic PCA and Bayesian neural networks (where is the weights). Contrast: a next-token model has no latent; is a softmax, one exact sum over the vocabulary, which is why language models train on plain cross-entropy and need nothing on this page.
The posterior is the distribution of after seeing , by Bayes' rule (Probability for ML, section 5):
The numerator is easy (run the decoder, evaluate the prior); the denominator is the evidence of section 1. So the posterior is intractable for exactly the same reason, and two jobs need it: inference ("what is this image's latent code?", for representations, compression, editing) and learning, because the gradient of is an average under the posterior (Fisher's identity, below), which is also why EM cannot run when the posterior is intractable, the second intractability Kingma and Welling list.
Multiply prior and likelihood and complete the square in : has leading coefficient , so the posterior variance is ; the peak is where vanishes, . So , standard deviation 0.447. In general : the observation pulls the prior's mean 0 most of the way to 1.5 and shrinks its spread five-fold. This is the shaded curve in the hero figure.
Model B, where no Gaussian fits. Change one thing: , the data is the square of the hidden value plus noise, and observe . Now and explain it equally well: the posterior has two humps. Section 3 measures what that costs a Gaussian .
Choose a family simple enough to sample and evaluate (say all Gaussians, each fixed by a mean and a variance) and take the member closest to the posterior in KL (Information theory for ML, section 3), in this direction (equation (10) of Blei, Kucukelbir and McAuliffe's review):
The search is ordinary optimisation over the numbers that define , the variational parameters ( for a Gaussian). ("Variational" comes from the calculus of variations, optimising over functions; here they are indexed by , so it is gradient ascent on .)
Fisher's identity: (differentiate , then use ). The EM algorithm alternates exactly the two jobs: compute the posterior (E-step), then maximise the expected log-joint (M-step).
The full Bayesian view (keep every answer, weighted) is Probability for ML, section 9. Sampling methods that target the exact posterior instead of approximating it (MCMC: Metropolis-Hastings, HMC) are the other road; Murphy's Probabilistic Machine Learning: Advanced Topics has a part on each (Further reading). Variational inference is used for every VAE encoder, Bayesian neural networks (Bayes by Backprop), topic models (LDA's original inference), Gaussian processes with inducing points, and the training objective of diffusion models (section 6).
The definition (Kingma and Welling eq. 2; Blei et al. eq. 13), with computable for any and estimated by drawing a few and averaging:
Three derivations, because each answers a different question: why it is a bound, how far below it sits, and how to tighten it.
A bound for every , however bad. Equality needs constant in , which happens only when , that is equals the posterior.
Write inside the definition; is a constant under , and what remains is a KL (Kingma and Welling eq. 1; Blei et al. eq. 14):
The evidence is the bound plus the gap, and the gap is exactly the reverse KL of section 2: every nat the ELBO gains is a nat the KL loses. When the model's also moves, raising the ELBO either raises (a better model) or shrinks the gap (a better ); the ELBO alone cannot tell you which.
Three averages, each in closed form for Gaussians (using for ):
and the entropy of , .
ELBO . The Gaussian KL from to the posterior is . Sum: , to every printed digit. A million-sample Monte Carlo estimate of the ELBO gives . At the posterior the ELBO is : gap zero. (A two-valued latent by hand: , , give and ELBO ; the gap 0.0589 equals the KL from to the posterior .)
With the two-humped posterior (, by quadrature), the best Gaussian sits on one hump (mean 1.33, standard deviation 0.19) and reaches an ELBO of : a gap of 0.712 nats that no optimiser can close, close to , the cost of covering only one of two equal humps. Only a richer family closes it (a mixture, or a normalising flow, section 4).
Predict first: on model A, if you widen far beyond the posterior, which falls, the reconstruction term or the KL to the prior? And on model B, can any setting make the gap 0?
Bar: split into and the gap. Model A's defaults are the hero's : ELBO , gap 1.2384; at the posterior the gap reads 0. Model B at : the best Gaussian leaves about 0.71 nats, near ; lower towards 0 and the humps merge, so the gap shrinks. Model B's is by quadrature on 2,401 points.
Way 1's first line says with the importance weight : draw from , reweight by how much more likely the model finds it than does (importance sampling, unbiased for ). Average weights (still unbiased, variance falling like ), take the log and apply Jensen again:
the importance-weighted bound of Burda, Grosse and Salakhutdinov (IWAE), Theorem 1: is the ELBO, never decreases as grows, and it tends to when the weights are bounded. It is computed in logs, with log-sum-exp (Probability for ML, section 12).
Model A, same : (a Monte Carlo average over 2,000 repeats; the exact ELBO is ), , , , against . On the MNIST VAE of section 4 the same experiment goes from to nats as runs from 1 to 1,000, still far from the truth there: a poor makes importance sampling converge slowly.
Split and group the prior with (Kingma and Welling eq. 3):
For model A's : , the same number. Engineers usually minimise the negative ELBO and call it the loss; image papers report it in bits per dimension (divide by , the number of pixels).
Every choice of family trades how close can get to the posterior against how cheap it is to fit. Three choices matter.
The mean-field family assumes factorises over groups of latents, (Blei et al. eq. 15). It cannot represent correlations between groups, but each factor's best update is computable: holding the others fixed (Blei et al. eq. 18; Bishop 2006, eq. 10.9),
with averaging over every factor except . Why: with the others fixed, the ELBO as a function of is plus a constant, (Blei et al. eq. 19), smallest (zero) when they match. Cycling through the factors is coordinate ascent variational inference (CAVI); each update can only raise the ELBO, so it converges, to a local optimum.
The example is Bishop's (Pattern Recognition and Machine Learning, section 10.1.3): data ( is the precision, one over the variance), priors and . The exact posterior is a known Normal-Gamma, so we can see exactly what loses.
Predict first: the exact posterior is a funnel (low precision, wide ). Will the converged mean-field fit be wider or narrower than it?
Fig. 3: the floor is ; the shaded surface is the exact posterior; the walls carry the marginals (exact dashed, solid). Ten observations (illustrative, listed below), priors ; start from . Heights are densities.
Data: 1.00, 1.15, 0.86, 0.55, 0.77, 0.50, 1.03, 1.67, 0.75, 0.69 (mean 0.897). CAVI converges in about five rounds to , , , . Blei et al. (section 1): "variational inference generally underestimates the variance of the posterior density".
CAVI and its stochastic version (stochastic variational inference, Hoffman et al. 2013) scaled topic models to millions of documents. In deep learning the factors are replaced by a network that outputs (next), but "mean field" still names the diagonal-Gaussian of every standard VAE: its latents are independent given .
Classical VI optimises separate variational parameters for each data point. A VAE trains one network for all of them: amortised inference (the cost of inference is paid once, in training, and spread over every future query). It is fast and works on new data, but the network may not output the best for each input. Cremer, Li and Duvenaud 2018 split the gap accordingly, with the best member of the family for that one input:
Cremer et al. found the same pattern on larger models: the amortisation gap often dominates; fixes include bigger encoders, iterative refinement of the encoder's output at test time, and semi-amortised VI. Diffusion models avoid the question: their "encoder" is fixed noise, not learned (section 6).
The 2-D-latent MNIST VAE trained for this page (its training run and latent map are on Autoencoders and VAEs, section 3), first 100 test images (src/data/vae_gap.py). With a 2-D latent, is computed almost exactly by quadrature, 161 by 161 decoder evaluations on a grid around each image's posterior: nats on average. ELBO with the encoder's : , a total gap of 8.24 nats. ELBO with a Gaussian optimised separately for each image (2,000 Adam steps): . So the approximation gap is 0.10 (a diagonal Gaussian fits this model's posteriors almost perfectly) and the amortisation gap 8.15: the encoder is a poor per-image optimiser on test images. Importance weighting with the encoder as proposal reaches only at (on 1,000 test images), which is why the quadrature is the truth here.
Model B's 0.71-nat gap needs a family that can bend and split. A normalising flow pushes a simple through invertible maps and keeps an exact density by the change-of-variables formula, (Rezende and Mohamed, "Variational Inference with Normalizing Flows"); the design problem is a cheap determinant (coupling and autoregressive layers make it triangular). IAF used as the VAE's is what fixes model B's problem at scale. Derived, with two checks and the layer types, in section 7.
With a neural there is no closed-form update; we need of , with , an average whose sampling distribution moves with the parameters. Probability for ML, section 11 introduces both estimators on ; here they are derived for the ELBO and pushed to the case that decides between them, many latent dimensions.
Try a , see how good it was, push towards it in proportion. No derivative of needed, so it works for discrete and non-differentiable rewards (Williams 1992), which is why policy gradients use it.
It uses the slope of at the sample, not only its value: one sample already says which way is uphill.
True value: . Pathwise, one sample gives (the term has no once ); enters linearly with slope , so the variance is exactly . Score function, one sample: , variance 71 by simulation, 25 with a baseline (the average of , the ELBO itself) subtracted from . Both average to 3.5. Now give the latent dimensions ( independent copies of model A) and ask for the gradient with respect to the first mean: pathwise looks only at coordinate 1, while the score function multiplies the whole , a sum of noisy terms, by coordinate 1's score.
Variance of one-sample estimates (log scale), 400,000 draws each, model A copied times. At the score-function estimator needs about 65,000 times as many samples as the pathwise one for the same precision (variance 403,466 against 6.25), and still 200 times as many with a baseline (1,256).
A VAE latent has 16 to a few hundred dimensions. That gap is why the reparameterisation trick made VAEs trainable, and why the score function lives on in RL only with heavy variance reduction (baselines, advantages: Policy gradients and actor-critic).
Predict first: with 1 sample per step and step size 0.03, which estimator's ELBO trace wobbles more?
Starts from the set in section 3's widget (model A by default) and moves it there too. Gradient ascent on , seeded so a run repeats exactly. The pathwise estimator uses the slope of at each sample and the closed-form entropy of ; the score-function estimator uses only the values of , times the score of . Both are unbiased; the trace plots the exact ELBO of the current .
The VAE (Kingma and Welling 2013; Rezende, Mohamed and Wierstra 2014) is sections 3 to 5 with networks: an encoder outputs a diagonal Gaussian (amortised, section 4), a decoder outputs , the prior is , and the loss is minus the "reconstruction minus KL" ELBO of section 3 (Kingma and Welling eq. 3 and 7) with one reparameterised sample per image (section 5; their section 2.3). The KL has a closed form, (their Appendix B, derived in section 7; 1.750 nats for , ). Two consequences are pure ELBO maths: only on the KL is a bound on (a -VAE trains a rate-distortion objective, Alemi et al. 2018), and the KL is minimised, to 0, by , so a decoder that reconstructs well without gives nothing a reason to move away: posterior collapse. The model itself (architectures, the units of the loss, the blur, collapse and its fixes, VQ-VAE, the latent scaling factor of latent diffusion) is taught on Autoencoders and VAEs; the MNIST VAE trained for this page, its training curves, latent map and a sweep, are measured there (sections 3 and 5, closed blocks).
Fig. 5 and Fig. 6 are the same bound with two choices of : learned and one-step (VAE), fixed and many-step (diffusion).
Diffusion is a latent-variable model with latents , each a noisier copy of the data, whose is fixed Gaussian noise rather than learned, so there is no amortisation gap to train away. Its ELBO (Ho et al. eq. 3 and 5) telescopes into , each a KL between two Gaussians with a closed form; writing the true reverse step's mean in terms of the added noise turns each KL into a weighted squared error on the noise, and dropping the weights gives Ho et al.'s one-line loss . That drop is a choice: the true bound weighs about 80 times more than , so is a reweighted ELBO, better samples for slightly worse likelihood. The eight steps, the score view, DDIM, guidance and flow matching are derived in section 7; the models, schedules, samplers and guidance in practice are Diffusion from zero, Flow matching and rectified flow and Latent diffusion and diffusion transformers.
Each block derives one result that the model pages cite rather than re-derive; all are optional on a first read. The closed forms are recomputed and checked by Monte Carlo or an independent route in src/recompute.py. In order: the Gaussian KL of every VAE loss; normalising flows (the richer family of section 4); the diffusion forward process; the diffusion ELBO down to "predict the noise"; scores and the SDE view; DDIM; classifier-free guidance; flow matching.
One dimension first: , .
Each dimension pays for its mean being away from 0 () and for its spread being anything but 1 (, zero at , growing as shrinks or grows). Kingma and Welling print it as , the negative KL, because they maximise.
, : dimension 1 gives (the same number as the Information theory page's example), dimension 2 gives ; total 1.750 nats. A two-million-sample Monte Carlo average of gives 1.749 (standard error 0.002).
This is the loss the page's VAE was trained with (from src/data/vae.py, PyTorch 2; is predicted rather than so it can take any real value):
mu, logvar = encoder(x) # [batch, J] each z = mu + torch.exp(0.5 * logvar) * torch.randn_like(mu) # reparameterised sample logits = decoder(z) # [batch, 784] rec = F.binary_cross_entropy_with_logits(logits, x, reduction='none').sum(-1) # -log p(x|z) kl = 0.5 * (mu**2 + logvar.exp() - 1 - logvar).sum(-1) # closed form loss = (rec + beta * kl).mean() # beta = 1: minus the ELBO
Idea: start from a simple random variable and push it through an invertible function . Where stretches space, probability thins out; where it squeezes, it piles up. The change-of-variables formula keeps the books.
, : at , , , so ; the log-determinant is . (the log-normal): at , , , so ; counting four million samples falling in gives 0.158.
A normalising flow composes such maps, , and the log-densities add up (Rezende and Mohamed "Variational Inference with Normalizing Flows", eq. 6 to 7): . The whole design problem is making that determinant cheap: a general determinant costs .
Take a data point (an image; here a 2-D point). The forward process adds a little Gaussian noise times (Ho et al. 2020 eq. 2; Sohl-Dickstein et al. 2015 introduced the idea):
Read it as "" with fresh noise each step: in the VAE language of section 6, this is a reparameterised encoder with no trainable parameters.
Any noise level in one jump: training never runs the chain, it draws and noise and computes in one line. If the data has unit variance, so does every (): the "variance-preserving" process.
The root's example (Topic: math, Notation decoder, "Diffusion training loss"): , , on the linear schedule. , so , , and .
Monte Carlo: 200,000 copies of pushed through all 200 single steps, fresh noise each step. Mean against (standard error 0.0013); variance 0.342 against . After all 1,000 steps: variance 1.001 and 1.007 against ; the data is gone.
Why a second schedule. On the linear schedule : by the halfway point only 8% of the signal variance is left, and "the latents in the last quarter of the linear schedule are almost purely noise" (Nichol and Dhariwal 2021, section 3.2), so those steps teach little. The cosine schedule keeps and drops roughly linearly in the middle. A useful single number per step is the signal-to-noise ratio , usually as its log : linear runs from to , cosine from 10.1 to at and at , where the 0.999 clip leaves . Kingma et al. 2021 (Variational Diffusion Models) show that in continuous time the ELBO depends on the schedule only through its two end values of SNR; schedules change which noise levels training spends its effort on.
The model. Generation runs the chain backwards: start from pure noise and apply learned Gaussian steps (Ho et al. eq. 1)
with fixed (Ho et al. use or , below). This is a latent-variable model with latents , and the forward process of D3 is its . Reverse steps can be Gaussian because, for small , the true reverse of a small Gaussian step is itself close to Gaussian (Sohl-Dickstein et al. 2015, citing Feller).
: how far the fully noised data is from pure noise; no parameters, and tiny (for on the linear schedule, nats per dimension). : at every step, the learned reverse step against the true reverse step given the clean data. : the final decoder. Every term compares Gaussians, so it has a closed form: no high-variance sampling of the whole chain.
and (against ). The same three numbers come out of conditioning the joint Gaussian of given by the textbook formula (), in src/recompute.py. Given the noisy point, the clean data barely moves the next step: one more reason each step is easy to learn.
(Ho et al. eq. 12)
The last step is a choice, not a derivation. Ho et al. drop the weight in front and sample uniformly: (eq. 14). With the dropped weight is :
| 1 | 2 | 10 | 100 | 200 | 500 | 1000 | |
| weight | 0.50 | 0.27 | 0.074 | 0.010 | 0.0060 | 0.0055 | 0.010 |
The true ELBO puts about 80 times more weight on than on . In Ho et al.'s words, the simplified objective "down-weight[s] loss terms corresponding to small t. These terms train the network to denoise data with very small amounts of noise, so it is beneficial to down-weight them so that the network can focus on more difficult denoising tasks at larger t terms" (section 3.4). So is a reweighted ELBO: better samples, slightly worse likelihood (their Table 1: FID 3.17 against 13.51, test bound 3.75 against 3.70 bits per dimension on CIFAR-10). Later work treats the weighting as a design knob: Kingma and Gao 2023 show that with any monotonic weighting the diffusion objective equals the ELBO of the data with Gaussian noise augmentation.
The score of a distribution is the gradient of its log-density with respect to the data, : an arrow at every point, pointing towards higher density. (Not the score of section 5, which was a gradient with respect to parameters; statistics uses the word for both.) Two facts make it useful:
Learning a score without knowing it. Minimising needs the unknown true score. Two tricks remove it. Hyvärinen 2005 integrated by parts to get an objective with only and its divergence. Vincent 2011 showed that for noised data the target can be the score of the noising kernel, which is known: denoising score matching. For our kernel :
So regressing onto is regressing onto the kernel's score times , and the minimiser of a squared loss is a conditional mean: , which Vincent's identity turns into the score of the noised marginal:
Let the data be . Then every (variance preserving, D3), with score . The formula says the ideal noise prediction is . At : slope 0.5839. A million simulated pairs, regressing on by least squares: slope 0.5843.
That is why Ho et al. say their sampler "resembles Langevin dynamics with as a learned gradient of the data density" (section 3.2): DDPM's reverse step is a scaled score step plus noise. Song et al. 2021 unified the two families in continuous time: the forward process is a stochastic differential equation (SDE) ; its exact time reversal is another SDE that needs only the score, (their eq. 6, from Anderson 1982); and a deterministic probability flow ODE, (their eq. 13), has the same marginals at every . DDPM discretises the reverse SDE; DDIM, next, is a discretisation of the ODE.
Song, Meng and Ermon 2020 noticed that only ever uses the marginals , never the step-to-step chain. Many chains share those marginals, including non-Markovian ones, so a network trained once can be sampled with any of them. Their update (eq. 12), in DDPM's notation:
Guess the clean point from the current one; re-noise that guess to the next, lower noise level, reusing the predicted noise as the direction; optionally add fresh noise. With equal to DDPM's posterior spread it is DDPM; with it is deterministic, the DDIM sampler, and its steps can skip: use only a subsequence of noise levels ( taken at, say, 20 evenly spaced ).
Run the network twice, with the condition and with an empty condition , and extrapolate past the conditional prediction, away from the unconditional one. One network does both: during training the condition is replaced by with some probability (15% for the two-moons toy on Diffusion from zero). is plain conditional sampling.
The path. Pair a data point with a noise sample and join them by a straight line: , (Esser et al. 2024 (Stable Diffusion 3), eq. 13; Liu, Gong and Liu 2022, rectified flow). Along that line the velocity is constant, .
The loss (conditional flow matching, Lipman et al. 2023):
It is the same family as diffusion: is a scaled data point plus scaled Gaussian noise, so a velocity prediction converts to a noise prediction () or a clean-data prediction (). What changes is the path (straight in rather than variance-preserving) and the target (velocity rather than noise), and with them which errors are cheap.
Conventions differ: Lipman et al. put noise at and data at (their eq. 22 to 23, with a small ); Stable Diffusion 3 and this page put data at . Couplings, reflow and solvers are on Flow matching and rectified flow.
This page trained three models whose runs teach the models more than the maths; each now sits on the page that owns it:
| Date (arXiv v1 or announcement) | System | What from this page it uses |
|---|---|---|
| Dec 2013 | VAE | ELBO, reparameterisation, Gaussian KL (sections 3, 5, 6) |
| Nov 2017 | VQ-VAE | Discrete latents with a learned prior, straight-through gradients; avoids posterior collapse (section 6; measured on Autoencoders and VAEs). Discrete image and audio tokenisers descend from it. |
| Jun 2020 | DDPM | Forward process, ELBO, (D3, D4) |
| Dec 2021 | Latent diffusion (Stable Diffusion) | A KL-regularised autoencoder (a VAE with a small KL weight) compresses images; diffusion runs in its latent space (section 6) |
| Apr 2022 | DALL-E 2 (unCLIP) | Two diffusion stages: a prior that generates a CLIP image embedding from the caption, a decoder that generates the image from it |
| May 2022 | Imagen | Text-conditioned pixel diffusion with a frozen T5 text encoder |
| Jul 2022 | Classifier-free guidance | D7; used by essentially every text-to-image system since |
| Dec 2022 | DiT | Replaces the U-Net denoiser with a transformer on latent patches |
| Mar 2024 | Stable Diffusion 3 | Rectified flow (D8) with a multimodal transformer, up to 8B parameters |
| 1 Aug 2024 | FLUX.1 (Black Forest Labs) | "a hybrid architecture of multimodal and parallel diffusion transformer blocks and scaled to 12B parameters", built on flow matching |
| Oct 2024 | Movie Gen (Meta) | A 30B-parameter transformer for video trained with the Flow Matching objective |
| Feb 2025 | LLaDA | Diffusion for text: a masking forward process and a transformer reverse process, trained on "a likelihood lower bound"; 8B parameters |
| Jul 2026 | DiffusionGemma | Gemma 4 26B A4B converted from autoregressive to discrete diffusion, about 20 tokens per forward pass (paper page) |
The pattern: the VAE survives as the compressor in front of nearly every image and video generator; the generator itself moved from DDPM's noise prediction to flow-matching velocity with transformer backbones; and diffusion is being tried for text, where the latents are masked tokens rather than Gaussian noise. Topic: generative-and-multimodal compares these systems (its Model map); this page owns the maths they share.
Each one opens; the first five are about the ELBO itself, the rest about the diffusion and flow derivations of section 7.
The VAE as a model: the loss in working form, and the blur, posterior collapse and its fixes measured, VQ-VAE, FSQ, VQGAN, the autoencoders inside latent diffusion. 35 min, plus 12 in closed details
Forward process, schedules and SNR, prediction targets and weighting, samplers, guidance and few-step distillation, on a real trained model. 43 min, plus 20 in closed details
The marginal field, solvers at equal cost, paths, couplings, reflow, one-step distillation, timestep sampling. 43 min, plus 17 in closed details
Diffusing in a VAE's latent, the U-Net, DiT, MMDiT, text conditioning. 39 min, plus 15 in closed details
Which maths each part of ML uses and one training step of a tiny model, all six areas; its Notation decoder tab decodes the DDPM loss (eq. 14) symbol by symbol.
Bayes' rule (section 5), Gaussians, MLE and MAP, full Bayesian inference (9), the law of large numbers (4), the reparameterisation idea on (11). 32 min, plus 16 in closed details
KL divergence (section 3), the forward against reverse KL animation (4), KL in RLHF, DPO and the ELBO (10). 38 min, plus 8 in closed details
Determinants as volume, eigenvalues, the SVD: the change-of-variables formula's determinant. 45 min, plus 13 in closed details
Jacobians and how autograd differentiates through the reparameterised sample. 32 min, plus 22 in closed details
Estimators, bias and variance: the language of section 5's gradient estimators. 33 min, plus 6 in closed details
Gradients, convexity, Lagrange multipliers; the optimisation that VI turns inference into. 32 min, plus 11 in closed details
Floating point and log-sum-exp: why the importance-weighted bound is computed in logs. 40 min, plus 9 in closed details
Ho et al. 2020 in its own order, four toy DDPMs from its Table 2, a forward and reverse animation on a Swiss roll, a learned score field. 25 min
Diffusion in a VAE's latent space; the compression factor ablation.
Discrete diffusion for text at 26B parameters. 24 min
The score-function estimator with baselines and advantages, where reparameterisation is impossible. 45 min, plus 9 in closed details
The other main route to representations without labels.
The text and image embeddings that DALL-E 2 and many guided generators condition on.
Sections 2 to 4: the ELBO, mean field, CAVI, stochastic VI. The clearest first text. 2 h
10.1 to 10.4: mean field, the Gaussian example of section 4, variational mixtures. Free PDF from Microsoft Research. 5 to 6 h
The VAE by its author: chapters 2 and 3 (ELBO, reparameterisation, flows as posteriors). 3 h
The original: sections 2 and 3, Appendix B (the Gaussian KL). 1 h
The diffusion ELBO derived in full from the hierarchical VAE, then the score view: a longer version of D3 to D5. 2 to 3 h
Dense survey with every derivation; good for review. 1 h
Score matching, Langevin, the SDE view, by its author. 1 h
Sections 2 and 3 and Appendix A: what D4 derives. 1 h
Course notes building flows and diffusion from ODEs and SDEs. 4 to 6 h
The reference treatment of flow matching, with a PyTorch library. 4 h
Schedules, preconditioning and samplers as separate design choices: the research-level view of D3 and D6. 2 h
Reference chapters on variational inference, Monte Carlo, VAEs, flows and diffusion, with code. reference
Every closed form on the page (model A's evidence, posterior and ELBO terms, the Gaussian KL, , the reverse-step posterior, Tweedie's slope, the change of variables) is recomputed and checked by Monte Carlo or by an independent route in src/recompute.py; the page's JavaScript is compared with it, and the in-browser samplers with the NumPy reference sampler, by src/check_js.mjs. Equation numbers and quotations are from the arXiv versions linked (Kingma and Welling v11, Ho et al. v2, Song et al. DDIM v4, Ho and Salimans v1, Lipman et al. v2, Blei et al. v9).