Variational Inference with Gaussian Score Matching

Chirag Modi, Charles Margossian, Yuling Yao, Robert Gower, David Blei +1 more
7/15/2023
stat.MLcs.LG

Official code: roualdes/bridgestan (119 stars, BSD-3-Clause, last commit 2026-05-01). 1 more implementation below.

Abstract

Variational inference (VI) is a method to approximate the computationally intractable posterior distributions that arise in Bayesian statistics. Typically, VI fits a simple parametric distribution to the target posterior by minimizing an appropriate objective such as the evidence lower bound (ELBO). In this work, we present a new approach to VI based on the principle of score matching, that if two distributions are equal then their score functions (i.e., gradients of the log density) are equal at every point on their support. With this, we develop score matching VI, an iterative algorithm that seeks to match the scores between the variational approximation and the exact posterior. At each iteration, score matching VI solves an inner optimization, one that minimally adjusts the current variational estimate to match the scores at a newly sampled value of the latent variables. We show that when the variational family is a Gaussian, this inner optimization enjoys a closed form solution, which we call Gaussian score matching VI (GSM-VI). GSM-VI is also a ``black box'' variational algorithm in that it only requires a differentiable joint distribution, and as such it can be applied to a wide class of models. We compare GSM-VI to black box variational inference (BBVI), which has similar requirements but instead optimizes the ELBO. We study how GSM-VI behaves as a function of the problem dimensionality, the condition number of the target covariance matrix (when the target is Gaussian), and the degree of mismatch between the approximating and exact posterior distribution. We also study GSM-VI on a collection of real-world Bayesian inference problems from the posteriorDB database of datasets and models. In all of our studies we find that GSM-VI is faster than BBVI, but without sacrificing accuracy. It requires 10-100x fewer gradient evaluations to obtain a comparable quality of approximation.

View on arXivView PDF

Code Implementations(2)

BSD-3-Clause

BridgeStan provides efficient in-memory access through Python, Julia, and R to the methods of a Stan model.

11915C, RSep 6, 20225 months agoBSD-3-Clause
ccppjuliapythonr+1 more
modichirag/GSM-VIOfficial100%
MIT

Code for Gaussian Score Matching Variational Inference

345PythonJul 7, 20231 years agoMIT

Similar Papers

Cite this paper

@article{modi2023variational,
  title  = {Variational Inference with Gaussian Score Matching},
  author = {Chirag Modi and Charles Margossian and Yuling Yao and Robert Gower and David Blei and Lawrence Saul},
  year   = {2023},
  eprint = {2307.07849},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2307.07849v1},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2307.07849.svg)](https://codeofpaper.com/paper/2307.07849)

Discussion