Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Categorical Reparameterization with Gumbel-Softmax

Gumbel-Softmax lets gradients flow through categorical samples during training

  • Problem Stochastic networks rarely use categorical latent variables, because backpropagation cannot pass through a sampling step. Score function estimators avoid this but have high variance when there are many categories.
  • Method Gumbel-Softmax replaces the arg max in the Gumbel-Max trick with a softmax. This gives a differentiable sample that can be annealed toward a true categorical sample.
  • Results On categorical structured prediction, Gumbel-Softmax scored 59.0 nats, compared to 61.1 for Slope-Annealed ST.

Why categorical latent variables are hard to train

Stochastic networks with discrete latent variables appear in unsupervised learning, language modeling, attention and reinforcement learning. The trouble is that backpropagation computes parameter gradients efficiently but can't pass through a non-differentiable sampling layer. Existing estimators fall into two families: score function estimators with Monte Carlo variance reduction, and biased path derivative estimators built for Bernoulli variables.

The score function estimator never backpropagates through the sample, but its variance grows with the number of sample dimensions, which hurts categorical variables. No earlier gradient estimator was formulated specifically for categorical variables, and that gap is the one this paper addresses.

Replacing the sample with a Gumbel-Softmax draw

The key idea is to keep the Gumbel-Max trick, which draws exact categorical samples, and replace its arg max with a softmax, which is differentiable. The result is a continuous vector on the simplex, so gradients can flow back to the class probabilities. The Gumbel-Max trick adds independent Gumbel(0, 1) noise to each log-probability and takes the arg max to get a one-hot sample.

Gumbel(0, 1) noise can be drawn by sampling u from a uniform distribution and computing g = -log(-log(u)).

The softmax sample is computed as follows, for i = 1, ..., k. \[ y_i = \frac{\exp((\log \pi_i + g_i)/\tau)}{\sum_{j=1}^{k} \exp((\log \pi_j + g_j)/\tau)} \] The temperature tau divides the perturbed logits before the softmax, so it sets how close the sample sits to a one-hot corner. As tau approaches zero, the samples become one-hot and the distribution matches the categorical distribution, which the authors show in their density derivation.

Small temperatures give samples close to one-hot but high gradient variance, while large temperatures give smooth samples with low variance. The authors therefore start at a high temperature and anneal it to a small but non-zero value during training. For structured output prediction they kept tau fixed at 1, because annealing wasn't needed there.

Discrete forward pass with a continuous backward pass

For discrete actions or quantized codes, the Straight-Through variant takes the arg max of the relaxed sample in the forward pass. The backward pass still uses the continuous approximation, so the gradient of z is approximated by the gradient of y. This resembles the biased path derivative estimator of Bengio et al., and ST samples can stay sparse even at high temperature.

Chung et al.'s slope-annealed variant sets its slope with a hard sigmoid, whereas ST Gumbel-Softmax uses a softmax for the same role. The plain Straight-Through estimator can suffer when backpropagating through the sample-independent mean makes the forward and backward passes disagree. Because each Gumbel-Softmax sample is a differentiable proxy of the discrete sample, this disagreement doesn't arise in the same way.

Score function and control variate baselines

The score function estimator uses the identity for the gradient of a log-probability and needs no backpropagation through f or the sample. A control variate can be subtracted from the learning signal, provided its analytical expectation is added back to keep the estimator unbiased. NVIL uses a moving-average baseline and an input-dependent baseline network, while variance normalization divides the signal by max(1, sigma_f).

DARN uses a first-order Taylor baseline around the mean of the sample, and it fixes z at 1/2 for Bernoulli variables. MuProp uses the same Taylor baseline and replaces the discrete learning signal with a mean-field approximation. VIMCO was left out because the experiments focus on single-sample objectives.

Variance normalization was needed for the score function, DARN and MuProp estimators to be competitive in these experiments.

Structured output prediction results

