# The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables

Concrete relaxations let gradients flow through discrete random variables during training

Maddison, Chris J., Mnih, Andriy, Teh, Yee Whye · arXiv · 2016-11-2

- **Problem** Gradient training of stochastic graphs stalls at discrete nodes, because reparameterization needs a sample that changes smoothly with the parameters. Discrete states jump, so no such map exists for them.
- **Method** The Concrete distribution replaces each one-hot discrete node with a softmax of Gumbel-perturbed logits at a fixed temperature. Gradients flow through these continuous samples during training, and the discrete graph is restored at test time.
- **Results** On MNIST density estimation with a two-hidden-layer model at m equal to 1, Concrete reached 87.9 test NLL against 88.4 for VIMCO.

## Why discrete nodes resist reparameterization

Reparameterization writes a sample as a deterministic function of the parameters and of noise whose distribution does not depend on them, so an automatic differentiation library can differentiate through the sample. This works smoothly for continuous latent variables, but a discrete state changes in jumps as the parameters move, so no comparable map exists for it.

Score function estimators avoid needing a differentiable sample by using the gradient of the log-density, so they apply to discrete variables as well. Their basic form can have high variance, which is why baselines and other variance reduction methods are standard practice. Straight-through estimators pass discrete values forward and take gradients through an expected value; they perform well in practice, but they have not been shown to be the gradients of any loss function.

The authors take a different route: during training each discrete node is treated as a continuous vector on the simplex, so gradients flow through its states, and the discrete graph is restored for evaluation.

## From the Gumbel-Max trick to a softmax relaxation

A one-hot discrete variable can be sampled by adding Gumbel noise to the log-weights of its states and taking the arg max. Each state is scored by its log-weight minus the log of the negative log of a uniform draw, and the highest score selects the one-hot state. The probability that state k is selected equals its weight divided by the sum of all weights, so the sampler reproduces the discrete distribution.

The arg max is the obstacle. Its derivative is zero everywhere except where the selected state changes, and it is undefined there, so automatic differentiation cannot use it directly. The Concrete construction keeps the same computation graph and replaces the arg max with a softmax at temperature λ, so the sample becomes a probability vector in the interior of the simplex rather than a vertex.

A sample is formed by adding Gumbel noise G\_k to log α\_k, dividing by λ, and normalizing with a softmax across the n states. As λ approaches zero the softmax approaches the arg max while keeping the relative order of the perturbed logits, so large temperatures give smooth vectors and small temperatures give nearly one-hot ones. The authors take the density of this random vector as its definition: a closed form on the simplex, indexed by the location α and the temperature λ.

Proposition 1 connects this density to the sampler and to the discrete distribution. The sampler and the density describe the same distribution, rounding a Concrete sample selects state k with probability α\_k divided by the sum of the α\_i, and the zero-temperature limit gives the same probabilities. The density is log-convex in x when λ is at most (n-1) to the power minus one, and at such temperatures the authors state that no interior modes arise for any α.

In the binary case the Gumbel-Max trick passes noise through a step function, and the Concrete relaxation passes it through a sigmoid instead.

## Placing Concrete nodes inside a variational objective

The worked case is a variational autoencoder whose latent variable is a one-hot discrete vector d over n states, with unnormalized prior weights a and an approximate posterior whose unnormalized weights depend on the input x. The bound contains log-probability terms for both the prior and the posterior, so those terms have to be handled alongside the sampled state.

Substituting a Concrete sample into the bound without changing anything else does not give an interpretable objective, because the resulting ratio of prior and posterior terms is not a KL divergence and need not lower-bound the log-likelihood. The authors instead relax the prior and posterior terms as well, using the Concrete density with location α(x) and temperature λ1 for the posterior and with location a and temperature λ2 for the prior.

During training each discrete node becomes a Concrete node at a fixed temperature or under an annealing schedule, and the parameters of the relaxed graph and the discrete graph coincide. At test time the original discrete objective is evaluated, which is possible because a Concrete distribution has a closed form mass function once discretized and every discrete distribution has a closed form Concrete density.

