Rao-Blackwellized Stochastic Gradients for Discrete Distributions

Runjing Liu, Jeffrey Regier, Nilesh Tripuraneni, Michael I. Jordan, Jon D. McAuliffe

TL;DR

This paper introduces a novel meta-procedure, Rao-Blackwellization, to significantly reduce the variance of stochastic gradient estimators for discrete distributions without introducing bias. This technique is particularly effective when the probability mass of the distribution is concentrated on a few categories, offering substantial improvements in convergence and accuracy across various machine learning tasks.

What Problem Does This Paper Address?

Optimizing models often involves computing the gradient of an expectation over a discrete random variable. When the number of categories ($K$) is large or infinite, computing this expectation exactly becomes computationally intractable. Existing methods like the reparameterization trick don't directly apply to discrete variables. While techniques like continuous relaxation (e.g., Gumbel-softmax) and control variates (e.g., REINFORCE with control variates) exist to estimate these gradients, they either introduce bias or don't reduce variance sufficiently for many applications. This paper tackles the challenge of obtaining low-variance, unbiased gradient estimates for discrete distributions, especially in scenarios where the distribution is "sparse" (i.e., concentrated on a few categories).

Methods

The core contribution is a Rao-Blackwellization procedure that acts as a meta-algorithm. It can be applied to any existing unbiased stochastic gradient estimator for discrete distributions. The method works by identifying the categories with the highest probability mass under the current distribution ($q_n$). It then computes the contribution of these high-probability categories to the expectation exactly, while using a stochastic estimator for the remaining, lower-probability categories. This is achieved by decomposing the expectation into two parts: one for the "top-k" categories and one for the rest. The latter is then approximated using importance sampling from a conditional distribution.

The paper mathematically demonstrates that this procedure is an instance of Rao-Blackwellization, a statistical technique known to reduce variance without affecting bias. This means that if the original estimator is unbiased, the Rao-Blackwellized version remains unbiased. The variance reduction is shown to be proportional to the probability mass of the categories not summed out.

Datasets

The paper evaluates its method on several tasks:

  • Synthetic data: Used to illustrate the theoretical properties of the method.
  • Semi-supervised classification: Utilizes the MNIST dataset (50,000 training digits, 10,000 validation, 10,000 test; 5,000 labeled, 45,000 unlabeled).
  • Pixel attention task (Moving MNIST): Also uses the MNIST dataset, but focuses on learning the center of a non-centered digit.
  • N-mixture model: A simulated dataset for a countably infinite $K$ scenario.
  • Gaussian mixture model: A simulated dataset with $d=2$ dimensions and $K=10$ components.

No new benchmarks were introduced; existing datasets were used to compare against established methods.

Key Insights and Ideas

  • Rao-Blackwellization for discrete gradients: The paper elegantly extends a classical statistical technique to a modern machine learning problem, showing its power in reducing variance for discrete distributions.
  • Leveraging "sparsity": The method's effectiveness hinges on the probability mass of $q_n$ being concentrated on a few categories. This "sparsity" is precisely what allows for significant variance reduction by summing out those high-probability categories exactly.
  • Unbiasedness is preserved: A crucial theoretical guarantee is that the method does not introduce bias, making it a safe choice for gradient estimation where unbiasedness is critical.
  • "Anytime" algorithm: The procedure can be applied with any computational budget, offering greater variance reduction with more summed categories, making it flexible for different resource constraints.
  • Complementary to existing methods: It acts as a meta-procedure, enhancing existing estimators like REINFORCE and REINFORCE+ rather than replacing them.

Key Results

  • Bernoulli experiments: Rao-Blackwellization significantly reduced gradient variance, especially when the variational distribution was concentrated (at $\eta=-4$), leading to faster convergence. Summing out even one category removed nearly all the variance in this concentrated case.
  • Gaussian Mixture Model: The method improved convergence rates, with summing just three categories yielding an ELBO trajectory close to the exact gradient. It outperformed simple Monte-Carlo averaging for variance reduction.
  • Semi-supervised MNIST: Rao-Blackwellization (with one category summed) achieved comparable convergence and test accuracy (97%) to summing out all ten categories, but in significantly less time (18s/epoch vs. 31s/epoch).
  • Moving MNIST: The method achieved the fastest convergence and the smallest negative ELBO compared to other methods like RELAX, NVIL, and Gumbel-softmax, by effectively leveraging the fact that only a few digit positions have high probabilities.
  • Countably infinite K (N-mixture model): The method demonstrated improved convergence for a scenario with an infinite number of categories, showing its applicability beyond finite $K$.

Limitations and Future Work

  • Computational cost: While offering variance reduction, the Rao-Blackwellized estimator requires $k+1$ evaluations of the original estimator for $k$ summed categories. The paper notes this trade-off and shows that for a given budget, it can still outperform minibatching.
  • Multivariate discrete variables: The current work focuses on univariate discrete variables. The authors suggest extending the approach to multivariate discrete variables, potentially by combining it with existing methods for multivariate settings.
  • Structured discrete distributions: The paper points to future work in applying the technique to structured discrete distributions (e.g., in HMMs) by leveraging local expectation gradients to decompose complex expectations into univariate ones.

Summary updated

Abstract

We wish to compute the gradient of an expectation over a finite or countably infinite sample space having K $\leq$ $\infty$ categories. When K is indeed infinite, or finite but very large, the rele...
BibTeX
@inproceedings{liu2019rao,
  author = {Runjing Liu and Jeffrey Regier and Nilesh Tripuraneni and Michael I. Jordan and Jon D. McAuliffe},
  title = {{Rao-Blackwellized Stochastic Gradients for Discrete Distributions}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
}
Figure