§18.0 The problem
An undirected model gives an unnormalized ; the real distribution needs the partition function partition function Z = Σ/∫ p̃(x): the normalizer of an undirected model (term borrowed from statistical physics); usually intractable in deep learning (ch18) and can fail to exist if the integral diverges. defined in ch. 16 — open in glossary (or ), which is intractable for most interesting models (§16.2.3). Some deep models are designed to have a tractable , or to be used without ever computing (chapter 20); this chapter is about the models that confront the intractable head-on — how to train and evaluate them anyway.
§18.1 The log-likelihood gradient splits in two
Maximum-likelihood learning is hard here because depends on the parameters. The gradient splits into two named pieces:
Positive minus negative phase (eq 18.4)
| the POSITIVE phase — raise the unnormalized probability of the observed training example (easy: no Z) | gradient | |
| the NEGATIVE phase — lower the normalizer. This is the hard term; for an RBM the positive phase is easy but this one is not | gradient |
The negative phase looks hopeless — is an intractable sum — but it has a beautiful form. Differentiating (eqs 18.5–18.13, using ) collapses to an expectation over the model’s own samples:
The negative phase is a model expectation (eq 18.15)
| the expectation is under the MODEL distribution p — so we must draw samples from the model (chapter 17's MCMC) to estimate it | expectation | |
| the same easy per-example gradient as the positive phase — just evaluated at MODEL samples instead of data | gradient |
In energy terms (), the two phases are a tug of war: the positive phase positive phase The ∇θ log p̃(x) term of the undirected log-likelihood gradient: raise the unnormalized probability (lower the energy) on training examples. defined in ch. 18 — open in glossary pushes the energy down on training data; the negative phase negative phase The −∇θ log Z = −E_{x∼p}[∇θ log p̃(x)] term: lower the unnormalized probability (raise the energy) on samples drawn from the model; the difficult term. defined in ch. 18 — open in glossary pushes the energy up on samples drawn from the model. When , every up-push is matched by a down-push and the gradient vanishes — training is done. Drive it yourself:
The positive phase pushes p̃ up on data; the negative phase pushes it down on model samples. SML’s persistent chains reach the far spurious bump and suppress it → the model converges to the data.
The model samples of the negative phase are the points the model believes in most strongly — its wrong beliefs, often called “hallucinations” or fantasy particles fantasy particles The model's own samples used in the negative phase ('hallucinations'): points the model believes in strongly, whose probability the negative phase pushes down. defined in ch. 18 — open in glossary . (The positive/negative split has even been floated as an account of dreaming: follow awake, its negative asleep.)
§18.2 Making the negative phase affordable
The naive recipe (Algorithm 18.1) estimates eq 18.15 by burning in a fresh set of Markov chains from random initialization at every gradient step — far too expensive. Every practical method is a cheaper way to initialize those negative chains so they need less burn-in:
- 1sample a minibatch of data
- 2positive phase: ⓘ
- 3initialize negative samples ← ???ⓘ
- 4run Gibbs steps on each
- 5negative phase: ⓘ
- 6update
| Method | Negative-chain init | Consequence | |
|---|---|---|---|
| Naive MCMC (Alg 18.1) | naive MCMC | random, every step | correct but infeasibly expensive |
| Contrastive divergence (CD-k) | contrastive divergence | from DATA points each step | cheap; biased; leaves spurious modes |
| Stochastic max likelihood (SML/PCD-k) | SML = persistent CD | from the PREVIOUS step's chains | finds all modes; trains deep models |
| Fast PCD (FPCD) | fast PCD | previous chains + fast weights | forces rapid mixing during learning |
Why CD leaves spurious modes and SML doesn’t
Contrastive divergence contrastive divergence (cd) CD-k: approximate the negative phase by initializing the Gibbs chains from DATA each step and running k steps; cheap but biased, and fails to suppress spurious modes. defined in ch. 18 — open in glossary starts its negative chains at the data and runs only a few Gibbs steps, so they stay near the data. A mode the model invents far from the data — a spurious mode spurious modes Modes with high probability under the model but absent from the data; CD's short data-initialized chains rarely visit them, so it can't push them down. defined in ch. 18 — open in glossary — is never visited, so the negative phase never pushes it down (watch the spurious-mode mass stay high in CD mode above). Stochastic maximum likelihood stochastic maximum likelihood (sml) Approximate the negative phase by initializing each step's Gibbs chains from the PREVIOUS step's chains (persistent chains); finds all modes and trains deep models. = persistent contrastive divergence. defined in ch. 18 — open in glossary (a.k.a. persistent contrastive divergence persistent contrastive divergence (pcd) The deep-learning name for SML: persistent negative-phase Markov chains carried across gradient steps (PCD-k). defined in ch. 18 — open in glossary ) instead keeps persistent chains alive across gradient steps; free to wander, they discover every mode and suppress it. Fast PCD fast pcd (fpcd) Split θ = θ_slow + θ_fast, training the fast copy with a large learning rate (and weight decay) to force the negative-phase chain to mix rapidly during learning. defined in ch. 18 — open in glossary accelerates that wandering with a fast-weight copy of the parameters.
A crucial bonus: because these methods yield an estimate of separately, you can bolt the negative-phase gradient onto any positive- phase method — even one that only lower-bounds . Most of the other techniques in this chapter (next) cannot compose with a lower-bounded positive phase. Next: methods that sidestep Z entirely — pseudolikelihood, score matching, and noise-contrastive estimation.
Check yourself — positive/negative phase, CD & SML
1.The undirected log-likelihood gradient is ∇θ log p̃(x) − ∇θ log Z. What are these two terms?
2.In energy terms, what do the positive and negative phases do, and when does learning stop?
3.Across the naive/CD/SML methods, what is the one line that actually differs?
4.Why does contrastive divergence fail to suppress spurious modes, and how does SML fix it?
5.Predict the outcome — in PhaseLab you train in CD mode from the spurious-bump start, then reset and train in SML mode. What does the spurious-mode mass do?