Adaptive Stepsize Algorithms for Langevin Dynamics

Alix Leroy, Benedict J. Leimkuhler, Jonas Latz, Desmond J. Higham

Abstract

Sampling from complex probability distributions is a cornerstone of modern science, powering everything from molecular dynamics simulations to Bayesian machine learning. Langevin dynamics—a set of stochastic differential equations (SDEs)—is a go-to tool for this task. However, standard Langevin integrators typically use a fixed stepsize, forcing a difficult choice: use a tiny stepsize to remain stable in "steep" regions of the potential (wasting time elsewhere), or use a large stepsize and risk numerical explosion or biased results. In this work, Leroy et al. introduce a framework for invariant measure-preserving adaptive timestepping. By cleverly rescaling time and adding a specific correction term, they allow simulations to "slow down" only when necessary, maintaining both high efficiency and mathematical rigor.

The Challenge of Fixed Stepsizes

When using Langevin dynamics to sample a distribution $\rho(x) \propto \exp(-\beta V(x))$, we discretize the SDE. If the potential $V(x)$ has regions with very high curvature (steep walls or sharp corners), a fixed-stepsize integrator will become unstable unless the stepsize $h$ is extremely small.

While "adaptive" stepsizes exist in deterministic ODE solvers, simply changing the stepsize in an SDE usually changes the invariant measure—meaning you end up sampling the wrong distribution. The challenge is to vary the stepsize $h$ dynamically based on the state $x$ (using a "monitor function" $g(x)$) while mathematically guaranteeing that the long-term average still converges to the target Gibbs distribution.

Methods: Invariant-Preserving Time Transformation

The core innovation is a time transformation $dt = g(x) d\tau$, where $g(x)$ is a user-defined monitor function that scales the stepsize.

The Correction Term

The authors show that a naive time-rescaling leads to the wrong equilibrium. To fix this, they derive an "IP-transformed" (Invariant Preserving) SDE. For overdamped dynamics, this looks like: $$dx = -g(x)\nabla V(x)dt + \beta^{-1}\nabla g(x)dt + \sqrt{2\beta^{-1}g(x)}dW$$ The term $\beta^{-1}\nabla g(x)dt$ is the crucial "correction" that counteracts the bias introduced by the variable stepsize.

Naive time-rescaling in an SDE leads to a biased invariant distribution, failing to capture the true density $\rho(x)$.

Monitor Function Design

The authors propose a heuristic for $g(x)$ based on the gradient of the potential, bounded between a minimum $m$ and maximum $M$ to prevent the stepsize from vanishing or exploding. For underdamped Langevin dynamics, the authors develop new numerical splitting schemes (variants of the popular ABOBA/BAOAB methods). Because the time transformation makes the position update implicit, they employ a fast fixed-point iteration to solve the update at each step.

Key Results and Stability

The authors evaluate their method on several model systems, including a modified harmonic potential with a steep "spike" and a Bayesian inference problem with a sharp prior.

The IP-transformed SDE correctly recovers the target invariant distribution $\rho(x)$, matching the results of standard SDE sampling but with adaptive efficiency.

Efficiency and Accuracy

  • Order of Accuracy: The adaptive schemes maintain the expected order of convergence (1st order for Euler-Maruyama, 2nd order for splitting schemes) while allowing for much larger average stepsizes.
  • Stability: In the Bayesian example, the adaptive algorithm had zero escaping trajectories at stepsizes where the standard BAOAB method saw nearly 100% of its trajectories fail.
  • Computational Effort: The average value of the monitor function $g(x)$ was often $>1$, meaning the adaptive method was effectively "faster" than a stable fixed-step method while providing better accuracy.

Conclusion

The "Aha!" moment of this research is that you can't just change the stepsize; you have to change the physics. By treating the stepsize adaptation as a formal change of variables in the SDE, the "correction term" emerges naturally from the Fokker-Planck equation. For researchers dealing with "stiff" potentials or constrained sampling spaces, this paper provides a rigorous mathematical foundation for speeding up simulations without sacrificing the integrity of the results.

Summary updated

BibTeX
@article{leroy2024adaptive,
  author = {Alix Leroy and Benedict J. Leimkuhler and Jonas Latz and Desmond J. Higham},
  title = {{Adaptive Stepsize Algorithms for Langevin Dynamics}},
  journal = {SIAM J. Sci. Comput.},
  year = {2024},
  url = {https://openreview.net/forum?id=3KxG1Cxg0H},
}
Figure