metabeta -- A fast neural model for Bayesian mixed-effects regression
Alex Kipnis, Marcel Binz, Eric Schulz
TL;DR
Hierarchical data analysis via Bayesian mixed-effects regression is often hindered by the computational burden of MCMC. metabeta addresses this by training a transformer-based neural posterior estimator on simulated data with varying priors, using a two-network architecture (global and local summaries) and a normalizing-flow posterior to approximate p(\vartheta|D) efficiently; post-hoc importance sampling and conformal calibration further refine and correct credible intervals. Empirical results on toy, in-distribution, and out-of-distribution data show metabeta achieves accuracy comparable to, and sometimes exceeding, Hamiltonian Monte Carlo, while offering orders-of-magnitude faster inference and robust uncertainty quantification. The approach enables rapid prototyping and deployment of Bayesian mixed-effects models with prior information, and open-source tooling is planned to facilitate broad adoption and extension to larger problems and predictor-attention enhancements. Overall, metabeta broadens the practical applicability of Bayesian mixed-effects regression by combining amortized inference with principled uncertainty calibration.
Abstract
Hierarchical data with multiple observations per group is ubiquitous in empirical sciences and is often analyzed using mixed-effects regression. In such models, Bayesian inference gives an estimate of uncertainty but is analytically intractable and requires costly approximation using Markov Chain Monte Carlo (MCMC) methods. Neural posterior estimation shifts the bulk of computation from inference time to pre-training time, amortizing over simulated datasets with known ground truth targets. We propose metabeta, a transformer-based neural network model for Bayesian mixed-effects regression. Using simulated and real data, we show that it reaches stable and comparable performance to MCMC-based parameter estimation at a fraction of the usually required time.
