Skip to content
Open access

Nii-MALA: A Fast Metropolis-Adjusted Langevin Sampler with Radial Velocity Benchmarks

Sep 2026 · Publications of the Astronomical Society of the Pacific · Vol 138 · 0 citations · 38 references
Physics Mathematics

Abstract

Markov chain Monte Carlo is widely used for model assessment and parameter fitting in astronomy and astrophysics, leading to numerous ready-to-use packages implementing various sampling techniques. For large-scale analyses involving many individual targets, computational efficiency becomes paramount, as it dictates the overall runtime. We introduce Nii-MALA, a high-performance C implementation of the Metropolis-Adjusted Langevin Algorithm, which leverages Message Passing Interface for parallelization and incorporates automatic differentiation backends for gradient evaluation. The code offers flexible control via a configuration file, allowing users to specify the proposal step sizes for all model parameters across parallel chains. We validate its effectiveness on 15- and 30-dimensional Gaussian distributions and a bimodal distribution, and further benchmark it against several other codes using radial velocity data from 51 Pegasi b. Our benchmarks confirm the efficiency of Langevin sampling over random-walk sampling in obtaining the effective sample size, particularly as the dimensionality of the target function increases. This algorithmic advantage can be effectively leveraged when paired with an efficient automatic differentiation library. However, for complex functions commonly encountered in astronomy—such as radial velocity orbital fitting—the derivative-dependent Langevin sampler shows lower efficiency than parallel tempering or alternative sampling approaches, as revealed by effective sample size analysis.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.