ID-5-02 (TO) · Mathematical Foundations of Diffusion Models · W02 demo
Generative AI in its simplest form: first generate by ancestral sampling (flip a coin, then draw), then discover the same generator is a single deterministic map applied to uniform randomness.
A hierarchical latent-variable model — the simplest conditional generator:
P(z = 1) = π, P(z = 2) = 1 − π, x | z ∼ N(μz, σ²)
Sample the latent coin z, then sample x from the chosen component. The colors below remember each sample's ancestry — and the marginal that emerges is exactly the two-component mixture p(x) = π N(x; μ₁, σ²) + (1−π) N(x; μ₂, σ²).
Now remove the coin. Take a single uniform number u ∼ Uniform(0, 1) and push it through the inverse of the cumulative distribution function:
x = F⁻¹(u), F(x) = π Φ((x−μ₁)/σ) + (1−π) Φ((x−μ₂)/σ)
Below, uniform points enter on the vertical axis, travel to the curve u = F(x), and drop to the x-axis. The histogram they build is the same mixture — no coin anywhere. Now slide σ → 0: the curve becomes a staircase, and the map becomes x = sign(u − π) — W01's two-point dataset, generated by thresholding a uniform.
The idea hiding in this demo. Once all of its random draws are exposed, a generative sampler is a deterministic map from base randomness to a sample. Here the map is explicit because the CDF is known (this page inverts it numerically). Deep generative models learn an ingredient of the map: GANs push Gaussian noise through a network; VAEs add decoder noise; normalizing flows make the map invertible; and W01's probability-flow ODE is exactly such a map — from a Gaussian to the data — built from a learned denoiser. That family is where this course is headed.