Sam Babichenko

Reading notes / Reinforcement learning for reasoning

Stochastic softmax tricks and Gumbel-Rao

Paulus et al., 2020; Paulus et al., 2021

Structures and loss
Y;\mathcal Y; X⊂Rn\mathcal X\subset\mathbb R^nfinite set of structures; their binary vectors
nnlength of the binary vectors; the number of categories when one-hot
PPconvex hull of X\mathcal X
X,X, XτX_\taudiscrete sample; its relaxation at temperature τ\tau
LLloss
θ,\theta, pθp_\thetaparameters; the distribution of XX
eie_ione-hot vector of category ii
Noise and relaxation
GGindependent standard Gumbel noise
UUrandom utility vector
τ,\tau, softmaxτ\mathrm{softmax}_\tautemperature; tempered softmax
ffstrongly convex regularizer
δP,\delta_P, gτ,g_\tau, gτ∗g_\tau^*indicator of PP; τ(f−min⁡f)+δP\tau(f-\min f)+\delta_P; its convex conjugate
μτ,\mu_\tau, A∗A^*exponential-family mean map; conjugate of the log-partition function
Z,Z, EjE_j∑jeθj\sum_je^{\theta_j}; standard exponential variables (Step 7)
Estimators
∇\nablatrue gradient ∇θE[L(X)]\nabla_\theta\mathbb E[L(X)]
g^ST,\hat g_{\rm ST}, g^GR\hat g_{\rm GR}straight-through Gumbel-Softmax; its conditional expectation given XX
g^K,\hat g_K, g^K(B)\hat g^{(B)}_KGumbel-Rao with KK conditional draws; average of BB copies
var\mathrm{var}trace of the covariance matrix
Constants
KKconditional Gumbel draws per estimate; Gumbel-Rao Propositions 2 and 3
BBbatch size; Gumbel-Rao Proposition 3
ϵ\epsilonfinite-difference step (Step 3)
kksubset size in kk-subset models

Context. Models with a discrete choice inside, such as a subset of words that explains a prediction, a latent graph or a parse tree, are trained by gradient descent on an expected loss E[L(X)]\mathbb E[L(X)], where the discrete random X∼pθX\sim p_\theta depends on parameters θ\theta. The L(X) ∇θlog⁡pθ(X)L(X)\,\nabla_\theta\log p_\theta(X), unbiased for ∇θE[L(X)]\nabla_\theta\mathbb E[L(X)] because ∇θpθ=pθ∇θlog⁡pθ\nabla_\theta p_\theta=p_\theta\nabla_\theta\log p_\theta; called REINFORCE in reinforcement learning (REINFORCE) is unbiased and needs only values of the loss, but its variance is high unless it is paired with good terms of known mean subtracted from an estimator to lower its variance, such as a baseline bb in (L(X)−b) ∇θlog⁡pθ(X)(L(X)-b)\,\nabla_\theta\log p_\theta(X). Relaxed estimators accept bias for lower variance. The arg⁡max⁡i(θi+Gi)\arg\max_i(\theta_i+G_i), with GiG_i independent standard Gumbel variables (distribution function e−e−ge^{-e^{-g}}), is a draw from the categorical distribution pi∝eθip_i\propto e^{\theta_i} writes a categorical sample as the argmax of the logits plus independent Gumbel noise, and the Gumbel-Softmax estimator (Jang et al., 2017; Maddison et al., 2017) replaces the argmax by a softmax at a τ>0\tau\gt0 in softmaxτ(u)i=eui/τ/∑jeuj/τ\mathrm{softmax}_\tau(u)_i=e^{u_i/\tau}/\sum_je^{u_j/\tau}; as τ→0\tau\to0 the softmax tends to the one-hot argmax τ\tau and differentiates through it. That needs one noise variable per outcome, which rules out distributions over all spanning trees of a graph or all kk-element subsets. Paulus et al. (2020) extend the trick to such structured sets. Paulus et al. (2021) take its a gradient estimator that uses the discrete sample in the forward pass and backpropagates as if a smooth surrogate had been used variant, which keeps the discrete sample in the forward pass, and lower its variance without evaluating the loss again.

