Stochastic Variational Inference with Tuneable Stochastic Annealing

John Paisley, Ghazal Fazelnia, Brian BarrarXiv 2025 · DOI

This paper presents a clever modification to Stochastic Variational Inference (SVI) that solves a fundamental trade-off in how we train large-scale Bayesian models. By decoupling the actual amount of data processed from the amount of "noise" injected during training, the authors introduce a method called SVI+ that helps models escape poor local optima more effectively than standard techniques.

TL;DR

SVI+ is a "zero-overhead" modification to Stochastic Variational Inference that allows users to tune the amount of stochastic annealing independently of the batch size. By injecting controlled, Gaussian-like noise into the gradients, it enables the use of large, stable batches while maintaining the exploratory benefits of small, noisy ones.

What Problem Does This Paper Address?

In Bayesian modeling, we often use Variational Inference (VI) to approximate complex posterior distributions. To handle massive datasets, we use Stochastic Variational Inference (SVI), which updates model parameters using small "mini-batches" of data.

SVI has a hidden superpower: the noise created by subsampling the data acts as a form of annealing, helping the optimizer bounce out of "bad" local optima (suboptimal solutions) toward better ones. However, researchers face a "Catch-22":

  1. Small batches provide high noise (good for exploration) but the noise is "spiky" and non-Gaussian, which can lead to instability.
  2. Large batches produce stable, Gaussian-like noise (good for theory and convergence) but have very low variance, meaning the model gets stuck in the first local optimum it finds.

The authors tackle this gap by asking: Can we have the high-quality Gaussian noise of a large batch with the high-variance exploratory power of a small batch?

Methods

The authors introduce SVI+, which operates within the Conjugate Exponential Family (CEF) framework. The core idea is to define two different batch sizes:

  • Actual Batch Size ($|S_t|$): The number of data points actually processed (can be large for stability).
  • Effective Batch Size ($M$): A smaller target size that determines how much noise (annealing) we want.

Instead of just calculating the gradient, SVI+ adds a specifically calibrated, one-dimensional noise term to the "sufficient statistics" of the model.

The "Aha!" Implementation: Rather than calculating a complex covariance matrix (which would be computationally expensive), the authors prove that they can achieve the same effect by simply multiplying the statistics of each data point by a random scalar: $(1 + \epsilon_n - \bar{\epsilon})$. This makes the algorithm incredibly easy to implement—it’s essentially a one-line change to existing SVI code with virtually no extra computational cost.

Datasets

The authors evaluated SVI+ across three distinct machine learning tasks:

  1. Collaborative Filtering: Using the MovieLens (1M and 10M) datasets to predict user ratings via Probabilistic Matrix Factorization.
  2. Topic Modeling: Using The New York Times dataset (approx. 287k articles) to learn topics via Latent Dirichlet Allocation (LDA).
  3. Clustering: Using Synthetic 2D data and the Pima Indians Diabetes dataset for Gaussian Mixture Models (GMM), including a nonparametric version using a Dirichlet Process.

Key Insights and Ideas

  • SVI is Implicit Annealing: The paper formalizes the idea that SVI isn't just a way to handle big data; it’s a way to do better optimization through noise.
  • Gaussianity Matters: The authors argue (and show via the Central Limit Theorem) that Gaussian noise is the "maximum entropy" noise. By making the noise more Gaussian through larger actual batches, the optimizer behaves more predictably while still exploring the parameter space.
  • Improving Batch VI: Interestingly, SVI+ can be used even when you aren't doing stochastic updates. You can process the entire dataset (Batch VI) but inject SVI+ noise to help the model find better solutions than standard Batch VI ever could.
  • The "Effective" Variance: By tuning the parameter $M$, researchers can precisely control the "temperature" of the optimization, gradually reducing the noise (annealing) as the model converges.

Key Results

  • Better Optima: In Matrix Factorization tests, SVI+ consistently found lower (better) variational objectives than standard batch inference, even when using the same amount of data.
  • Superior to Small Batches: In LDA experiments, SVI+ with a batch size of 1000 and an effective size of 50 outperformed standard SVI using an actual batch size of 50. This proves that Gaussian noise of a certain variance is more effective than the raw noise of a small batch.
  • Clustering Accuracy: In Dirichlet Process models, SVI+ was significantly more accurate at recovering the true number of clusters (4) compared to Batch VI (which over-estimated) and standard SVI (which under-estimated).

Limitations and Future Work

  • Model Constraints: The mathematical derivation relies on the model being in the Conjugate Exponential Family. While this covers many popular models (LDA, GMM, PMF), it doesn't directly apply to "deep" non-conjugate models without further approximation.
  • Hyperparameter Tuning: Users must still choose an annealing schedule for the effective batch size $M$. While the paper suggests some heuristics (like $M_t = 50t$), finding the optimal schedule for a new problem remains an experimental task.
  • Extension to Neural Networks: The authors briefly mention that this could be applied to backpropagation in neural networks, but they do not provide empirical results for deep learning architectures in this specific paper.

Summary updated

BibTeX
@misc{paisley2025stochastic,
  author = {John Paisley and Ghazal Fazelnia and Brian Barr},
  title = {{Stochastic Variational Inference with Tuneable Stochastic Annealing}},
  year = {2025},
  eprint = {2504.03902},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.03902},
}
Figure