§17.5–17.5.2The Challenge of Mixing between Separated Modes · Tempering · Depth

Part III DL pp. 599–604 · ~7 min read

  • mode (of a distribution)
  • slow mixing
  • energy barrier
  • tempering
  • parallel tempering

§17.5 The challenge of mixing between separated modes

MCMC’s central weakness is slow mixing . Ideally successive samples would be independent and visit regions of x\boldsymbol{x} in proportion to their probability. Instead — especially in high dimensions — they become strongly correlated. A Gibbs chain behaves like noisy hill-climbing on probability (noisy gradient descent on energy): it takes small steps that mostly lower the energy, so once it finds a mode (a region of low energy — say, a connected manifold of images of one object) it random-walks within that mode and only rarely escapes.

Whether it can escape is governed by the energy barrier between modes: crossing a barrier of height ΔE\Delta E is exponentially unlikely in ΔE\Delta E. When high- probability modes are separated by wide low-probability valleys — exactly the structure of a distribution with one manifold per class — the chain stays put far longer than it should. See all three regimes of the book’s figure 17.1, and use the temperature slider to break out of the trapped case:

Fig 17.1, live — Gibbs sampling on three targets. Independent variables mix freely; a correlated Gaussian forces the chain to crawl along the ridge; a two-mode mixture traps the chain in its starting mode at β = 1 (watch the mode-switch counter stay near 0). Lower β to temper: the peaks flatten, the barrier drops, and the chain begins hopping between modes.
sweeps: 0
mode switches: 0
p_β ∝ exp(−βE), β = 1/T

Two modes separated by an energy barrier: at β = 1 the chain gets stuck in one mode (few or no switches). Lower β to temper — the peaks flatten and it starts hopping between modes.

Worked example — why Gibbs won’t flip a sign

Take a two-variable EBM with E(a,b)=wabE(a,b) = -w\,ab and a,b{1,+1}a, b \in \{-1, +1\}: a strong belief (large w>0w > 0) that aa and bb share a sign. A Gibbs update of bb given a=1a = 1 draws from P(b=1a=1)=σ(w)P(b=1 \mid a=1) = \sigma(w). For w=3w = 3 that is σ(3)0.95\sigma(3) \approx 0.95; for w=5w = 5, σ(5)0.993\sigma(5) \approx 0.993. So with a=1a = 1, bb almost certainly stays +1+1 — and symmetrically aa stays +1+1 given b=1b = 1. Both all-++ and all-- are equally probable under the model, yet a one-variable-at-a-time chain almost never flips between them. The two modes are effectively disconnected.

The problem is sharpest for latent-variable models, where we alternate sampling p(xh)p(\boldsymbol{x}\mid\boldsymbol{h}) and p(hx)p(\boldsymbol{h}\mid\boldsymbol{x}). Good mixing wants p(hx)p(\boldsymbol{h}\mid \boldsymbol{x}) to have high entropy (so h\boldsymbol{h} can wander); a useful representation wants h\boldsymbol{h} to carry high mutual information with x\boldsymbol{x} (so it pins x\boldsymbol{x} down). These pull in opposite directions — the sharper a Boltzmann machine’s learned distribution, the worse it mixes:

Fig 17.2 (schematic) — consecutive samples. Left: a deep Boltzmann machine sampled by Gibbs stays on one digit identity for many steps (slow mixing between modes). Right: a GAN draws each sample by independent ancestral sampling, so there is no mixing problem at all.
DBM + Gibbs — consecutive samples77777stuck on one mode (digit) — slow mixingGAN — independent ancestral samples38150every sample independent — no mixing needed

§17.5.1 Tempering to mix between modes

If the peaks are too sharp, flatten them. Energy-based models make this trivial: add an inverse-temperature β\beta to the energy.

Tempering an energy-based model (eqs 17.25–17.26)

pβ(x)exp ⁣(βE(x))p_\beta(\boldsymbol{x}) \propto \exp\!\left(-\beta E(\boldsymbol{x})\right)
β\betathe reciprocal temperature, β = 1/T (a physics inheritance). Models are trained and used at β = 1scalar > 0
β>1 (T0)\beta > 1\ (T \to 0)colder: the distribution sharpens toward its modes, becoming deterministic as β → ∞sharper
β<1 (T)\beta < 1\ (T \to \infty)hotter: the peaks flatten and valleys fill in; as β → 0 the distribution becomes uniform — trivially easy to mix. This is what tempering exploitsflatter

Tempering mixes between the modes of p1p_1 by drawing samples at β<1\beta < 1, then relating them back to β=1\beta = 1. Two schemes — tempered transitions and parallel tempering — differ in how the temperatures are arranged:

Two tempering strategies. Click a cell for detail.
MethodHow it mixes
Tempered transitionstempered transitions (one chain)temporarily heat up to jump modes, then cool back to β = 1
Parallel temperingparallel tempering (many chains)chains at many temperatures swap states; hot chains feed the cold one
Dotted-underlined cells have explanations — click one.
Parallel tempering — a ladder of chains from cold (β = 1, accurate but stuck) to hot (β ≪ 1, free-mixing but inaccurate). Adjacent levels stochastically swap states, so a well-mixed hot sample can descend to the accurate cold chain.
β = 1.0accurate, stuckβ = 0.7β = 0.4free-mixingswapswap

Tempering helps but has not cracked the problem: there are critical temperatures around which the temperature must be changed very slowly for tempering to work, which is expensive.

§17.5.2 Depth may help mixing

There is a structural fix hinted at by representation learning. If p(hx)p(\boldsymbol{h}\mid\boldsymbol{x}) encodes x\boldsymbol{x} too precisely, sampling p(xh)p(\boldsymbol{x}\mid\boldsymbol{h}) barely moves x\boldsymbol{x} and mixing fails. But make h\boldsymbol{h} a deep representation and the chain in h\boldsymbol{h}-space can mix more easily: autoencoders and RBMs tend to produce a marginal over h\boldsymbol{h} that is more uniform and more unimodal than the data distribution over x\boldsymbol{x} — plausibly because minimizing reconstruction error while using all of representation space spreads the training examples out, well-separated, in h\boldsymbol{h}-space. Bengio et al. (2013a) found that deeper stacks yield top-level marginals that are more spread out, with smaller gaps between the regions for different modes (classes), so Gibbs sampling in that higher space mixes faster between modes. How best to exploit this remains open.

Despite the mixing difficulty, Monte Carlo methods are often the best tool available — and they are the primary weapon against the intractable partition function of undirected models, the subject of chapter 18.

Check yourself — mixing, tempering & depth

1.Why does a Gibbs chain get stuck in one mode of a multi-modal distribution?

2.In the EBM E(a,b) = −w·ab with a,b ∈ {−1,+1} and large w, why won't Gibbs flip the signs?

3.How does tempering, p_β(x) ∝ exp(−βE(x)), make mixing easier?

4.In a latent-variable model, why is there a tension between mixing and representation quality?

5.Predict the outcome — in MixingLab you pick 'separated modes', run at β = 1, then drop β to 0.4 and run again. What changes?

5 questions