Academy K

Langevin Dynamics Sampling

InterviewCodingLangevin dynamicssamplinggradient

Related module: Stochastic computing and sampling

Problem statement

Implement Langevin dynamics for sampling from an energy-based model.

The update rule is:

xt+1=xt−ϵ2∇xE(xt)+ϵηtx_{t+1} = x_t - \frac{\epsilon}{2}\nabla_x E(x_t) + \sqrt{\epsilon}\eta_t

where ηt∼N(0,I)\eta_t \sim \mathcal{N}(0, I).

Implement sampling from a Gaussian mixture model using Langevin dynamics.

Practise this problem

Verify you understand it—not just that you read the answer.

Learn the foundations

The Thermodynamic Computing track covers this topic and more in depth.