Automatic structured variational inference

Luca Ambrogioni, Kate Lin, Emily Fertig, Sharad Vikram, Max Hinne, Dave Moore, Marcel van Gerven

Abstract

Automatic Structured Variational Inference (ASVI) is a fully automated method for constructing structured variational distributions that mirror the architecture of a probabilistic program. By employing a "convex-update" rule inspired by conjugate Bayesian models, ASVI captures complex dependencies with the same time and space complexity as the original model. Experimental results demonstrate that ASVI significantly outperforms standard mean-field approaches in tracking non-linear dynamics and reconstructing high-dimensional image sequences.

Introduction

In Bayesian inference, the goal is to compute the posterior distribution of hidden variables given observed data. Because exact calculation is often intractable, Variational Inference (VI) is used to approximate the posterior by optimizing a simpler "variational family." The industry standard, the mean-field approximation, assumes all hidden variables are independent. While easy to automate, it often misses the underlying structure of the model, leading to inaccurate results. Conversely, manually derived structured variational families are powerful but require tedious, model-specific derivations. ASVI addresses this gap by automatically generating a structured variational family for any arbitrary probabilistic program without manual intervention.

Methods

The core innovation of ASVI is the convex-update variational family. In conjugate Bayesian models, posterior parameters are often a weighted average of prior parameters and data. ASVI mimics this behavior locally. For every latent variable $x_j$, ASVI defines its variational distribution by combining the parameters induced by its parents in the model's graph ($\theta_j$) with a learnable parameter ($\alpha_j$) using a convex combination:

$$u = \lambda \odot \theta_j + (1 - \lambda) \odot \alpha_j$$

Here, $\lambda$ is a learnable vector between 0 and 1. This allows the model to interpolate between the prior (when $\lambda = 1$) and a mean-field approximation (when $\lambda = 0$). Because this transformation follows the "forward pass" of the original program, the resulting variational family inherits the model's inherent dependencies without increasing computational complexity.

Results and Evaluation

ASVI was evaluated across diverse challenges, including the Inference Gym benchmark and high-dimensional image sequences from CIFAR-10 and FashionGEN.

Tracking Complex Dynamics

In the Stochastic Lorenz task, which involves non-linear dynamics, standard mean-field and even large Inverse Autoregressive Flows (IAF) failed to track the latent state. ASVI was the only method capable of successfully inferring the latent series by capitalizing on the strong prior structure of the system.

ASVI successfully tracks the latent state of the Stochastic Lorenz system, whereas Mean Field and Large IAF fail to capture the dynamics.

High-Dimensional Image Reconstruction

In deep Bayesian smoothing experiments, ASVI was used to reconstruct image sequences generated via Neural SDEs and DCGANs. ASVI produced visibly higher-quality reconstructions compared to mean-field and linear coupling baselines, demonstrating its utility in complex, deep-learning-integrated workflows.

Reconstruction results on CIFAR-10 image sequences. ASVI provides higher fidelity reconstructions compared to Mean Field and Linear coupling methods.

Key Insights and Limitations

ASVI provides "structure for free" by ensuring the variational family respects the model's graph. Unlike multivariate Gaussian methods where parameters grow quadratically ($P^2$), ASVI’s parameters grow linearly ($2P$), making it highly scalable for deep learning applications.

However, ASVI primarily captures dependencies present in the prior. It cannot currently capture "explaining away" dependencies—correlations that arise between variables sharing a common child. Future work will focus on designing structured surrogates that efficiently capture these backward dependencies while maintaining the automation and efficiency of the ASVI framework.

Summary updated

BibTeX
@inproceedings{ambrogioni2021automatic,
  author = {Luca Ambrogioni and Kate Lin and Emily Fertig and Sharad Vikram and Max Hinne and Dave Moore and Marcel van Gerven},
  title = {{Automatic structured variational inference}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2021},
}
Figure