Many structured distributions can be sampled by solving a linear program with random utilities, and adding a strongly convex regularizer to that program turns its solution into a continuous function of the utilities that tends to the discrete sample as the temperature goes to 0. The Gumbel-Softmax recipe then applies to any structure for which the regularized problem can be solved. In the straight-through estimator the noise enters only through a softmax Jacobian, and averaging that Jacobian over the noise consistent with the sampled outcome keeps the estimator's mean and lowers its mean squared error, with a few extra softmax evaluations. Both estimators are biased for the discrete gradient and need a loss that is differentiable in XX; REINFORCE needs neither, which is why it remains the tool when the loss is a black-box reward.

Setting. Let Y\mathcal Y be a finite set of structures, each represented by a binary vector in Rn\mathbb R^n: a one-hot vector for a category, edge indicators for a spanning tree, a kk-hot vector for a subset of size kk. Write X⊂Rn\mathcal X\subset\mathbb R^n for the set of these vectors and PP for its P={∑jλjxj:λj≥0, ∑jλj=1}P=\{\sum_j\lambda_jx_j:\lambda_j\ge0,\ \sum_j\lambda_j=1\}, all convex combinations of the vectors xj∈Xx_j\in\mathcal X. For a loss L:Rn→RL:\mathbb R^n\to\mathbb R the target is∇θE[L(X)]=∇θ∑x∈XL(x) pθ(x).\nabla_\theta\mathbb E[L(X)]=\nabla_\theta\sum_{x\in\mathcal X}L(x)\,p_\theta(x).For one-hot X\mathcal X and pθ(x)∝ex⊤θp_\theta(x)\propto e^{x^\top\theta}, the Gumbel-Max sample is X=arg⁡max⁡x∈X(θ+G)⊤xX=\arg\max_{x\in\mathcal X}(\theta+G)^\top x with a vector of independent standard Gumbel variables, one per coordinate the noise, the Gumbel-Softmax sample is Xτ=softmaxτ(θ+G)X_\tau=\mathrm{softmax}_\tau(\theta+G), and the estimator dL(Xτ)/dθdL(X_\tau)/d\theta is unbiased for ∇θE[L(Xτ)]\nabla_\theta\mathbb E[L(X_\tau)], the gradient of the relaxed objective, and biased for the target. The straight-through Gumbel-Softmax (ST-GS) evaluates the loss at the discrete XX and backpropagates through XτX_\tau built from the same noise,g^ST=∂L(X)∂X d softmaxτ(θ+G)dθ.\hat g_{\rm ST}=\frac{\partial L(X)}{\partial X}\,\frac{d\,\mathrm{softmax}_\tau(\theta+G)}{d\theta}.It is not known to be unbiased for any gradient, but it has low variance and leaves the forward computation discrete.

