Hardware-Accelerated Variational Inference using Inverse Autoregressive Flows (JAX/Equinox) #8320
DJLacombeTTU
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I’ve been working heavily with JAX-backend PyMC to scale up some large-N and densely correlated models, and I wanted to share an
IAFOptimizer(Inverse Autoregressive Flow) implementation that might be useful for others in the community facing MCMC bottlenecks.I want to make it absolutely clear up front: as an applied econometrician, not a computer scientist, I am not the inventor of this methodology. I simply refactored and adapted the incredible code and concepts originally provided in this recent paper. My goal was to package their work into a robust, auto-tuning inference engine that integrates cleanly with PyMC and ArviZ for applied research.
The Neural Network Architecture
To map standard Gaussian noise into highly complex posterior distributions, this optimizer leverages a deep neural network under the hood.
The architecture is built using the
Equinoxlibrary and consists of a Masked Autoencoder for Distribution Estimation (MADE) coupled with a Deep Sigmoidal Bijector. Because we are training a neural network to maximize the Evidence Lower Bound (ELBO), ensuring stable gradient dynamics is critical. The network architecture relies on several deep learning optimizations:Benchmark Results
Using an Optuna integration to find the optimal neural network depth, mixture components, and learning rate, I ran the flow against four standard topologies.
The results highlight exactly where these neural-network-backed Normalizing Flows scale brilliantly (massive datasets and dense covariance matrices) and where they are still strictly bound by proper parameterization hygiene (hierarchical funnels).
0.414349600.100239111.168960.28214939Note: Diagnostics generated via
arviz.psislw.For applied users working with massive datasets or spatial matrices where NUTS leapfrog evaluations become paralyzed, this has been an incredible pre-processor and alternative inference tool.
The full refactored codebase, neural network architecture, and benchmarking suite can be found in my repository here: https://github.com/djlacombettu/iaf-pymc-optimizer
I would love to hear any feedback from the core devs or anyone experimenting with JAX-based VI on whether this neural architecture is useful.
All reactions