The task predicts the lower half of a 28×28 binarized MNIST digit from its top half, using a stochastic binary network with two hidden layers of 200 units each. The network has either 200 Bernoulli variables or 20 categorical variables with 10 classes each. Training used one importance sample per step, and evaluation used 1000 samples.

With Bernoulli latent variables, Gumbel-Softmax scored 58.5 nats, compared to 58.7 for Slope-Annealed ST and 58.9 for MuProp. The margin is small here, so the Bernoulli case shows parity rather than a clear advantage.

With categorical latent variables, Gumbel-Softmax scored 59.0 nats, compared to 61.1 for Slope-Annealed ST and 63.0 for MuProp. ST Gumbel-Softmax scored 59.7 on the same categorical setup, while the plain score function estimator came to 73.1. The authors read the gap as evidence that the single-sample relaxation suits categorical variables.

Learning rates were picked from six values using the MNIST validation set, and the test set was used only for reporting.

Variational autoencoder results

The authors train VAEs on binarized MNIST with either 200 Bernoulli latent variables or 20 categorical variables with 10 classes each. They use a learned categorical prior instead of a Gumbel-Softmax prior in the training objective. The temperature is set to max(0.5, exp(-rt)) and updated every N steps, with N and r chosen on the validation set.

Evaluation uses a multi-sample bound with 1000 samples.

With categorical latent variables, Gumbel-Softmax gave a negative variational lower bound of 101.5 nats, compared to 107.0 for MuProp and 107.8 for Slope-Annealed ST. On Bernoulli latent variables it gave 105.0, compared to 109.7 for MuProp. Lower bound values are better here, so these gaps favour Gumbel-Softmax on both latent types.

Semi-supervised classification and training speed

Marginalization sums the unlabeled objective over all k classes, so its cost per step is \( O(D + k(I+G)) \). Here D, I and G are the costs of sampling q(y|x), sampling q(z|x,y) and evaluating p(x|y,z). Gumbel-Softmax backpropagates through a single sample from q(y|x), so its cost is \( O(D + I + G) \) per step.

The experiment used 100 labeled examples, spread evenly over 10 classes, and 50,000 unlabeled examples with dynamic binarization. Marginalization reached a bound of -106.8 and 92.6% accuracy, while Gumbel-Softmax reached -109.6 and 92.4%. ST Gumbel-Softmax gave the highest accuracy at 93.6%, with a bound of -110.7. So single-sample inference keeps accuracy close to marginalization, with a slightly lower bound.

Speed was measured in training steps per second on random labels, using a GTX Titan X GPU. The alpha weight was searched over five values for each estimator, and the annealing schedule was updated every 2000 steps.

Limitations

Temperature trades bias against variance, and the authors report that several annealing schedules worked without giving a rule for choosing one. Gumbel-Softmax samples differ from categorical samples at any non-zero temperature.

With a learned categorical prior, the training objective is no longer a variational bound when samples aren't discrete. The authors report that annealing still tightened the true bound on validation and test sets.

On categorical VAE latent variables, the ST Gumbel-Softmax bound of 107.8 matches Slope-Annealed ST and trails MuProp's 107.0. So the advantage for categorical VAEs belongs to the plain Gumbel-Softmax estimator, not the ST variant.

All three experiment families use binarized MNIST. The semi-supervised speed comparison used randomly generated labels.

Paper info

Authors
Eric Jang, Shixiang Gu, Ben Poole
Venue
arXiv · Preprint
First published
2016-11-3
Added
2026-11-11
Updated
2017-8-5
Version
v5
arXiv
1611.01144
Category
stat.ML · 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

Eric Jang, Shixiang Gu, Ben Poole (2016). Categorical Reparameterization with Gumbel-Softmax. arXiv:1611.01144v5. https://arxiv.org/abs/1611.01144v5

BibTeX
@misc{jang2016categorical,
  title = {{Categorical Reparameterization with Gumbel-Softmax}},
  author = {Eric Jang and Shixiang Gu and Ben Poole},
  year = {2016},
  eprint = {1611.01144},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.01144v5}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up