Main results. (a) Stochastic softmax tricks (Paulus et al., 2020). The definitions separate how a structure is sampled from how the sample is smoothed. A stochastic argmax trick (SMT) is a random utility vector U∈RnU\in\mathbb R^n whose distribution is set by θ\theta, with sample X=arg⁡max⁡x∈XU⊤xX=\arg\max_{x\in\mathcal X}U^\top x; one-hot X\mathcal X with U=θ+GU=\theta+G is Gumbel-Max. A stochastic softmax trick (SST) at temperature τ>0\tau\gt0 adds a regularizer ff that is why: strong convexity makes the maximizer unique and a Lipschitz function of UU (Step 3), which the pathwise gradient needs; proper and closed are the standard technical conditions for convex duality, with domain containing the the interior of PP taken within the smallest affine space containing PP of PP:Xτ=arg⁡max⁡x∈P U⊤x⏟utility−τf(x)⏟smoothing.X_\tau=\arg\max_{x\in P}\ \underbrace{U^\top x}_{\text{utility}}-\underbrace{\tau f(x)}_{\text{smoothing}}.Gumbel-Softmax is one-hot X\mathcal X, U=θ+GU=\theta+G and f(x)=∑ixilog⁡xif(x)=\sum_ix_i\log x_i. Proposition 1: if why: with ties the argmax, and so the sample, is undefined; it holds whenever P(U⊤a=0)=0\mathbb P(U^\top a=0)=0 for every a≠0a\ne0, as for any UU with a density, then Xτ→XX_\tau\to X almost surely as τ→0+\tau\to0^+, and if why: continuity carries Xτ→XX_\tau\to X over to L(Xτ)→L(X)L(X_\tau)\to L(X), and boundedness lets dominated convergence move the limit inside the expectation, then E[L(Xτ)]→E[L(X)]\mathbb E[L(X_\tau)]\to\mathbb E[L(X)]. Proposition 2: XτX_\tau exists, is unique, and is continuous and almost everywhere differentiable in UU, so for written as a differentiable function of θ\theta and of noise whose law does not depend on θ\theta, such as U=θ+GU=\theta+G UU the estimatordL(Xτ)dθ=∂L∂Xτ ∂Xτ∂U dUdθ\frac{dL(X_\tau)}{d\theta}=\frac{\partial L}{\partial X_\tau}\,\frac{\partial X_\tau}{\partial U}\,\frac{dU}{d\theta}is unbiased for ∇θE[L(Xτ)]\nabla_\theta\mathbb E[L(X_\tau)] when LL is differentiable on PP and L(Xτ)L(X_\tau) satisfies a local Lipschitz condition in θ\theta. (b) Gumbel-Rao (Paulus et al., 2021). The second paper's estimator is the replacement of an estimator by its conditional expectation given some statistic; the mean is unchanged and the mean squared error cannot rise (the Rao-Blackwell theorem) of ST-GS given the discrete outcome,g^GR=E[g^ST∣X]=∂L(X)∂X×E[d softmaxτ(θ+G)dθ ∣ X],\begin{aligned}\hat g_{\rm GR}&=\mathbb E[\hat g_{\rm ST}\mid X]\\&=\frac{\partial L(X)}{\partial X}\\&\quad\times\mathbb E\Big[\frac{d\,\mathrm{softmax}_\tau(\theta+G)}{d\theta}\,\Big|\,X\Big],\end{aligned}and writing the true gradient ∇θE[L(X)]\nabla_\theta\mathbb E[L(X)] of the discrete objective, its Proposition 1 gives E∥g^GR−∇∥2≤E∥g^ST−∇∥2\mathbb E\|\hat g_{\rm GR}-\nabla\|^2\le\mathbb E\|\hat g_{\rm ST}-\nabla\|^2. The practical version g^K\hat g_K averages the Jacobian over KK draws of GG conditional on XX and satisfies the same inequality for every K≥1K\ge1 (Proposition 2). Averaging BB independent copies, as a minibatch does, gives (Proposition 3, with var the trace of the covariance)var[g^K(B)]=E var[g^ST∣X]BK⏟noise given X+var[g^GR]B⏟from X.\begin{aligned}\mathrm{var}\big[\hat g^{(B)}_K\big]={}&\underbrace{\frac{\mathbb E\,\mathrm{var}[\hat g_{\rm ST}\mid X]}{BK}}_{\text{noise given }X}\\&+\underbrace{\frac{\mathrm{var}[\hat g_{\rm GR}]}{B}}_{\text{from }X}.\end{aligned}

Consequences and limits. An SST is a recipe with three choices: an embedding X\mathcal X with a fast linear solver, a utility distribution for UU, and a regularizer ff for which the regularized problem can be solved and differentiated; one trains at a fixed τ\tau chosen on validation data and evaluates with the discrete XX. In the experiments, relaxations that matched the true latent structure (spanning trees, directed spanning trees in which every node is reached from a chosen root, correlated subsets) recovered more of it than independent-edge or task-specific relaxations, the utility distribution changed results a lot, and the regularizer changed them little (Step 5). Gumbel-Rao replaces only the backward pass of ST-GS and adds no loss evaluations; its gain is largest at small batch sizes, where the noise given XX dominates (Proposition 3), and at low temperatures, and in the experiments it let training use lower temperatures (Step 8). The evidence for both is a handful of latent-variable benchmarks.

