ID-5-02 (TO) · Mathematical Foundations of Diffusion Models · Foundations demo

The Joint Slicer

A joint distribution is a mountain of probability mass. Marginals are its shadows; conditionals are its slices, re-inflated; and Bayes’ rule is the licence to slice in either direction.

Act I · The mountainShadows that never move, slices that do

The heatmap is a joint p(x, y). The curves on the edges are its two marginals — the shadows. Drag the ρ slider: the mountain twists, but the shadows do not move — many mountains cast the same shadows (this is the coupling-underdeterminacy of the transport tutorials). Drag the slice lines: each panel shows the raw slice (a sliver of mass) and the same slice renormalised to unit area — the conditional distribution.

Twisting one ellipse is the mild version of the point. Click through “two blobs ↗”, “two blobs ↘” and “four blobs” for the strong one. Each puts round lumps at the corners (±1.25, ±1.25); each therefore puts mass ½ at x = −1.25 and ½ at x = +1.25, and the same in y — so all three have exactly the same pair of shadows. Watch the edge curves as you switch: they do not move at all. But the mountains could hardly differ more, and their correlations are +0.86, −0.86 and zero: the four-blob one is genuinely independent, the other two strongly dependent. Nothing computable from the marginals tells them apart — and note that the correlation is not computable from the marginals either. It is joint information the shadows discarded.

p(x, y) with marginals on the edges — drag the slice lines p(y | x) p(x | y)

slice at x = 0.5 — raw sliver vs conditional p(y | x)

slice at y = 0.5 — raw sliver vs conditional p(x | y)

Keyboard: focus a panel, then use ←→ to move the vertical slice and ↑↓ the horizontal one (hold Shift for larger steps).

Bayes’ rule is visible here as bookkeeping: vertical ribbons weighted by the x-shadow rebuild the same mountain as horizontal ribbons weighted by the y-shadow — p(y|x) p(x) = p(x,y) = p(x|y) p(y). Slicing is swappable; that is the whole rule. The shadows are fixed within each family: dragging ρ leaves the single Gaussian's N(0, 1) shadows alone, and switching among the three blob shapes leaves their common two-bump shadows alone. (Moving between the two families does change the shadows — one central bump versus two side bumps.) Within a family, no amount of staring at the marginals can tell the mountains apart.

Act II · The shelvesA mixed joint, and W01’s posterior born from a slice

When one variable is discrete (the latent coin z) and one continuous (the observation x), the joint is not a mountain: it is two shelves of 1-D mass, one per value of z, weighted π and 1−π. Drag the slice line: it crosses both shelves, the two heights are renormalised into the posterior P(z | x) — and the posterior mean of the shelf labels ±1 is the tanh denoiser of W01, tanh(x/σ²), when π = ½. Away from equal weights the prior tilts the posterior and the denoiser picks up a shift, to tanh(x/σ² + ½ log((1−π)/π)).

the joint of (z, x): two shelves — drag the slice z = −1 shelf (mass π) z = +1 shelf (mass 1−π)
The slice-and-renormalise you just did is Bayes’ rule on a mixed joint — and with π = ½ it reproduces, bar for bar, the sigmoid posterior and tanh denoiser derived in W01. Conditioning is geometry.

One object, three readings. The joint is the complete description; marginals are its lossy shadows (many joints per shadow-pair); conditionals are its slices made into distributions. Bayes’ rule adds nothing new — it states that the two ways of slicing the same object must agree.