Langevin Dynamics for Sampling
What You'll Learn
You'll learn how Langevin dynamics uses score functions to iteratively refine random noise into high-quality samples by following gradients plus carefully added noise.
The Core Idea
Imagine you're blindfolded on a hilly landscape and want to walk downhill to find the valley (high probability region). You could follow the slope, but that might trap you in a small dip. Instead, you take steps downhill plus occasional random jumps. Over time, you explore the landscape and settle in the deepest valleys.
Langevin dynamics does exactly this for sampling from probability distributions. It starts with random noise and iteratively updates samples using two ingredients:
- Gradient steps: Move toward high-probability regions using the score function (∇ log p(x))
- Injected noise: Add randomness to explore the distribution properly
The update rule looks like:
x_{t+1} = x_t + ε · ∇ log p(x_t) + √(2ε) · z
where ε is the step size and z is random Gaussian noise.
Why Both Components Matter
- Score function gradient alone would collapse all samples to a single mode (like rolling all balls to one valley)
- Noise alone would be random wandering without direction
- Together, they balance exploration (finding all valleys) with exploitation (settling in deep ones)
This mirrors the reverse diffusion process: the score function learned by your denoising network guides samples toward the data distribution, while injected noise maintains proper sample diversity.
Key Takeaway: Langevin dynamics iteratively samples from a distribution by combining gradient ascent (following the score function toward high-probability regions) with injected noise (ensuring proper exploration), forming the theoretical foundation for diffusion model sampling.