Set against the score-function estimator, both methods are biased for ∇θE[L(X)]\nabla_\theta\mathbb E[L(X)]: an SST follows the relaxed objective E[L(Xτ)]\mathbb E[L(X_\tau)] and needs LL defined and differentiable on all of PP, and straight-through needs LL differentiable at the vertices. REINFORCE, with baselines and several samples per input, remains the choice when the loss is a black box, such as a reward from an environment or a score given to sampled text. The papers' comparisons with it are limited. Gumbel-Rao's uses only REINFORCE with a running-mean baseline, which lags far behind (Step 8). The SST paper's, on the graph task only, uses tuned moving-average, batch-mean, multi-sample and learned baselines but, because the probability of a given spanning tree is intractable, treats the utility UU as the sampled variable, which the authors call atypical (Step 5). Neither paper tests score-function estimators with stronger control variates, such as REBAR (Tucker et al., 2017) or RELAX (Grathwohl et al., 2018), so how far the best of them stays behind on these tasks is not measured.

Step 1

The argmax has zero gradient almost everywhere, and a continuous relaxation restores the pathwise derivative. As a function of θ\theta, X=arg⁡max⁡x∈X(θ+G)⊤xX=\arg\max_{x\in\mathcal X}(\theta+G)^\top x is piecewise constant: it is differentiable almost everywhere with derivative 0, so E[dL(X)/dθ]=0\mathbb E[dL(X)/d\theta]=0 while ∇θE[L(X)]\nabla_\theta\mathbb E[L(X)] generally is not 0. All the dependence on θ\theta sits in the jumps, which break the exchange of derivative and expectation. A relaxation that is continuous in the noise, such as the softmax, makes the exchange valid for the relaxed objective. The temperature sets the balance between bias and variance: as τ→0\tau\to0 the relaxed sample approaches XX, so the bias falls, while the softmax Jacobian (diag(s)−ss⊤)/τ(\mathrm{diag}(s)-ss^\top)/\tau at s=Xτs=X_\tau is tiny except near ties between utilities, where it grows like 1/τ1/\tau, so the variance rises, as the Gumbel-Rao paper reports.

Step 2

A linear program with random utilities defines the model, and its solver draws the sample. A linear function on PP is maximized at a vertex, and a unique maximizer over X\mathcal X is the unique maximizer over PP, so drawing XX means solving a linear program; the sample is unique almost surely when UU gives no mass to any hyperplane {U⊤a=0}\{U^\top a=0\}. Fast solvers exist for many structures: the top kk entries of UU by sorting for kk-subsets, Kruskal's algorithm for a maximum spanning tree, Chu-Liu-Edmonds for an arborescence, the Hungarian method for matchings. Only a solver is needed, so sampling is cheap for sets far too large to enumerate. In exchange pθp_\theta is defined only implicitly: for structured X\mathcal X the law of XX under Gumbel utilities is in general not pθ(x)∝ex⊤θp_\theta(x)\propto e^{x^\top\theta} and is hard to characterize, so the paper treats UU as a modeling choice and warns against defaulting to θ+G\theta+G or N(θ,σ2I)\mathcal N(\theta,\sigma^2I) without analysis.

Step 3

Strong convexity makes the regularized argmax the gradient of a smooth convex function. Write δP\delta_P for the convex indicator of PP (0 on PP, +∞+\infty outside), gτ=τ(f−min⁡f)+δPg_\tau=\tau(f-\min f)+\delta_P, and gτ∗g_\tau^* for its g∗(u)=sup⁡x u⊤x−g(x)g^*(u)=\sup_x\,u^\top x-g(x); when the supremum is attained at a unique point, ∇g∗(u)\nabla g^*(u) is that point. By conjugate dualityXτ=∇gτ∗(U),gτ∗(u)=sup⁡x u⊤x−gτ(x).\begin{aligned}X_\tau&=\nabla g_\tau^*(U),\\g_\tau^*(u)&=\sup_x\,u^\top x-g_\tau(x).\end{aligned}The conjugate of a strongly convex function is differentiable with a Lipschitz gradient, so XτX_\tau is unique and continuous in UU, and a Lipschitz function on Rn\mathbb R^n is differentiable almost everywhere makes it differentiable almost everywhere: Proposition 2. As τ→0\tau\to0, gτ∗g_\tau^* increases to the u↦max⁡x∈Pu⊤xu\mapsto\max_{x\in P}u^\top x, the value of the linear program over PP of PP. Where that linear program has a unique solution, the support function is differentiable on a neighborhood of uu, and pointwise convergence of convex functions then carries over to their gradients, so Xτ→XX_\tau\to X: Proposition 1. Because ∂Xτ/∂U\partial X_\tau/\partial U is the Hessian of gτ∗g_\tau^*, it is symmetric, so the vector-Jacobian product that backpropagation needs is a directional derivative of XτX_\tau, computable for a small step ϵ\epsilon with two extra solves and no extra loss evaluation:dL(Xτ)dU≈12ϵ(Xτ(U+ϵv)−Xτ(U−ϵv)),v=∂L∂Xτ.\begin{aligned}\frac{dL(X_\tau)}{dU}&\approx\frac1{2\epsilon}\big(X_\tau(U+\epsilon v)\\&\qquad-X_\tau(U-\epsilon v)\big),\\v&=\frac{\partial L}{\partial X_\tau}.\end{aligned}