This does not hold in general: the multinomial probit, which is the Gumbel-Max trick with Gaussians in place of Gumbels, has no closed form mass.

The temperature decides how far relaxed samples can settle in the interior of the simplex. If relaxed nodes can represent precise real values in the interior, they can carry more than log2(n) bits about their parameters, which can lead to an integrality gap between the relaxed and the discrete model. The authors treat Proposition 1 d as a conservative guide for general n-ary relaxations and leave the best temperature to empirical choice.

## Tasks, datasets and baselines

The experiments cover density estimation and structured output prediction, both fitting distributions with hundreds of latent discrete nodes. Concrete reparameterizations are compared with VIMCO for the multisample objective when m is greater than 1, and with NVIL for the single-sample objective when m equals 1.

The data are the MNIST and Omniglot images, both 28×28 pixels, of handwritten digits and letters. MNIST uses a fixed binarization and a split of 50,000/10,000/10,000 into training, validation and testing sets, and Omniglot uses a fixed binarization and a split of 24,345/8,070 into training and testing sets.

The models stack layers of n-ary discrete nodes whose states sit on the corners of a hypercube, and each state distribution is parameterized by n logits. Model names such as 200H∼784V read in the order of conditional sampling, with V for observed and H for latent layers, a dash for a linear dependence on the previous layer and a tilde for a nonlinear one.

Models were initialized with the heuristic of Glorot and Bengio, optimized with Adam, and trained with temperatures fixed throughout training.

## Density estimation results

Density estimation trains the latent variable model with the multisample objective for m in {1, 5, 50}, and the NLL is approximated with L50,000 averaged over the whole dataset. In Table 1, the linear rows favour VIMCO on test NLL for every m, while the nonlinear rows mostly favour Concrete.

For the one-hidden-layer nonlinear model at m equal to 1, Concrete reached 92.1 on MNIST test against 93.8 for VIMCO, whereas for the linear model at the same m, Concrete reached 107.3 against 104.4. The two-hidden-layer model (200H∼200H∼784V) is not uniform either: at m equal to 1 Concrete reached 87.9 on MNIST test against 88.4 for VIMCO, and at m equal to 50 Concrete reached 85.7 against 85.5 for VIMCO.

The n-ary results under the L5 objective give 86.7/83.3 test/train NLL for the best 4-ary model and 87.4/84.6 for the best 8-ary model, both with Concrete relaxations. The 8-ary model is worse on both test and training NLL, which the authors attribute to a harder objective that adds little capacity when moving from 4 to 8 states. As a control, logistic normal relaxations with retuned temperatures reached 88.7/85.0 for the best 4-ary model and 89.1/85.1 for the best 8-ary model, with the discrete model evaluated by sampling from the learned logits.

## Structured output prediction results

The task predicts the bottom half x1 of a digit from its top half x2 through layers of discrete units, and the training objective is the multisample bound with the conditional prior over the latent layers acting as the variational distribution. Models are trained for m equal to 1, 5 and 50 and evaluated with the bound at m equal to 100 over the whole dataset.

For the binary model with two latent layers of 240 units, Concrete gave lower test NLL than VIMCO at m equal to 1 (58.5 against 61.4) and at m equal to 5 (54.3 against 54.5). At m equal to 50 VIMCO's test NLL was lower (51.8 against 53.4), so the comparison does not favour Concrete at every setting in the table, although the authors describe Concrete as more uniformly ahead on this task.

For the binary model with three latent layers of 240 units, Concrete was lower at m equal to 1 (56.3 against 59.7) and at m equal to 5 (52.7 against 53.5), while VIMCO was lower at m equal to 50 (50.2 against 52.0).

With the m equal to 1 objective and the 392V-240H-240H-240H-392V architecture, the 4-ary model reached 55.4/46.0 test/train NLL and the 8-ary model reached 54.7/44.8. On this task the authors report that increasing the arity improved the models uniformly, and the temperatures were taken from the density estimation experiments. A plot of the objective for the continuous and the discrete graph against temperature checks whether relaxed units prefer interior values, and the shaded region marks where the discretization suffers an integrality gap.

