Langevin Sampling: Drift Uphill, Kick at Random
An interactive live film: three hundred particles follow the unadjusted Langevin update on a two-bump density in 3D; their histogram on the back wall matches p for a small step, collapses to the peaks without noise, and widens for a large step.
Narration
We want samples from this density with two bumps, but all we know is its score, the arrows that point uphill on the log density.
Start a cloud of particles far away, at the near edge of the floor.
Each Langevin step moves every particle a little along the score, eta times s of x, and adds a random kick of size square root of two eta.
The drift pulls the particles uphill, and the kicks spread them out. After a burn in, the cloud takes the shape of p: its histogram, in amber, matches the true curve on the back wall.
Switch the noise off, and every particle just climbs to the nearest peak. That is gradient ascent. It finds modes, not samples.
Make the step too large, and the cloud comes out wider than p. The discrete update has a bias, and the Metropolis adjusted version removes it with an accept or reject test.
Your turn. Change the step size, and switch the noise off and on.
Drift plus noise, in the right proportion, turns a score into samples.
More from Chapter 18
Preview1:24Metropolis-Hastings: A Random Walk That SamplesChapter 18
Preview1:42MALA: Removing Discretization Bias with Accept-RejectChapter 18
Preview1:40Underdamped Langevin and HMC: Momentum-Driven ExplorationChapter 18
Preview1:29Langevin Dynamics and SGLD: Sampling vs OptimizationChapter 18
Preview1:46Speculative Decoding: Exact Sampling With a Draft ModelChapter 18