Step 4

Projections, entropies and marginal inference give computable relaxations. With f=∥x∥2/2f=\|x\|^2/2, XτX_\tau is the Euclidean projection of U/τU/\tau onto PP. On the simplex the categorical entropy f=∑ixilog⁡xif=\sum_ix_i\log x_i gives the softmax, and for independent bits the binary entropy gives the sigmoid. The most general choice comes from an the distributions p(x)∝eη⊤xp(x)\propto e^{\eta^\top x} on X\mathcal X, indexed by the natural parameter η∈Rn\eta\in\mathbb R^n: for p(x)∝eu⊤x/τp(x)\propto e^{u^\top x/\tau} on X\mathcal X, the mean of xx solves a problem of exactly the SST form,μτ(u)=∑x∈Xx eu⊤x/τ∑y∈Xeu⊤y/τ=arg⁡max⁡x∈P u⊤x−τA∗(x),\begin{aligned}\mu_\tau(u)&=\sum_{x\in\mathcal X}x\,\frac{e^{u^\top x/\tau}}{\sum_{y\in\mathcal X}e^{u^\top y/\tau}}\\&=\arg\max_{x\in P}\,u^\top x-\tau A^*(x),\end{aligned}with the convex conjugate of the log-partition function A(η)=log⁡∑x∈Xeη⊤xA(\eta)=\log\sum_{x\in\mathcal X}e^{\eta^\top x}; at a mean μ\mu it is minus the entropy of the family member with mean μ\mu the conjugate of the log-partition function, a negative entropy; then Xτ=μτ(U)X_\tau=\mu_\tau(U). Computing it is computing the marginal probabilities, here the mean vector μτ\mu_\tau, of a distribution over structures: for spanning trees the edge marginals follow from the sum of edge-weight products over all spanning trees of a graph equals a determinant of its reduced weighted Laplacian; edge marginals follow from that determinant's derivatives (a directed version for arborescences), and for a chain with a cardinality constraint from dynamic programming. As τ→0\tau\to0 an SST tends to a random draw XX from the SMT, because UU is random; annealing marginal inference toward a single most probable structure is a different limit.

Step 5

