Paper commentary
Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation
Researchers compare four ways to backpropagate through stochastic binary neurons
- Problem Stochastic binary neurons output a hard 0 or 1, so their derivative is zero almost everywhere and backpropagation cannot pass a gradient through them.
- Method The paper compares four ways to get a usable gradient: an unbiased REINFORCE-style estimator for binary stochastic neurons, the STS unit that splits a binary stochastic part from a smooth part, noise injected into an otherwise differentiable graph (noisy rectifier), and a straight-through copy of the gradient. These are tested as gaters for a conditional computation layer on MNIST.
- Results On MNIST, the straight-through gater reached 1.39 test classification error, against 1.89 test for the stochastic binary neuron gater.
Why hard binary decisions block gradient flow
The paper focuses on stochastic binary neurons, which output 1 with a probability given by a sigmoid of their pre-activation. Computing the exact gradient of the loss averaged over every binary sampling would require summing over an exponential number of configurations, which is impractical.
Noise is still attractive in deep learning. Dropout multiplies unit outputs by binomial noise and works as a regularizer that slows training only modestly. The open question is whether noise whose amplitude depends on the signals in the graph can be trained through, and the paper asks whether estimators with possible bias and variance can still train such networks.
Four routes to a usable gradient
The first family is an unbiased estimator for stochastic binary neurons, which is a special case of REINFORCE. The third injects additive or multiplicative noise into a graph that is otherwise differentiable, and the fourth copies the gradient through the hard decision directly.
Perturbation methods are a precedent. Simultaneous Perturbation Stochastic Approximation picks a random perturbation vector and estimates the gradient from two loss evaluations, but it becomes unbiased only as the perturbations shrink towards zero.
Noisy rectifiers and the STS unit
The noisy rectifier computes a rectifier of its pre-activation plus zero-mean noise, and with logistic noise its probability of a positive output equals the sigmoid of the pre-activation. Its expected output equals the softplus of the pre-activation, which is a smooth function of that pre-activation.
The paper splits the rectifier's behaviour into an insensitive state, where the output is zero and the gradient is usually zero, and a sensitive state where gradients flow. Gradients still reach the unit occasionally, which can pull it out of the inactive state, but units whose basic state is inactive risk dying. The paper proposes adjusting each unit's bias so that its firing rate tracks a target, but the units do not report an experiment on this adjustment.
The STS unit computes p equal to the sigmoid of the pre-activation, draws a binomial sample with success probability equal to the square root of p, and divides the sample by the square root of p. Its expected output equals p, and the probability that the output is positive equals the square root of the sigmoid. For a differentiable function f of the output, the expectation of f(h) equals f(p) plus a term that is little-o of the square root of p as p approaches zero, so the STS unit is first-order equivalent to a smooth function in that regime.
An unbiased estimator for stochastic binary neurons
The neuron output is an indicator of a uniform noise variable exceeding the sigmoid of the pre-activation, and the loss depends on that output and on other noise sources. The estimator is the output error, \(h_i - \mathrm{sigm}(a_i)\), multiplied by the loss L, and its expectation equals the derivative of the expected loss with respect to \(a_i\).
The proof takes the expectation over the binary output, which gives a weighted sum of the loss values for output 1 and output 0 with sigmoid weights, and differentiates that sum. Expanding the estimator over the two values of the binary output yields the same expression, so the expected estimator equals the gradient. This is a special case of REINFORCE, where the reward is the loss and the sampled binary output is treated as a weighted target.
Subtracting a constant \(\bar L_i\) from the loss leaves the estimator unbiased, because the subtracted term has zero expectation given \(a_i\). The variance-minimizing constant is a ratio of two expectations, one weighted by the squared output error and the loss, and the other by the squared output error alone, so it is a weighted average of the loss values.
In practice this can be tracked with two running averages per neuron, and the update needs only the broadcast loss, with no backpropagation.
Straight-through as a biased shortcut
The straight-through estimator back-propagates through the hard threshold as if it were the identity, so the gradient with respect to the sampled output is used as the gradient with respect to the pre-sigmoid activation. A variant that multiplies this gradient by the derivative of the sigmoid was tried, but the version without that factor gave better results.
The estimator is clearly biased, and its sign is correct for a single layer of neurons, but this is not guaranteed when the gradient is back-propagated through more hidden layers.
Sparse gates for conditional computation
The main path has a large hidden layer whose units are multiplied element by element by gate outputs, so a gate of zero switches off the corresponding unit.
The gater reaches the main path through a bottleneck of size M, much smaller than N, so computing the gater output costs on the order of MN operations. Only the units whose gate is non-zero are computed, which reduces the main path cost from order N squared to order αN squared.
MNIST comparison of gater variants
Validation and test errors of the stochastic models were measured after a threshold was chosen on the deterministic counterpart used at test time.
The Baseline Sigmoid uses sigmoid outputs and tanh hidden units with no sparsity constraint and only 200 output units, and it reached 1.97 validation and 1.92 test. Adding Gaussian noise to that sigmoid baseline gave 1.88 validation and 1.87 test, which the authors read as noise helping to fit the training objective as well as acting as a regularizer.
Each model has one reported value per split, and the table gives no variance, so differences of a few tenths of a percentage point are read as observed only in this single comparison. The train column lists training criteria, which are on a different scale and are not error rates, so it is not compared across models here.
Limitations
The straight-through estimator is biased, and its sign is only guaranteed for a single layer of neurons. The STS expansion is a first-order approximation that holds as the sigmoid probability approaches zero. Noisy rectifiers can die when the inactive state dominates, and the gradient asymmetry between active and inactive states makes such units hard to revive.
The experiments use only MNIST and a single gating layer, so the comparison does not cover other datasets or depths. The efficiency argument is a count of operations, and the paper reports no measured run time for the gated model.
Paper info
- Authors
- Bengio, Yoshua, Léonard, Nicholas, Courville, Aaron
- Venue
- arXiv · Preprint
- First published
- 2013-8-15
- Added
- 2026-11-12
- Updated
- 2013-8-15
- Version
- v1
- arXiv
- 1308.3432
- Category
- cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Bengio, Yoshua, Léonard, Nicholas, Courville, Aaron (2013). Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation. arXiv:1308.3432v1. https://arxiv.org/abs/1308.3432v1
BibTeX
@misc{yoshua2013estimating,
title = {{Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation}},
author = {Bengio, Yoshua and Léonard, Nicholas and Courville, Aaron},
year = {2013},
eprint = {1308.3432},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1308.3432v1}
}