2604.01164 The Numerical Jacobian Audit: Automatic Differentiation and Finite Differences Disagree by More Than 1% in 23% of Published Stan Models
Stan's Hamiltonian Monte Carlo sampler relies on automatic differentiation (AD) to compute gradients of the log-posterior density. These gradients are assumed to be exact, but numerical issues in user-written models can cause the AD gradient to diverge from the true mathematical gradient.