Matching the true structure improves recovery and fit, and the noise distribution matters more than the regularizer. Hyperparameters, including the fixed training temperature, were chosen by random search, and models were trained with XτX_\tau and evaluated with XX. In a graph neural network whose encoder samples a latent interaction graph from observed particle trajectories and whose decoder predicts the motion by passing messages over that graph, trained on a variational lower bound on particles whose latent interaction graph is a spanning tree over 10 vertices, the spanning-tree SST reached an evidence lower bound: the variational lower bound on log⁡p(data)\log p(\text{data}) used as the training objective of −1080±110-1080\pm110 and edge precision and recall of 91% from 10 observed time steps, against −1370±20-1370\pm20 and 48% precision for the original independent-edge encoder, and from 20 steps it recovered 99% of edges. On a simplified sequences of nested prefix arithmetic such as max[ 3 min[ 8 2 ]], each labeled by its value from 0 to 9; the syntax defines a parse tree, where the true parse is a directed tree rooted at the first token, the arborescence SST with Gumbel utilities reached 95.0% task accuracy with 75.5% edge precision and 71.9% recall, against 90.1%, 13.0% and 56.4% for independent directed edges and 92.1% accuracy for an LSTM, and the same arborescence with negative exponential utilities reached only 71.5%. In learning to explain: a model must predict a label from kk input words it selects, so the selected words explain the prediction on the aroma rating of beer reviews, the correlated kk-subset SST, whose utilities link neighboring words, raised the precision of the selected words from 28.3% with L2X's own relaxation to 63.1% at k=5k=5 with the one-layer convolutional encoder and lowered the mean squared error from 0.036 to 0.029, while the four regularizers for plain top-kk differed little. In an appendix, score-function estimators on the graph task (REINFORCE with moving-average, batch-mean or multi-sample baselines, and neural variational inference and learning (Mnih and Gregor, 2014): REINFORCE with an input-dependent baseline learned by a network, all applied to UU) struggled wherever the SSTs struggled, REINFORCE also failed with spanning trees, and NVIL with spanning trees learned some structure, less and with higher variance than the SST.

Step 6

Rao-Blackwellizing ST-GS over the noise behind the outcome keeps its mean and lowers its mean squared error. ST-GS has two sources of randomness, the outcome XX and the Gumbel noise given XX, and the second enters only through the point at which the softmax Jacobian is evaluated. Conditioning removes it. By the tower rule E[g^GR]=E[g^ST]\mathbb E[\htmlData{gr=gn13}{\hat g_{\rm GR}}]=\mathbb E[\hat g_{\rm ST}], so the bias is unchanged, and conditional Jensen applied to the squared error gives∥E[g^ST∣X]−∇∥2≤E[∥g^ST−∇∥2 ∣ X],\begin{aligned}&\big\|\mathbb E[\hat g_{\rm ST}\mid X]-\nabla\big\|^2\\&\quad\le\mathbb E\big[\|\hat g_{\rm ST}-\nabla\|^2\,\big|\,X\big],\end{aligned}whose expectation is Proposition 1, strict whenever var[g^ST∣X]>0\mathrm{var}[\hat g_{\rm ST}\mid X]\gt0, which holds for finite τ\tau and θ\theta. The mean squared error falls at every temperature, so training can move to lower temperatures, where the bias is smaller and plain ST-GS was too noisy. In a three-category example (my check: logits (0.5,0,−0.5)(0.5,0,-0.5), τ=0.5\tau=0.5, a quadratic loss), ST-GS and Gumbel-Rao with 100 conditional draws had the same mean, both away from the true gradient, and the trace of the covariance fell from 0.55 to 0.32.

Step 7

The Gumbels behind a given outcome have a closed form, so the conditional average costs O(nK)O(nK). Given X=eiX=e_i, the one-hot vector of the winning category ii, write Z=∑jeθjZ=\sum_je^{\theta_j} and let E1,…,EnE_1,\dots,E_n be independent exponentially distributed with mean 1, P(E>s)=e−s\mathbb P(E\gt s)=e^{-s} variables. Then, in distribution, with jj ranging over the other categories,θi+Gi=log⁡Z−log⁡Ei,θj+Gj=−log⁡(Eje−θj+Ei/Z).\begin{aligned}\theta_i+G_i&=\log Z-\log E_i,\\\theta_j+G_j&=-\log\big(E_je^{-\theta_j}+E_i/Z\big).\end{aligned}The winning perturbed logit is Gumbel with location log⁡Z\log Z, independent of which index wins, and each other one is Gumbel with location θj\theta_j truncated to lie below the winner (my check: these draws match rejection sampling from unconditional Gumbels within Monte Carlo error). Averaging the softmax Jacobian over KK such draws gives g^K\hat g_K (K=1K=1 is ST-GS), and Jensen applied to the KK-sample average gives Proposition 2. The extra work is KK softmax Jacobians of size nn, done in parallel. Proposition 3 follows from the law of total variance: KK divides only the first term, which the batch size BB divides too, so the gain is largest at small batches and returns from larger KK diminish.

Step 8

