The limited-memory recursive variational Gaussian approximation (L-RVGA)

Marc Lambert, Silvère Bonnabel, Francis R. BachStat. Comput 2023

Abstract

We consider the problem of computing a Gaussian approximation to the posterior distribution of a parameter given a large number $N$ of observations and a Gaussian prior, when the dimension of the parameter $d$ is also large. To address this problem we build on a recently introduced recursive algorithm for variational Gaussian approximation of the posterior, called recursive variational Gaussian approximation (RVGA), which is a single pass algorithm, free of parameter tuning. In this paper, we consider the case where the parameter dimension $d$ is high, and we propose a novel version of RVGA that scales linearly in the dimension $d$ (as well as in the number of observations $N$), and which only requires linear storage capacity in $d$. This is afforded by the use of a novel recursive expectation maximization (EM) algorithm applied for factor analysis introduced herein, to approximate at each step the covariance matrix of the Gaussian distribution conveying the uncertainty in the parameter. The approach is successfully illustrated on the problems of high dimensional least-squares and logistic regression, and generalized to a large class of nonlinear models.

Introduction

In Bayesian machine learning, the objective is to recover the full posterior distribution of model parameters to quantify uncertainty. However, exact inference is often computationally intractable for complex models. Variational Gaussian Approximation (VGA) serves as a popular alternative by fitting a Gaussian distribution to the posterior.

Despite its utility, VGA faces a significant hurdle: the "curse of dimensionality." For a parameter vector of dimension $d$, a full covariance matrix contains $d^2$ elements. In modern applications where $d$ may reach millions, storing and updating such a matrix requires prohibitive amounts of memory and compute. While recursive methods like RVGA address the challenge of large observation counts ($N$), they still struggle with high-dimensional parameters. This paper introduces L-RVGA, a memory-efficient, tuning-free algorithm designed to handle both large-scale data and high-dimensional models by achieving linear scaling in both $N$ and $d$.

Methods

L-RVGA utilizes a two-stage variational approximation strategy to maintain computational efficiency without sacrificing the benefits of recursive updates.

1. Gaussian and Factor Analysis Projections

The algorithm first projects the posterior onto the space of Gaussian distributions via a recursive update. To manage the dimensionality of the covariance, it then projects this Gaussian onto a restricted space where the precision matrix (the inverse of the covariance) follows a "low rank + diagonal" structure: $P^{-1} \approx WW^T + \Psi$. This structure allows the model to capture essential correlations while maintaining a compact representation.

2. Recursive EM for Factor Analysis

A core innovation is the development of a recursive Expectation-Maximization (EM) algorithm for factor analysis. This parameter-free approach updates the low-rank components ($W$) and diagonal components ($\Psi$) without ever explicitly constructing the full $d \times d$ matrix. By leveraging the Woodbury matrix identity, the algorithm can invert high-dimensional matrices by performing operations only on the small $p \times p$ latent space (where $p \ll d$).

3. Stability and Nonlinearity

To handle nonlinear models, L-RVGA employs a Generalized Gauss-Newton (GGN) approximation, which approximates the Hessian using an outer product of gradients. To stabilize the implicit updates inherent in the recursive scheme, the authors adopt a "Mirror Prox" (extra-gradient) approach. This two-step "look-ahead" update significantly reduces estimator bias and ensures convergence in scenarios where simpler schemes might fail.

4. Efficient Sampling

The framework includes a novel sampling scheme that allows for drawing samples from a Gaussian with a structured precision matrix in $O(d)$ time. This avoids the need for expensive Cholesky decompositions or full matrix inversions.

Experimental Results

The authors evaluated L-RVGA across synthetic benchmarks and real-world datasets, including NIPS Madelon and Breast Cancer classification tasks.

Scalability and Memory Efficiency

In a high-dimensional stress test with $d = 10^6$ parameters, a standard batch EM approach would require approximately 8,000 GB of RAM. In contrast, L-RVGA (with rank $p=100$) successfully ran on a standard laptop using only 0.8 GB of RAM. This demonstrates a massive reduction in hardware requirements for high-dimensional Bayesian inference.

Performance and Accuracy

L-RVGA typically converges in a single pass through the data, matching the performance of batch methods that require multiple iterations. On the Madelon and Breast Cancer datasets, L-RVGA achieved lower KL divergence compared to standard online EM variants. Furthermore, in logistic regression tasks, the method proved more robust than the traditional Laplace approximation, which often fails to capture the true shape of non-Gaussian posteriors.

Discussion and Conclusion

L-RVGA provides a scalable solution for Bayesian inference in high-dimensional settings. By combining recursive variational inference with a structured factor analysis approach, it transforms supercomputer-level problems into tasks manageable on standard hardware.

However, some limitations remain. The algorithm can be sensitive to the initial prior variance ($\sigma_0$), and like many variational methods, it may underestimate the true width of the posterior. Future work involves incorporating "process noise" to adapt to non-stationary data and exploring L-RVGA as a mechanism for adaptive learning rates in general stochastic optimization, potentially serving as a second-order alternative to methods like L-BFGS.

Summary updated

BibTeX
@inproceedings{lambert2023limited,
  author = {Marc Lambert and Silvère Bonnabel and Francis R. Bach},
  title = {{The limited-memory recursive variational Gaussian approximation (L-RVGA)}},
  booktitle = {Stat. Comput},
  year = {2023},
  url = {https://openreview.net/forum?id=URuOuPVJYH},
}
Figure