Generative AI, in Its Simplest Form

W02 · Part 2 — conditional generation, and sampling as a deterministic map

Uma Satyaranjan · Soma S Dhavala

Invalid Date

Two views of one output distribution

  • So far: a generative model = a fitted distribution you can sample
  • Now two deeper views of the same output distribution, each one line long:
  • View 1 — hierarchy: sample step by step, conditionally (a hierarchical latent-variable model)
  • View 2 — a map: a deterministic function of all the base randomness

Every generative sampler — diffusion included — is View 2, once all of its random inputs are exposed.

View 1: conditional generation

ℙ(z=1)=π,ℙ(z=2)=1−π,x∣z∼𝒩(μz,σ2)\mathbb{P}(z = 1) = \pi, \quad \mathbb{P}(z = 2) = 1-\pi, \qquad x \mid z \sim \mathcal{N}(\mu_z, \sigma^2)

  • Draw the hidden label zz (the latent variable), then draw from the chosen Gaussian
  • This is ancestral sampling: follow the arrows of the hierarchy
  • The marginal you observe is the two-component mixture: p(x)=π𝒩(μ1,σ2)+(1−π)𝒩(μ2,σ2)p(x) = \pi\,\mathcal{N}(\mu_1,\sigma^2) + (1-\pi)\,\mathcal{N}(\mu_2,\sigma^2)

Generation runs z→xz \to x. Inference runs x→zx \to z: the posterior ℙ(z∣x)\mathbb{P}(z \mid x). For μ=±1\mu = \pm 1 and π=12\pi = \tfrac12, the posterior mean of μz\mu_z was W01’s tanh denoiser — you have already met conditional inference.

Live: coin first, Gaussian second

View 2: marginalize the coin away

The inverse-CDF construction: for any CDF FF, with the generalized inverse F−1(u)=inf{x:F(x)≥u}F^{-1}(u) = \inf\{x : F(x) \ge u\},

u∼Uniform(0,1)⇒x=F−1(u) has CDF Fu \sim \mathrm{Uniform}(0,1) \quad\Longrightarrow\quad x = F^{-1}(u) \ \text{ has CDF } F

  • Proof (continuous, strictly increasing case) is one line: ℙ(F−1(U)≤x)=ℙ(U≤F(x))=F(x)\mathbb{P}(F^{-1}(U) \le x) = \mathbb{P}(U \le F(x)) = F(x)
  • All the randomness lives in one uniform number; everything after it is deterministic
  • Careful: u<πu < \pi selects the lowest π\pi-fraction of the mixture — when the components overlap, that is not the original label zz (the packed map in the notes is the version that does encode the coin)

The two-point limit

Slide σ→0\sigma \to 0 in the demo. The CDF becomes a staircase: jump at μ1\mu_1, plateau at height π\pi, jump at μ2\mu_2. The map becomes

x=sign(u−π)(for μ=±1; almost surely — u=π has probability zero)x = \operatorname{sign}(u - \pi) \qquad \text{(for } \mu = \pm 1\text{; almost surely — } u = \pi \text{ has probability zero)}

  • W01’s two-point dataset, generated by thresholding a uniform — and in this separated limit, u<πu < \pi does coincide with the label
  • Pure sampling has become a formula (Part 3 proves this limit)
  • The plateau of FF is the empty region between the clusters: no uu ever lands there

Why this reframing matters

Model Random input(s) Sampling mechanism Typical fitting
This demo u∼Uniform(0,1)u \sim \mathrm{Uniform}(0,1) quantile F−1(u)F^{-1}(u) (numerical here) the CDF is known
GAN z∼𝒩(0,I)z \sim \mathcal{N}(0,I) Gθ(z)G_\theta(z), a network adversarial objective
VAE zz, plus decoder noise ε\varepsilon sample pθ(x∣z)p_\theta(x \mid z), i.e. Tθ(z,ε)T_\theta(z,\varepsilon) ELBO / variational learning
Normalizing flow z∼𝒩(0,I)z \sim \mathcal{N}(0,I) invertible fθ(z)f_\theta(z) exact likelihood (change of variables)
Diffusion xT∼𝒩x_T \sim \mathcal{N}; step noise if stochastic probability-flow ODE (deterministic) or reverse SDE score/denoising objectives, ELBO

Same outer skeleton: simple randomness → sampling mechanism → data. The learned object, the constraints, and the sampler differ.

You have already seen the diffusion map

  • W01, Act III: particles from a moment-matched Gaussian flowed numerically to within ≈σmin\approx \sigma_{\min} of ±1\pm 1 (Euler steps, finite cloud — W01 lists the approximations)
  • With the exact terminal law, exact score, and exact integration, the probability-flow ODE is a deterministic transport — an inverse-CDF-like map from noise to data
  • Diffusion learns the scores of the noised distributions; integrating the resulting velocity field constructs the endpoint map

When no formula for the map exists, we learn an ingredient of it. Learning that ingredient — carefully, with all the mathematics — is the rest of this course.

Once every random draw is exposed, generation is a deterministic map from base randomness to a sample.

Analytic today. Learned, from tomorrow onward — starting with how to measure a model’s error: KL divergence.