## Where the estimator sits among earlier relaxations

Gumbel-Softmax was considered at about the same time and uses the same softmax of Gumbels, but it computes the discrete log-probabilities from the relaxed state instead of the density. In the variational case that choice means the relaxed objective is not a lower bound on the marginal likelihood, which the authors note requires care when optimizing it.

Sigmoids with additive input noise to approximate discreteness have precedent in nonlinear Gaussian units and in binarized autoencoder codes.

The Dirichlet and the logistic normal are the best known distributions on the simplex, and the authors state that the Concrete distribution does not fall completely into any of these families. For temperatures at most 1, the authors report that the Concrete belongs to a class of normalized infinitely divisible distributions, a point they attribute to a personal communication and do not prove.

## Limitations

The success of Concrete relaxations depends on the temperature chosen during training. Above the threshold (n-1) to the power minus one, the relaxed density may have interior modes and an integrality gap, so the threshold is a guideline rather than a complete rule for choosing temperatures.

Temperatures were fixed in all experiments, and the authors did not find annealing or automatic tuning of the temperature important in these runs, though they consider it possibly valuable future work.

The experiments use only MNIST and Omniglot, with density estimation and structured output prediction as the tasks and the architectures listed in Table 1 and in the structured prediction runs. For models without a closed form mass, such as the multinomial probit, the discrete test-time evaluation has no direct form, and the logistic normal control was scored by sampling from the learned logits.

## Paper info

