Bias-Variance Tradeoffs in Single-Sample Binary Gradient Estimators

Alexander Shekhovtsov

Abstract

Training models with discrete components—such as Variational Autoencoders (VAEs) with binary latents or Binarized Neural Networks (BNNs)—requires gradient estimators to bypass non-differentiable threshold functions. This paper performs a theoretical autopsy on several state-of-the-art single-sample binary gradient estimators, including Gumbel-Softmax, BayesBiNN, and FouST. The analysis reveals that many "advanced" methods suffer from exploding variance or hidden implementation quirks that effectively reduce them to simple, deterministic variants of the classic Straight-Through (ST) estimator. We find that the ST estimator remains a remarkably robust baseline, often outperforming more complex alternatives in practical deep learning regimes.

Introduction

The "non-differentiable" nature of bits presents a fundamental challenge in deep learning. To train models with binary variables, researchers typically employ "stochastic relaxation," treating discrete bits as probabilities. While unbiased estimators like REINFORCE exist, their prohibitively high variance in deep networks makes them impractical. This has led to the proliferation of biased, single-sample estimators that offer a tradeoff: lower variance at the cost of some bias. However, the theoretical foundations of these tradeoffs have remained murky. This work provides a rigorous evaluation of whether these biased methods actually deliver on their promises.

The Bias-Variance Landscape

The core of the challenge lies in navigating the Pareto frontier between bias and variance. Unbiased estimators sit at one extreme, while deterministic variants of the Straight-Through (ST) estimator sit at the other.

Figure 1: Conceptual map of the bias-variance tradeoff for various gradient estimators. Unbiased methods like REINFORCE suffer from high variance, while biased methods like ST and GS(τ) navigate the tradeoff along the Pareto frontier.

As shown in Figure 1, methods like REINFORCE and NVIL are unbiased but suffer from extreme variance. In contrast, the Straight-Through (ST) estimator and its variants occupy a region with lower variance but higher bias. The Gumbel-Softmax (GS) estimator attempts to bridge this gap by introducing a temperature parameter $\tau$, theoretically allowing a smooth transition between these regimes.

Methods: Asymptotic Analysis and Code Audits

The author employs asymptotic analysis, examining the behavior of estimators as parameters like temperature $\tau$ approach zero. This is supplemented by rigorous code audits of popular implementations. The study evaluates:

  • Gumbel-Softmax (GS) and ST-GS: Analyzing bias and variance scaling with temperature.
  • BayesBiNN: A Bayesian learning rule for BNNs.
  • FouST: Techniques based on Fourier analysis of Boolean functions.
  • DARN: An importance sampling-based estimator.

The Gumbel-Softmax Trap

A common assumption in the literature is that the Gumbel-Softmax (GS) estimator can be made arbitrarily accurate by lowering the temperature $\tau$. This paper proves that this is a mathematical "delusion."

Figure 2: Visualization of the stochastic relaxation process. As the temperature τ decreases, the sigmoid στ approaches a step function, which reduces bias but causes the gradient to vanish or explode.

While the bias of GS decreases at a rate of $O(\tau)$, the variance explodes at $O(1/\tau)$. In deep networks, this problem is compounded: the probability of observing a non-zero gradient during training vanishes at a rate of $O(\tau^L)$, where $L$ is the number of layers. Consequently, at low temperatures, the estimator becomes practically useless due to gradient sparsity and extreme variance.

Deconstructing "Advanced" Estimators

The paper further audits other popular methods, revealing surprising discrepancies between theory and practice:

BayesBiNN’s Secret Identity

BayesBiNN is marketed as a Bayesian learning rule for BNNs, often tested on CIFAR-10 and CIFAR-100. However, a code audit reveals a "hidden issue." At the low temperatures used in practice ($\tau=10^{-10}$), and due to a tiny technical "epsilon" in the implementation, the algorithm effectively ignores its stochastic nature. It collapses into a deterministic Straight-Through estimator with a specific weight decay term. Its success is likely due to the "forgetting" effect of this decay rather than its purported Bayesian properties.

FouST and DARN

Techniques based on Fourier analysis (FouST) were intended to reduce variance. However, the analysis shows that the "Fourier Noise Operator" actually increases variance compared to simple independent sampling and fails to reduce bias. Similarly, the DARN estimator, based on importance sampling, can exhibit higher bias than the simple ST estimator when units are near deterministic states (probabilities near 0 or 1).

The Enduring Utility of Straight-Through

Perhaps the most significant finding is that the "folklore" Straight-Through (ST) estimator remains a remarkably strong baseline. In wide, deep layers, models often behave linearly enough that ST is nearly unbiased and has zero variance. Furthermore, the ST-GS variant was proved to be asymptotically unbiased for quadratic functions—an improvement over standard ST—though it still suffers from variance explosion at low temperatures. Experimental verification on MNIST VAEs showed that while DARN had lower accumulated bias, it led to significantly more overfitting. This suggests that the bias inherent in the ST estimator may actually serve as a beneficial form of regularization.

Conclusion

This theoretical critique suggests that the search for a "silver bullet" gradient estimator may be misguided. Many complex methods work for reasons entirely different from their creators' claims, often defaulting to ST-like behavior in practice. Future research should focus on understanding the mechanisms—such as latent weight decay—that make deterministic ST variants so effective, rather than pursuing theoretically flawed stochastic relaxations.

Summary updated

BibTeX
@misc{shekhovtsov2021bias,
  author = {Alexander Shekhovtsov},
  title = {{Bias-Variance Tradeoffs in Single-Sample Binary Gradient Estimators}},
  year = {2021},
  eprint = {2110.03549},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.03549},
}
Figure