🤖 AI Summary
Existing Hamiltonian Monte Carlo (HMC) methods for Bayesian models with implicit algebraic constraints embed numerical root-finding (e.g., Newton–Raphson) but suffer from high computational cost due to fixed initial guesses, requiring multiple solver iterations per HMC step. This work proposes a dynamic initial guess mechanism that adaptively updates the guess along the Hamiltonian trajectory. We introduce two heuristic strategies: solution-transferring extrapolation from previous iterates and gradient-guided extrapolation based on implicit differentiation. Leveraging JAX’s automatic differentiation and just-in-time compilation, we implement an efficient, differentiable numerical solver. Evaluated across diverse constrained models, our method accelerates NUTS sampling by 2–5×. We release *grapevine*, the first open-source library supporting constraint-aware HMC with dynamic initial guesses—establishing a scalable new paradigm for Bayesian inference in implicitly defined models.
📝 Abstract
Modern implementations of Hamiltonian Monte Carlo and related MCMC algorithms support sampling of probability functions that embed numerical root-finding algorithms, thereby allowing fitting of statistical models involving analytically intractable algebraic constraints. However the application of these models in practice is limited by the computational cost of computing large numbers of numerical solutions. We identify a key limitation of previous approaches to HMC with embedded root-finding, which require the starting guess to be the same at all points on the same simulated Hamiltonian trajectory. We demonstrate that this requirement can be relaxed, so that the starting guess depends on the previous integrator state. To choose a good guess using this information we propose two heuristics: use the previous solution and extrapolate the previous solution using implicit differentiation. Both heuristics yield substantial performance improvements on a range of representative models compared with static guessing. We also present grapevine, a JAX-based Python package providing easy access to an implementation of the No-U-Turn sampler augmented with dynamic guessing.