Improved Gradient-Based Optimization Over Discrete Distributions

Evgeny Andriyash, Arash Vahdat, William G. MacreadyarXiv 2018

Abstract: In many applications we seek to maximize an expectation with respect to a distribution over discrete variables. Estimating gradients of such objectives with respect to the distribution parameters is a challenging problem. We analyze existing solutions including finite-difference (FD) estimators and continuous relaxation (CR) estimators in terms of bias and variance. We show that the commonly used Gumbel-Softmax estimator is biased and propose a simple method to reduce it. We also derive a simpler piece-wise linear continuous relaxation that also possesses reduced bias. We demonstrate empirically that reduced bias leads to a better performance in variational inference and on binary optimization tasks.

Introduction

Deep learning relies heavily on gradient-based optimization via backpropagation. For continuous random variables, the "reparameterization trick" allows gradients to pass through stochastic nodes. However, when a model requires discrete random variables—such as binary latent spaces in Variational Autoencoders (VAEs), categorical choices in language models, or binary decisions in combinatorial optimization—the cumulative distribution function becomes a step function. These step functions have zero gradients almost everywhere, effectively breaking the backpropagation process.

Researchers typically use two main approaches to bypass this: Finite-Difference (FD) or Score Function Estimators (e.g., REINFORCE), which are unbiased but suffer from high variance; and Continuous Relaxations (CR) (e.g., Gumbel-Softmax), which are fast and low-variance but introduce bias by fundamentally altering the objective function. This paper addresses the bias-variance-computation tradeoff by proposing methods to reduce the computational cost of unbiased methods and mathematically remove bias from continuous relaxations.

Proposed Methods

The authors introduce several modifications to existing techniques to improve optimization over discrete distributions:

  • Sampled RAM: The existing RAM estimator is unbiased but computationally expensive. The proposed sampled version evaluates gradients only for variables with a high probability of flipping, significantly reducing the number of required network evaluations.
  • Improved Gumbel-Softmax (IGSM): Standard Gumbel-Softmax is shown to be biased because it oversamples gradients from the most probable mode. By using a simple stop_gradient trick to center the relaxation, the authors create an Improved Continuous Relaxation (ICR) that is unbiased for single variables and exhibits reduced bias in multivariate cases.
  • Piece-Wise Linear (PWL) Relaxation: Instead of the smooth Gumbel-Softmax curve, this method uses a hard sigmoid (piece-wise linear function). It acts as an ICR, providing interpretable control over the bias-variance tradeoff.
  • RELAX+: This modification of the RELAX score-function estimator alters the objective penalty to achieve similar variance reduction at a significantly lower computational cost.
Comparison of Gumbel-Softmax (a) and Piecewise Linear (b) relaxations, along with gradient components (c).

Experimental Evaluation

The proposed estimators were tested across various domains:

  • Toy Datasets: Synthetic 1D binary and categorical functions demonstrated how estimator bias can trap models in suboptimal local minima.
  • Image Generation: Discrete VAEs were trained on MNIST and Omniglot. On linear architectures, IGSM and PWL significantly outperformed standard Gumbel-Softmax by avoiding entropy-inflating bias. On non-linear architectures, they matched or exceeded performance when combined with KL-annealing.
  • Combinatorial Optimization: On the NP-hard Maximal Clique problem (using the DIMACS dataset), standard Gumbel-Softmax often failed due to bias, while the less-biased ICR and PWL estimators reliably converged to superior solutions.

Key Insights

A critical finding is that the bias in Gumbel-Softmax can sometimes act as an accidental regularizer in non-linear VAEs, preventing latent units from "dying." However, the authors argue it is superior to use a low-bias estimator (like IGSM or PWL) and apply explicit, principled regularization like KL-annealing. Furthermore, the simple addition of stop_gradient in code can mathematically transform a biased relaxation into a vastly superior one. The paper also establishes a theoretical link between the REBAR estimator and their new ICR estimator.

Conclusion and Future Work

While the proposed methods offer significant improvements, trade-offs remain. Sampled RAM saves computation but can increase gradient variance. Additionally, achieving peak performance with continuous relaxations in VAEs may require "two-pass" training, which increases computational graph overhead. Future work could explore the application of these low-bias, piece-wise linear relaxations in reinforcement learning and discrete sequence generation, where gradient variance is a major bottleneck.

Summary updated

BibTeX
@misc{andriyash2018improved,
  author = {Evgeny Andriyash and Arash Vahdat and William G. Macready},
  title = {{Improved Gradient-Based Optimization Over Discrete Distributions}},
  year = {2018},
  eprint = {1810.00116},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1810.00116},
}
Figure