§16.0–16.2Structured Probabilistic Models · The Challenge of Unstructured Modeling

Part III DL pp. 558–563 · ~9 min read

  • graphical model

§16.0 A language for distributions over many variables

Part III’s research topics — RBMs, deep belief nets, deep Boltzmann machines, variational autoencoders — are all probabilistic models over thousands of variables. Before we can build them we need a way to write them down. That language is the structured probabilistic model , also called a graphical model : a probability distribution described by a graph (graph-theory sense — vertices joined by edges) in which

  • each node is a random variable, and
  • each edge is a direct interaction between two variables.

We met this idea briefly in §3.14; this chapter is self-contained and develops it in full. The payoff is enormous and worth stating up front: by declaring which variables interact directly, the graph lets us model a distribution with far fewer parameters, estimate it from less data, and store, query, and sample it far more cheaply. The deep-learning community uses these models in its own distinctive way — that is the subject of §16.7 — but the machinery is shared with the wider graphical-models field.

§16.1 Why the naive table is hopeless

The goal of deep learning is to scale machine learning up to AI: to understand high-dimensional data with rich structure — natural images, speech waveforms, documents. A classifier takes such an input and collapses it to a single label, discarding most of the information and freely ignoring large parts of the input (the background of a photo, say). Many other probabilistic tasks are more demanding: they need a complete model of the entire input, with no option to ignore any of it.

Four probabilistic tasks harder than classification. Click a row for what it demands. All but the first produce many outputs; all need a complete model of the input.
TaskGiven → returns
Density estimationestimate p(x)an input x → its probability under the data distribution
Denoisingrecover clean xa corrupted x̃ → an estimate of the true x
Missing-value imputationfill in the gapssome elements of x → a distribution over the unobserved ones
Samplinggenerate new xnothing → a fresh sample from p(x)
Dotted-underlined cells have explanations — click one.

Figure 16.1 in the book shows the sampling task on natural images: real CIFAR-10 tiles on top, and below them samples from a structured model — each placed at the grid position of its nearest training image, so you can see the model is synthesizing new pictures rather than memorizing:

Fig 16.1 (schematic) — a model’s sample (right of each pair) shown beside its nearest training image (left). The pairs are similar in category and layout but differ in detail: the model has learned the distribution, not the dataset. Real figure: 32×32 CIFAR-10 vs samples from Courville et al. (2011).
pair 1trainsamplenearest-neighbor placedpair 2trainsamplenearest-neighbor placedpair 3trainsamplenearest-neighbor placedpair 4trainsamplenearest-neighbor placeddashed = generated · similar to its neighbor, not identical → the model synthesizes

The exponential wall

Suppose we model only binary variables — the simplest possible case — and try to store the joint as a lookup table with one probability per outcome. For a small 32×32 pixel RGB image that is 230722^{3072} possible images: a number over 1080010^{800} times larger than the estimated number of atoms in the universe. In general, for nn discrete variables taking kk values each, the table needs

kn parameters,k^{n} \text{ parameters,}

and this is infeasible on four separate counts:

Four ways the kⁿ lookup table breaks. Click a row for the detail.
CostWhy the table fails
Memorystoring the modelkⁿ values to keep in memory
Statistical efficiencyfitting the modeleach of the kⁿ entries is a free parameter to learn
Runtime — inferencequerying the modelmarginals/conditionals sum over the whole table
Runtime — samplingsampling the modelinverse-CDF walk scans the whole table
Dotted-underlined cells have explanations — click one.

The deep problem is that the table explicitly models every possible interaction among every subset of variables. Real distributions are far simpler than that: most variables influence each other only indirectly.

The relay race

Three runners — Alice, Bob, Carol — run a relay in that order, each handing off a baton. Model each finishing time as a continuous random variable.

  • Alice runs first, so her time t0t_0 depends on no one.
  • Bob can’t start until Alice hands off, so t1t_1 depends directly on t0t_0.
  • Carol can’t start until Bob hands off, so t2t_2 depends directly on t1t_1.

Does Carol’s time depend on Alice’s? Only indirectly — through Bob. If we already know Bob’s finishing time, learning Alice’s tells us nothing more about Carol’s. So the whole race needs just two direct interactions, Alice→Bob and Bob→Carol; the indirect Alice→Carol link can be left out of the model entirely.

The relay race as direct interactions. Solid arrows are the two direct dependencies we model; the dashed grey arc is the indirect Alice→Carol influence, which flows through Bob and need NOT be modeled. §16.2.1 turns this picture into a formal directed model.
Alicet₀Bobt₁Carolt₂indirect — omitted from the modeldirectdirect

How much does modeling only direct interactions save? Discretize each runner’s time into 100 buckets. The full joint table over (t0,t1,t2)(t_0, t_1, t_2) needs 10031=999,999100^3 - 1 = 999{,}999 values. But storing one small table per direct interaction — 99 values for t0t_0, then 99×100=990099 \times 100 = 9900 each for t1t0t_1\mid t_0 and t2t1t_2\mid t_1 — comes to just 19,899: a saving of more than 50×. Explore how that gap grows with the number of variables:

The cost of a full joint table (kⁿ) versus a chain-structured graph (O(kᵐ), m = variables per conditional). Hit "relay race preset" for the 999,999-vs-19,899 case, then raise n: the full table climbs off the chart while the graph barely moves.
full table — O(kⁿ)999,999 params
graph — O(kᵐ)19,899 params

bar length ∝ log₁₀(params); axis to 10^6

table = kⁿ − 1 = 999,999
graph = (k−1) + (n−1)·k^(m−1)·(k−1) = 19,899
saving ≈ ×50
table still storable

m is the most variables in any one conditional table. As long as m ≪ n — few parents per node — the graph replaces an exponential table with a handful of small ones. Push n up with a full table (m = n) to watch the cost explode; a 32×32 RGB image is n = 3072, k = 2 → 2³⁰⁷², off this chart.

What the graph is really doing

A structured probabilistic model is a formal framework for modeling only direct interactions. Every edge you omit is an assumption that two variables do not need to interact directly. Because the parameter count scales with the size of the largest interaction you keep — not with the number of variables — a sparse graph turns an intractable distribution into a cheap one to store, fit, query, and sample.

§16.2 Two graph languages

Structured probabilistic models come in two broad families, distinguished by whether the edges carry arrows:

The two graphical-model languages, previewed. Click a cell for the flavor; each is developed in the sections ahead.
FamilyEdge meaningBest fit
Directeddirected acyclic graphan arrow a→b: b's distribution is defined conditionally on aclear one-way causality (the relay race)
Undirectedundirected graph (Markov random field)a plain edge: the two variables interact, with no preferred directionsymmetric interactions (who infects whom)
Dotted-underlined cells have explanations — click one.

Both are just ways of saying which variables interact directly; the direct interactions imply all the indirect ones, and only the direct ones are written down. Next we make each precise — starting with directed models, undirected models, and the partition function.

Check yourself — structured models & the unstructured wall

1.In a structured probabilistic model, what does an EDGE encode — and what does a MISSING edge encode?

2.Why is storing the joint distribution of a 32×32 RGB binary image as a lookup table infeasible?

3.In the relay race, does Carol's finishing time t₂ depend on Alice's t₀?

4.Predict the outcome — in ParamBlowupLab you set n = 3, k = 100 and slide m from 3 (full table) down to 2 (chain). What happens to the two parameter counts?

5.Which task is generally EASIER than the four listed probabilistic tasks, and why?

5 questions