- **Authors**: Maddison, Chris J., Mnih, Andriy, Teh, Yee Whye
- **Venue**: arXiv · Preprint
- **First published**: 2016-11-2
- **Added**: 2026-11-12
- **Updated**: 2017-3-5
- **Version**: v3
- **arXiv**: 1611.00712
- **Category**: cs.LG · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1611.00712v3) · [PDF ↗](https://arxiv.org/pdf/1611.00712v3)

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

Maddison, Chris J., Mnih, Andriy, Teh, Yee Whye (2016). The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. arXiv:1611.00712v3. https://arxiv.org/abs/1611.00712v3

**BibTeX**

```
@misc{j2016concrete,
  title = {{The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables}},
  author = {Maddison, Chris J. and Mnih, Andriy and Teh, Yee Whye},
  year = {2016},
  eprint = {1611.00712},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.00712v3}
}
```

## Related papers

- [Categorical Reparameterization with Gumbel-Softmax](https://refivu.com/en/papers/c907a642-9316-44dc-97d4-0d4eebe881fa-categorical-reparameterization-with-gumbel-softmax.md)
- [Auto-Encoding Variational Bayes](https://refivu.com/en/papers/90411040-94ff-4aca-9d04-a1a99cad3eb4-auto-encoding-variational-bayes.md)
- [Neural Discrete Representation Learning](https://refivu.com/en/papers/111a9c5f-9d7d-4bff-bbad-a962285094a3-neural-discrete-representation-learning.md)
- [Tutorial on Variational Autoencoders](https://refivu.com/en/papers/51a9cfc2-6285-4935-b55a-3d6450af8eff-tutorial-on-variational-autoencoders.md)
- [Unsupervised Image-to-Image Translation Networks](https://refivu.com/en/papers/23eee1aa-7651-4535-93bf-d37262ee5dff-unsupervised-image-to-image-translation-networks.md)
- [Memorizing Normality to Detect Anomaly: Memory-augmented Deep Autoencoder for Unsupervised Anomaly Detection](https://refivu.com/en/papers/b6435fab-e010-4a4f-aeb8-b125ca06e94a-memorizing-normality-to-detect-anomaly-memory-augmented-deep.md)

## Other paper commentary

- [Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoning](https://refivu.com/en/papers/4dc3fc3a-5207-430d-b5ed-3cc95d077c11-targeted-backdoor-attacks-on-deep-learning-systems-using.md)
- [Time Series Forecasting With Deep Learning: A Survey](https://refivu.com/en/papers/780d7359-7e46-4268-a1a4-b0f1171c7abd-time-series-forecasting-with-deep-learning-a-survey.md)
- [Generative AI](https://refivu.com/en/papers/20462cc3-15fd-4b36-8393-33848e90e0dd-generative-ai.md)
- [BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chain](https://refivu.com/en/papers/057abbfb-a7b1-418d-8d40-85a4f025c469-badnets-identifying-vulnerabilities-in-the-machine-learning.md)
- [Asymptotic Equivalence of Bayes Cross Validation and Widely Applicable Information Criterion in Singular Learning Theory](https://refivu.com/en/papers/af4e7ac9-4c58-4c62-938e-efd2bc4d7bd5-asymptotic-equivalence-of-bayes-cross-validation-and-widely.md)
- [Counterfactual Explanations without Opening the Black Box: Automated Decisions and the GDPR](https://refivu.com/en/papers/0d61122d-d270-4b56-bf77-9a4632bff37e-counterfactual-explanations-without-opening-the-black-box.md)
- [Personalized Top-N Sequential Recommendation via Convolutional Sequence Embedding](https://refivu.com/en/papers/7c1f4e3a-96df-4fe9-a8b5-6c36b294a565-personalized-top-n-sequential-recommendation-via.md)
- [TSM: Temporal Shift Module for Efficient Video Understanding](https://refivu.com/en/papers/e7e3764b-d00b-4555-9a23-62f113a3fdfe-tsm-temporal-shift-module-for-efficient-video-understanding.md)
- [Deep metric learning using Triplet network](https://refivu.com/en/papers/f6dd7198-0b7a-4f6a-a88a-eb7bbe1ff7ee-deep-metric-learning-using-triplet-network.md)
- [Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting](https://refivu.com/en/papers/d52df827-0d8c-42c3-97e1-3063d2cc1256-autoformer-decomposition-transformers-with-auto-correlation.md)
- [DeepSurv: Personalized Treatment Recommender System Using A Cox Proportional Hazards Deep Neural Network](https://refivu.com/en/papers/e56bf111-97b6-4d99-b702-a3e324f609b2-deepsurv-personalized-treatment-recommender-system-using-a.md)
- [M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation](https://refivu.com/en/papers/c3b40084-e91f-4769-ab5c-b3256a5b92f7-m3-embedding-multi-linguality-multi-functionality-multi.md)

## Terms in this paper

- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [ADAM](https://refivu.com/en/terms/0e9ad0199e08-adam)
- [negative log-likelihood](https://refivu.com/en/terms/e6d7135ed9ca-negative-log-likelihood)
- [reparameterization trick](https://refivu.com/en/terms/67c18035066e-reparameterization-trick)
- [Omniglot](https://refivu.com/en/terms/207a37dcf16c-omniglot)
- [temperature](https://refivu.com/en/terms/13dee949c770-temperature)
- [evidence lower bound](https://refivu.com/en/terms/ab8bf35324c3-evidence-lower-bound)
- [Gumbel-Softmax](https://refivu.com/en/terms/e169554398b3-gumbel-softmax)
- [Gumbel-Max trick](https://refivu.com/en/terms/05472cd65e0a-gumbel-max-trick)
- [NVIL](https://refivu.com/en/terms/f2ff78ccb2d4-nvil)
- [density estimation](https://refivu.com/en/terms/3c3bb9a30918-density-estimation)
- [score function estimator](https://refivu.com/en/terms/6e1b6ebaa650-score-function-estimator)
- [Structured output prediction](https://refivu.com/en/terms/1d489c67cc24-structured-output-prediction)
- [VIMCO](https://refivu.com/en/terms/cdb92ab7a4ca-vimco)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/a2b9da66-2864-4212-85c2-c935a02c48cf-the-concrete-distribution-a-continuous-relaxation-of)
