Double Control Variates for Gradient Estimation in Discrete Latent Variable Models

Michalis K. Titsias, Jiaxin Shi

Abstract

Stochastic gradient-based optimization for discrete latent variable models is challenging due to the high variance of gradients. We introduce a variance reduction technique for score function estimators that makes use of Double Control Variates (Double CV). These control variates act on top of a main control variate to further reduce the variance of the overall estimator. We develop a double control variate for the REINFORCE leave-one-out (RLOO) estimator using Taylor expansions. For training discrete latent variable models, such as variational autoencoders (VAEs) with binary latent variables, our approach adds no extra computational cost compared to standard training with RLOO. We show that our estimator can have lower variance compared to other state-of-the-art estimators across high-dimensional toy examples and VAE benchmarks.

The Challenge of Discrete Latents

In deep learning, optimizing models with discrete hidden variables (e.g., binary choices) is difficult because the standard backpropagation algorithm requires smooth, continuous functions. When latent variables are discrete, researchers typically use the REINFORCE algorithm. However, REINFORCE is notorious for high variance; the gradient signal is often drowned out by noise, leading to slow or unstable training.

To combat this, "control variates" or baselines are used to subtract noise. A popular modern baseline is RLOO (REINFORCE Leave-One-Out), which uses the average of other samples in a batch to stabilize the current sample. While effective, RLOO has a theoretical floor on how much variance it can reduce. This paper introduces a way to stack an additional layer of control variates on top of RLOO to break through this limit.

Methods: The "Double" Control Variate

The proposed Double CV technique combines two types of baselines simultaneously:

  1. The RLOO Baseline: The standard approach of using other samples in the batch as a reference point.
  2. The Taylor Expansion Baseline: A new addition that uses a first-order Taylor expansion of the objective function to create a local linear approximation.

The "Free Lunch" Efficiency

Typically, adding more control variates increases computational cost due to extra function evaluations. However, for models like VAEs, the gradients needed for the Taylor expansion are already calculated during the standard backpropagation step used to update model parameters. By reusing these "latent gradients," Double CV achieves superior variance reduction with essentially the same computational footprint as the simpler RLOO.

Experimental Results

High-Dimensional Toy Problem

The authors first evaluated the method on a 200-dimensional synthetic maximization task. This environment tests the estimator's ability to provide clean signals in high-dimensional spaces where noise is most prevalent.

Figure 4: Optimization performance and gradient variance on a high-dimensional toy problem. Double CV (solid blue) achieves significantly lower variance and faster convergence than RLOO, DisARM, and MuProp.

As shown in the toy problem results, Double CV (solid blue line) consistently maintains the lowest gradient variance throughout training. This directly translates to faster optimization, with the average objective value $f(x)$ rising more rapidly than competing methods like DisARM or RLOO.

Variational Autoencoder Benchmarks

The method was further validated on standard VAE benchmarks: MNIST, Fashion-MNIST, and Omniglot. The researchers compared Double CV against RLOO, DisARM, and RELAX (a high-performing but computationally expensive estimator).

Figure 5: Gradient variance and training ELBO for Bernoulli VAEs. Double CV (blue) consistently outperforms RLOO (orange) and DisARM (green) in both variance reduction and final ELBO.

In these real-world benchmarks, Double CV consistently produced gradients with lower variance than RLOO and DisARM. While RELAX sometimes achieves even lower variance, Double CV is nearly twice as fast because it requires fewer evaluations of the objective function. Crucially, the lower variance of Double CV led to higher Training ELBO (Evidence Lower Bound) values, indicating that the models learned more accurate representations of the data.

Key Insights and Conclusion

  • Compositional Baselines: Control variates can be layered. Combining a batch-based baseline (RLOO) with a function-approximation baseline (Taylor) targets different noise sources.
  • Efficiency: By leveraging existing gradients from the backpropagation pass, Double CV provides a "free" performance boost for VAEs.
  • Robustness: The gains were observed across different datasets and sample sizes, proving that Double CV is a robust alternative to standard estimators.

Double CV represents a significant step forward in training discrete latent variable models, offering state-of-the-art variance reduction without the computational penalties typically associated with advanced gradient estimators.

Summary updated

BibTeX
@inproceedings{titsias2022double,
  author = {Michalis K. Titsias and Jiaxin Shi},
  title = {{Double Control Variates for Gradient Estimation in Discrete Latent Variable Models}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2022},
  url = {https://openreview.net/forum?id=z9cM5UaQuv},
}
Figure