Interactive demo · Foundations of Deep Learning · Chapter 14

Langevin sampling on an energy landscape

Each chain follows the Langevin update (14.61), x ← x + η∇ln p(x) + √(2η) ε: a gradient step uphill on ln p, which needs only the score and not the normalising constant, plus Gaussian noise that stops the chain from settling on the mode. Hundreds of independent chains are run at once, so the cloud of points shows the distribution after τ steps. Change the step size, switch the noise off, or add the Metropolis correction (MALA), and compare the cloud with the target.

Target p(x)

Method

Step size η

Noise scale c (1 = the book's update)

Chains

Steps

Run

Try these

Chains start at 2 ε0, ε0 ~ N(0, I). Langevin: x′ = x + ηg(x) + c√(2η)ε. MALA proposes the same move with c = 1 and accepts it with probability min{1, p(x′)q(x|x′)/p(x)q(x′|x)} (14.40), q(a|b) = N(a | b + ηg(b), 2ηI). The red path is chain 1 (first 150 steps).

In the lecture notes