#163 How to make your models sample faster, with Adrian Seyboldt & Eliot Carlson
Impossible d'ajouter des articles
Échec de l’élimination de la liste d'envies.
Impossible de suivre le podcast
Impossible de ne plus suivre le podcast
-
Lu par :
-
De :
Support & Resources
→ Support the show on Patreon
→ Bayesian Modeling Course (first 2 lessons free)
Our theme music is « Good Bayesian », by Baba Brinkman (feat MC Lars and Mega Ran). Check out his awesome work
Takeaways:
Q: What is mass matrix adaptation, in plain terms?
A: Mass matrix adaptation is best understood as an automatic, fairly dumb, but very effective reparameterization of your model. The simplest version, the diagonal mass matrix, just rescales each parameter so its posterior standard deviation becomes one, which is exactly what you'd do by hand if you had the patience. Every time you sample a PyMC or Stan model, this kind of reparameterization is happening under the hood.
Q: How does Nutpie's approach to mass matrix adaptation differ from Stan and PyMC's default?
A: Stan and PyMC's default sampler only use one source of information for diagonal mass matrix adaptation: the posterior standard deviation estimated from warm-up draws. Nutpie also uses the gradients of the log density, which HMC is already computing at every step to build its trajectory. For a standard normal distribution, the covariance of the gradients is exactly the inverse covariance of the draws, so Nutpie takes the geometric mean of the two resulting standard deviations. There's no guarantee it's always better, but in practice it usually is.
Q: What problem does "Preconditioning Hamiltonian Monte Carlo by Minimizing Fisher Divergence" actually solve?
A: Preconditioning HMC means transforming your target distribution into one that's friendly to sample, but doing that well requires knowing things about the distribution, like its covariance, that sampling itself is supposed to discover. This chicken-and-egg problem is usually handled by sketching a rough estimate from a handful of early warm-up draws, which can burn a large share of total sampling time. Adrian and Eliot's paper formalizes how to make better use of a second signal, the score function, that HMC already computes for free but that Stan-style preconditioning ignores.
Chapters:
00:00:00 What is HMC preconditioning?
00:09:03 A more robust low-rank mass matrix
00:11:58 What is mass matrix adaptation?
00:18:06 What does preconditioning HMC mean?
00:20:57 What is normalizing flow adaptation, and when does a linear mass matrix fall short?
00:23:50 When does normalizing flow adaptation actually help, and when is classic mass matrix adaptation enough?
00:27:13 What is Fisher divergence?
00:30:10 Why is HMC's trajectory, not its density, the right target for preconditioning?
00:33:04 What are the diagonal, dense, and low-rank-plus-diagonal versions of mass matrix adaptation?
00:46:25 How much faster is low-rank-plus-diagonal adaptation?
00:51:07 What's the practical recommendation for using Nutpie and its mass matrix adaptation?
00:54:31 Why does low-rank adaptation sometimes fail spectacularly?
01:01:35 Where does this research fit in the bigger picture of HMC?
01:12:12 How could centered vs. non-centered parameterization be chosen automatically?
Thank you to my Patrons for making this episode possible!
Links from the show here