Gumbel-Rao trains better at low temperatures and small batches, by up to 2 nats at batch size 20. On a quadratic objective over the probability simplex in three dimensions, the variance falls at every point, most at low temperature and near the corners and edges. On ListOps with a tree-LSTM parser that its authors (Choi et al., 2017) trained with ST-GS, test accuracy for sequences up to length 10 rose at τ=0.01\tau=0.01 from 38.8% to 66.5% (K=1000K=1000; 66.4% with K=10K=10) and at τ=1\tau=1 from 65.8% to 67.0%, so most of the gain is that low temperatures become usable. In a an encoder draws latent variables given the input and a decoder reconstructs the input from them; both are trained on a lower bound on the log-likelihood on binarized MNIST with 16-category latent variables and batch size 20, the test bound on the negative log-likelihood improved from 98.8 to 96.8 units of natural-log likelihood; the numbers are upper bounds on the negative log-likelihood, so lower is better, and with batch size 200 from 92.6 to 92.2 (an appendix table shows up to 2.9 nats at batch size 5); the best ST-GS models trained at an average temperature of 0.65 and the best Gumbel-Rao models at 0.35, and gains saturated near K=100K=100. REINFORCE with a running-mean baseline reached only 169 to 204 nats at batch size 20. The relaxed Gumbel-Softmax, which changes the forward pass, was best for binary variables (98.2 against 100.5 nats at batch size 20) and matched or trailed Gumbel-Rao with 16 categories (96.8 against 96.8 at batch size 20, 94.3 against 92.2 at 200).

Terms

Score function (REINFORCE)
L(X)∇θlog⁡pθ(X)L(X)\nabla_\theta\log p_\theta(X): unbiased, needs only loss values, high variance without control variates
Gumbel-Max
arg⁡max⁡i(θi+Gi)∼pi∝eθi\arg\max_i(\theta_i+G_i)\sim p_i\propto e^{\theta_i}
Gumbel-Softmax
Xτ=softmaxτ(θ+G)X_\tau=\mathrm{softmax}_\tau(\theta+G); unbiased for the relaxed objective, biased for the discrete one
ST-GS
discrete XX forward, gradient through softmaxτ(θ+G)\mathrm{softmax}_\tau(\theta+G) backward
SMT
X=arg⁡max⁡x∈XU⊤xX=\arg\max_{x\in\mathcal X}U^\top x, a linear program with random utilities
SST
Xτ=arg⁡max⁡x∈PU⊤x−τf(x)X_\tau=\arg\max_{x\in P}U^\top x-\tau f(x), ff strongly convex
SST Propositions 1-2
Xτ→XX_\tau\to X a.s. as τ→0\tau\to0; XτX_\tau continuous and a.e. differentiable in UU
Exponential-family relaxation
Xτ=μτ(U)X_\tau=\mu_\tau(U), the marginals of p(x)∝eU⊤x/τp(x)\propto e^{U^\top x/\tau}
Finite differences
symmetric Jacobian: dL/dU≈[Xτ(U+ϵv)−Xτ(U−ϵv)]/2ϵdL/dU\approx[X_\tau(U+\epsilon v)-X_\tau(U-\epsilon v)]/2\epsilon, v=∂L/∂Xτv=\partial L/\partial X_\tau
Gumbel-Rao
E[g^ST∣X]\mathbb E[\hat g_{\rm ST}\mid X]: same mean as ST-GS, lower mean squared error, no extra loss evaluations
Conditional Gumbels
winner log⁡Z−log⁡Ei\log Z-\log E_i; others −log⁡(Eje−θj+Ei/Z)-\log(E_je^{-\theta_j}+E_i/Z)
Proposition 3
var=E var[g^ST∣X]/(BK)+var[g^GR]/B\mathrm{var}=\mathbb E\,\mathrm{var}[\hat g_{\rm ST}\mid X]/(BK)+\mathrm{var}[\hat g_{\rm GR}]/B

Quiz

  1. Why does the SST paper treat the utility distribution as a modeling choice instead of always taking U=θ+GU=\theta+G?
  2. As τ→0\tau\to0, what does a stochastic softmax trick approach?
  3. A model samples a discrete output that an external program scores, and the score has no gradient. Which estimator applies?
  4. In the SST experiments, which choice changed results least?

Sources