Stochastic Wasserstein Autoencoder for Probabilistic Sentence Generation
Paper · 2019 · Hareesh Bahuleyan, Lili Mou, Hao Zhou et al.
Summary
A sentence generator for conversation has to handle a fact that a sentence copier can ignore. The same utterance can invite several reasonable replies. One way to represent those possibilities is to encode the utterance as a distribution over hidden vectors, then let the decoder use a draw from that distribution to produce a reply. The difficulty is getting the decoder to use the vector while keeping the vector space suitable for sampling. In a variational autoencoder, or VAE, training can make the distribution for every input resemble the same reference distribution so closely that the decoder learns to proceed without useful information from the input.
The authors study a Wasserstein autoencoder, or WAE, as an alternative for text generation. A WAE compares the reference distribution with the collection of encodings across the data. The encoding of a particular sentence can retain its own location even when the collection as a whole has the desired shape. This also makes it possible to use a deterministic encoder that assigns one vector to each sentence. For applications that need several outputs from the same input, however, the authors show why a Gaussian encoder can lose its spread during training. They add a penalty that encourages each Gaussian to retain variance around its own predicted center.
On Stanford Natural Language Inference (SNLI) sentences, the deterministic autoencoder reached 86.35 on reconstruction BLEU. A deterministic WAE reached 86.03, and the stochastic WAE setting the authors preferred as a compromise reached 82.01. The VAE trained with KL annealing reached 43.18. Sampling changed the comparison. The preferred stochastic WAE produced sentences with perplexity of 84.9 under an external predictor and unigram KL of 0.058 against the training corpus. The latter was the lowest reported unigram KL in the comparison. The WAE runs used neither KL annealing nor word dropout.
The dialogue experiment separated reply diversity from overlap with reference replies. On a DailyDialog test set cleaned of training overlaps, the deterministic Wasserstein encoder-decoder led the compared systems on both BLEU measures. Its stochastic counterpart led them on all reported diversity measures and also scored above the variational encoder-decoder on both BLEU measures. The choice of encoder thus depends on where variation is needed. A deterministic WAE can support sampling across the sentence collection, while the auxiliary penalty lets a stochastic encoder retain variation for an individual input.
Deep dive: Stochastic Wasserstein Autoencoder for Probabilistic Sentence Generation
A stochastic Wasserstein autoencoder learns to reconstruct sentences and sample new ones while preserving variation in the replies to an utterance. · about 33 minutes to read
The problem and its context
An input can support several outputs
Using the words it already has, a recurrent sentence generator predicts which word will come next. The prediction changes as the sentence grows. In a sequence-to-sequence system, the generator also receives a representation of an input sequence. An encoder reads the source, and a decoder uses the representation as it writes the output. Autoencoding gives this arrangement a simple training task. The source sentence is also the sentence the decoder is supposed to produce. Success requires the encoder and decoder to communicate enough about the input to recover its words.
Conversation makes a different demand on that communication. A reply has to make sense in light of the utterance, but a particular reply need not be uniquely determined by it. A speaker might answer a question directly, ask for clarification or offer a related observation. A representation with room for uncertainty can give the generator several starting points while keeping the utterance fixed. The paper treats that kind of variation as a reason to make the encoder itself stochastic. It also studies a separate use of probability, in which the generator draws a vector independently of any source and produces a sentence in the style of a corpus.
Those uses ask different things of the latent space, the space of hidden vectors handed from encoder to decoder. Unconditional sampling requires the decoder to handle vectors drawn from a reference distribution. The reference, called the prior, specifies where to draw without first choosing an input. Conditional variation requires multiple useful vectors to be available after one input has been chosen. A system can satisfy the first requirement with a deterministic encoder. If the vectors assigned to different inputs collectively occupy regions covered by the prior, a prior draw can still provide a useful decoder input. The same encoder gives a fixed utterance a single vector, so any variation attributable to the encoder disappears once the utterance is fixed.
A conventional deterministic autoencoder has no training objective for fitting its sentence vectors to a prior. It can learn an arrangement that works well for reconstructing inputs, with sentence codes concentrated in regions that a convenient sampling distribution seldom visits. The decoder can work well on the codes it receives during training while having little reason to behave predictably elsewhere. This is why reconstruction and sampling call for separate evaluation. Recovering a sentence from its own code tests the communication channel between encoder and decoder. Producing a sentence from an independent draw tests what happens when the decoder is reached by a different route.
Why the variational objective is hard to balance
The paper presents the earlier work on generating sentences from a continuous space as the variational starting point for text. There, a sentence maps to a probability distribution over continuous vectors. A draw can then be passed to a decoder. A continuous representation also makes it possible to examine vectors between encodings, an operation the paper associates with interpolation, or deliberately change parts of a representation before decoding. The authors point to earlier work on controlling generated text and to posterior regularization in variational neural machine translation. In this context, regularization means using a training term to favor a particular arrangement of the hidden distributions.
In the VAE, that term is Kullback–Leibler divergence, abbreviated KL. It measures a directional discrepancy between distributions. The VAE applies it separately to the distribution predicted for each sentence and compares each one with the same prior. Reconstruction gives the encoder a reason to distinguish inputs. The KL penalty gives it a reason to put their encodings in overlapping regions. When every conditional encoding distribution agrees with the prior, the draw by itself carries no information about which sentence prompted it.
A recurrent decoder can make that outcome especially easy to reach. At each step of reconstruction training, the decoder has the preceding words of the target sentence. Those words already narrow down what can come next. The decoder can learn to use them and give little weight to the latent vector. If the encoder also makes its posterior agree with the prior, the KL cost can fall to zero. The decoder then behaves as a language model whose predictions depend on the preceding words but are effectively unconditioned on the encoded sentence. The paper calls this KL collapse.
Earlier work described in the paper uses KL annealing and word dropout to make that outcome less likely. Annealing changes the influence of the KL term during training, giving the encoder and decoder an opportunity to learn a useful exchange of information while the pressure toward the prior is still weak. Word dropout gradually removes some of the preceding-word information available to the decoder. That makes the latent vector relatively more valuable for predicting the target. Both interventions add training choices. The weight has to start rising at a suitable time, follow a schedule and stop at a suitable point. The amount of word dropout also changes the reconstruction task as training proceeds.
Moving the distribution constraint
The Wasserstein approach shifts the requirement from individual sentences to the collection of encodings. Imagine repeatedly choosing a sentence from the data, then asking the encoder for a vector. The resulting distribution combines all the sentence-specific distributions in proportion to how often their sentences occur. The WAE asks for that combined distribution to resemble the prior. Individual sentences can occupy different parts of the space and still meet the overall requirement.
This change leaves room for distinct codes, but it also changes what the objective says about uncertainty. With a deterministic encoder, all randomness in the collection of vectors comes from choosing different sentences. With a stochastic encoder, it can also come from sampling different vectors for the same sentence. The aggregate comparison has no separate requirement that either source contribute a particular share. In principle, the population of predicted centers can supply enough variation to make the aggregate look right, even if the encoder consistently returns a point for each input.
The authors build on the original WAE and discuss related work that had already extended adversarial regularization to sequence generation. Their specific question is how the choice between deterministic and stochastic encoding plays out for sentences, and how to keep the stochastic choice meaningful. That leads them to distinguish two ways for a probabilistic autoencoder to lose something useful. A VAE can lose information about the input while retaining a broad distribution. A WAE with a Gaussian encoder can preserve information about the input in its center while losing the spread around that center. The proposed auxiliary loss addresses the latter.
The method, step by step
From words to a reconstruction loss
The deterministic autoencoder provides the common starting point. A recurrent encoder reads word embeddings in sequence. These are vectors that represent words at the input of the network. The encoder’s final hidden state supplies a sentence representation. A recurrent decoder then uses the latent vector and the preceding words to predict the next word. The experiments use long short-term memory units, or LSTMs, in both networks. An LSTM is a recurrent unit that can carry forward a state as it processes successive positions.
The decoder produces vocabulary probabilities through a softmax layer. During training, the loss asks how much probability it assigned to the actual next word. A low probability for that word carries a larger cost than a high one. Summing across positions gives the sentence cost, and summing across examples gives the reconstruction objective. This is the paper’s deterministic objective, with the notation put in reading order.
Jᵣₑ꜀ = −∑ₙ₌₁ᴺ ∑ₜ₌₁|x⁽ⁿ⁾| log p(xₜ⁽ⁿ⁾ | z⁽ⁿ⁾, x₍₍ₜ₎⁾⁽ⁿ⁾)
Here Jᵣₑ꜀ is the total reconstruction loss. The outer sum runs over example index n from 1 to N, the number of examples in the sum. The inner sum runs over position t from 1 to the length |x⁽ⁿ⁾| of sentence x⁽ⁿ⁾. The symbol xₜ⁽ⁿ⁾ denotes its target word at that position, and x₍₍ₜ₎⁾⁽ⁿ⁾ denotes the preceding words, which the paper writes as x with subscript less than t. The vector z⁽ⁿ⁾ is the sentence’s latent representation. The vertical bar inside p separates the predicted word from the information the decoder receives. The logarithm converts the word probability into a contribution to the loss, and the leading minus sign makes greater probability correspond to a smaller cost.
The reconstruction objective stays in place when the authors change the encoder. The deterministic version supplies one code per input. A Gaussian encoder supplies a center and a spread, and reconstruction uses a draw. Both variants feed the latent vector to the decoder at every timestep. Repeated access gives the decoder a way to use the vector throughout the sentence. The loss still lets the decoder learn how much it relies on that information when the prefix already contains a strong clue.
The variational comparison
In the VAE, an input sentence is associated with a diagonal Gaussian. The encoder outputs its mean and its coordinate variances. Diagonal covariance makes the coordinates independent within that sentence’s Gaussian. One coordinate can have a wider or narrower spread than another. The prior is a standard normal distribution centered at the origin, with identity covariance.
q(z | x) = 𝒩(μₚₒₛₜ, diag(σₚₒₛₜ²))
Here q is the encoder’s conditional distribution of latent vector z given sentence x. The symbol 𝒩 denotes a Gaussian distribution. Its center is the predicted vector μₚₒₛₜ. The vector σₚₒₛₜ contains the predicted standard deviations. Squaring them gives the variances, which diag places on the diagonal of the covariance matrix. The subscript post indicates that these quantities describe the posterior for the input.
p(z) = 𝒩(0, I)
Here p is the prior over z, and 𝒩 again denotes a Gaussian. The 0 is the zero mean vector, and I is the identity covariance matrix. The notation p(z) denotes a latent distribution, whereas p in the reconstruction objective denotes the decoder probability of a word given its inputs.
The variational objective combines expected reconstruction with a KL divergence for each example. The expectation means the reconstruction loss is considered over draws from the Gaussian predicted for that sentence. The regularizer has access to the conditional distribution itself. Its penalty can therefore change when the encoder moves the center or changes the variance, even before considering what the decoder does with a draw.
Jᵥₐₑ = ∑ₙ₌₁ᴺ [−E_{z⁽ⁿ⁾ ∼ q(· | x⁽ⁿ⁾)} ∑ₜ₌₁^{|x⁽ⁿ⁾|} log p(xₜ⁽ⁿ⁾ | z⁽ⁿ⁾, x⁽ⁿ⁾₍₍ₜ₎₎) + λᵥₐₑ KL(q(z | x⁽ⁿ⁾) ∥ p(z))]
Here Jᵥₐₑ is the variational loss. The example and position indices are n and t, N is the example count, and |x⁽ⁿ⁾| is the sentence length. The expression inside E is averaged over draws z⁽ⁿ⁾ from q conditioned on x⁽ⁿ⁾. The tilde indicates sampling and the dot reserves the position occupied by the sampled vector. The decoder probability p assigns mass to target word xₜ⁽ⁿ⁾ given the sampled code and prefix x⁽ⁿ⁾₍₍ₜ₎₎. The logarithm and minus sign give the reconstruction cost. The coefficient λᵥₐₑ sets the influence of KL, and the double bar orders its arguments, from the sentence-conditioned posterior q to the prior p over z. The outer sum adds both costs across examples.
This expression identifies where the reconstruction pressure and the distribution pressure meet. If two sentences are encoded as the same Gaussian, draws from it cannot by themselves tell the decoder which source was selected. The VAE can accept some overlap while keeping information in the codes. The danger in the recurrent setup is that the decoder can already do enough with its word history for the shared prior to become an attractive solution.
Matching the collection of encodings
The WAE keeps the reconstruction channel and changes the comparison distribution. Its target is the aggregate of the encodings. The data distribution supplies the weighting in that aggregate. A sentence appears in the mixture according to how often it is drawn, then contributes according to how the encoder represents it.
q(z) = ∑ₓ q(z | x) pᴅ(x)
Here q(z) is the aggregate posterior over latent vector z. The sum ranges over possible input sentences x. The conditional q(z | x) gives the encoding distribution for an individual sentence, and pᴅ(x) is the probability of that sentence under the data distribution. The WAE’s ideal constraint is agreement between this aggregate and the prior p(z). For a deterministic encoder, the conditional distribution is concentrated on the single vector assigned to x. Drawing x still makes the aggregate a distribution.
The training procedure compares sample sets. To form the encoded set, it takes sentences from the data and obtains a latent vector for each. To form the reference set, it draws vectors directly from the prior. Maximum mean discrepancy, abbreviated MMD, measures how different those sets are through a kernel. A kernel supplies a similarity value for a pair of vectors. In the distribution-level definition, it also defines a space of functions in which the two distributions can be compared by their mean representations.
MMD(P, Q) = ‖∫ k(z, ·) dP(z) − ∫ k(z, ·) dQ(z)‖ₕₖ
Here P and Q are the two distributions under comparison, and z is the latent vector integrated over each one. The kernel k associates each z with a function of a second argument, represented by the dot. The integrals average those functions under P and Q. The norm measures the size of the difference between the two averages in Hₖ, the reproducing kernel Hilbert space associated with k. The subscript on the norm identifies that space. In the WAE application, the distributions being compared are the prior and the aggregated posterior.
The paper describes an inverse multiquadratic kernel for this comparison. A pair of nearby vectors has a greater similarity than a pair farther apart. The constant in the kernel determines how the similarity falls with squared distance.
k(u, v) = C / (C + ‖u − v‖²)
Here u and v are the two vectors being compared, k is their kernel similarity, C is the kernel constant, and ‖u − v‖² is the squared Euclidean distance between them. The norm here measures distance between vectors in the latent space. The norm in the preceding definition measures a difference in the space of kernel functions.
In training, the authors use the pairwise sample form. There is a term for similarities between distinct members of the encoded set, another for distinct members of the prior set, and a cross term comparing the two sets. The pairwise form estimates squared discrepancy. The cross comparison uses all pairs with one member from each set, whereas the within-set comparisons leave out self-pairs.
MMD̂ = [1 / (N(N − 1))] ∑ₙ≠ₘ k(z⁽ⁿ⁾, z⁽ᵐ⁾) + [1 / (N(N − 1))] ∑ₙ≠ₘ k(z̃⁽ⁿ⁾, z̃⁽ᵐ⁾) − [2 / N²] ∑ₙ,ₘ k(z⁽ⁿ⁾, z̃⁽ᵐ⁾)
Here MMD̂ is the empirical penalty in the WAE loss. Each set supplies N vectors. The indices n and m identify draws, with n ≠ m excluding matches of an index to itself in the within-set sums. A plain z⁽ⁿ⁾ is a vector obtained by sampling an input and encoding it, while z̃⁽ⁿ⁾ is a direct draw from the prior. The symbol k is the kernel. The first two coefficients average ordered pairs of distinct indices within each set. The last sum includes all cross-set pairs, normalized by N². Its minus sign and factor 2 account for the cross contribution when taking the squared difference between the mean representations.
Jᵥᵥ = Jᵣₑ꜀ + λᵥᵥ MMD̂
Here Jᵥᵥ denotes the WAE objective, and λᵥᵥ is the coefficient written as λ with subscript WAE in the paper. It sets the weight of the empirical MMD penalty MMD̂ relative to the reconstruction loss Jᵣₑ꜀. The same reconstruction calculation applies to the vector actually passed into the decoder, whether it is deterministically assigned or sampled from an encoder distribution.
An adversarial loss is another way to compare the encoded population and the prior. The authors mention that their preliminary trials found broadly similar behavior and a slight advantage for MMD. The experiments they report use the kernel penalty. The comparison to the prior works at the level of the collection whichever kind of encoder supplies the vectors.
Why a Gaussian can become effectively deterministic
A Gaussian encoder introduces a useful distinction between shifting its center and changing the size of a random perturbation. The paper studies the second operation one coordinate at a time. The draw is written as the mean plus a standard normal noise term scaled by the predicted standard deviation. This exposes how an objective evaluated at the draw can pass a gradient back to the scale.
zᵢ⁽ʲ⁾ = μᵢ + σᵢ ε⁽ʲ⁾, ε⁽ʲ⁾ ∼ 𝒩(0, 1)
Here zᵢ⁽ʲ⁾ is coordinate i of sample j. The coordinate mean is μᵢ and its standard deviation is σᵢ. The sampled perturbation ε⁽ʲ⁾ has a standard normal distribution, denoted by 𝒩 with scalar mean 0 and variance 1. The tilde indicates that ε⁽ʲ⁾ is drawn from that distribution. With a small σᵢ, draws remain near μᵢ.
gᵢ = (∂J / ∂zᵢ)|_{zᵢ = μᵢ}
Here gᵢ is the derivative of the training objective J with respect to latent coordinate zᵢ, evaluated at the mean μᵢ. The symbol ∂ denotes a partial derivative, and the vertical bar specifies the point of evaluation. In the appendix, gᵢ is the starting value for approximating the derivative at nearby samples.
gᵢ⁽ʲ⁾ = (∂J / ∂zᵢ)|_{zᵢ = zᵢ⁽ʲ⁾} ≈ gᵢ + kᵢ(zᵢ⁽ʲ⁾ − μᵢ) = gᵢ + kᵢ σᵢ ε⁽ʲ⁾
Here gᵢ⁽ʲ⁾ is the derivative of J evaluated at the sampled coordinate zᵢ⁽ʲ⁾. The approximation sign marks the local Taylor approximation. It starts with the derivative gᵢ at the mean and adds the displacement from μᵢ multiplied by kᵢ, the local second derivative along coordinate i. The paper writes that curvature as k in the proof, independently of the kernel used for MMD. Substituting the sampled displacement gives the final expression involving standard deviation σᵢ and noise ε⁽ʲ⁾.
Eε[∂J / ∂σᵢ] = Eε[gᵢ⁽ʲ⁾ ε⁽ʲ⁾] ≈ Eε[gᵢ ε⁽ʲ⁾ + kᵢ σᵢ (ε⁽ʲ⁾)²] = kᵢ σᵢ
Here Eε averages over the standard normal perturbation ε⁽ʲ⁾. The derivative on the left is the gradient of J with respect to coordinate scale σᵢ. The chain rule multiplies the sample derivative gᵢ⁽ʲ⁾ by the derivative of the sample with respect to the scale, which is ε⁽ʲ⁾. In the local approximation, the term with the mean-point derivative gᵢ averages away because the noise is centered. The squared noise has unit expectation, leaving the curvature kᵢ times the scale σᵢ.
Near a locally convex optimum, positive curvature makes the expected gradient point toward smaller scales under gradient descent. The argument assumes that the scale starts small enough for the local approximation and that all scale gradients arrive through the sampled vector. When the scales shrink to zero, the Gaussian is concentrated at its mean, a limiting distribution called a Dirac delta. A different input can still have a different mean. Thus the mechanism concerns the loss of randomness around a sentence code, while the VAE problem concerns loss of information about the sentence itself.
Giving the scale its own training signal
The auxiliary term compares the encoder’s predicted Gaussian with a unit-covariance Gaussian centered at that same predicted mean. If the means move, the target centers move with them. The term therefore regulates spread directly and leaves the centers available to serve reconstruction and aggregate matching. A small covariance has a cost even when the decoder has little reason to ask for larger perturbations.
J = Jᵣₑ꜀ + λᵥᵥ MMD̂ + λₖₗ ∑ₙ KL(𝒩(μₚₒₛₜ⁽ⁿ⁾, diag((σₚₒₛₜ⁽ⁿ⁾)²)) ∥ 𝒩(μₚₒₛₜ⁽ⁿ⁾, I))
Here J is the stochastic WAE objective with the auxiliary term. The reconstruction cost Jᵣₑ꜀ and λᵥᵥ times MMD̂ are the ordinary WAE terms. The coefficient λₖₗ sets the weight on the additional KL divergence, summed over examples indexed by n. The first Gaussian 𝒩 uses the predicted mean μₚₒₛₜ⁽ⁿ⁾ and diagonal variances from the squared standard deviations σₚₒₛₜ⁽ⁿ⁾. The target Gaussian uses the same mean and identity covariance I. The double bar separates the predicted distribution from the target in the directional KL calculation.
The appendix explains the effect using the KL formula for Gaussian distributions. Writing the second argument of each Gaussian as a variance gives the following expression.
KL(𝒩(μ₁, σ₁²) ∥ 𝒩(μ₂, σ₂²)) = log(σ₂ / σ₁) + [σ₁² + (μ₁ − μ₂)²] / (2σ₂²) − 1/2
Here μ₁ and μ₂ are the scalar means of the first and second Gaussian. Their standard deviations are σ₁ and σ₂, and their variances are the corresponding squared quantities. The symbol 𝒩 denotes each Gaussian. The logarithm takes the ratio of the target scale to the predicted scale. The middle fraction depends on the predicted variance and squared distance between the means relative to the target variance. The final constant gives zero divergence when the two distributions coincide.
In the auxiliary loss, the difference between the means is zero and the target scale is one. With independent coordinates, the KL terms add over the latent dimensions. The authors interpret the new objective as a penalty-based relaxation of minimizing the ordinary WAE loss while bounding the sum of these deviations. The appendix absorbs the additive constant from the Gaussian formula into the constraint bound.
∑ₙ ∑ᵢ [−log σᵢ⁽ⁿ⁾ + (σᵢ⁽ⁿ⁾)² / 2] < C
Here n indexes examples, i indexes latent coordinates, and σᵢ⁽ⁿ⁾ is the predicted standard deviation for the indicated coordinate of the indicated example. The logarithm makes small scales costly, while the squared term grows for large scales. The inequality compares the resulting sum with a constant bound C. This C plays a separate role from the constant in the MMD kernel. The ordinary WAE objective would be minimized subject to the bound in the constrained version. In the implemented objective, the added KL term supplies a cost that can be traded against reconstruction and aggregate matching.
The penalty is smallest when the predicted covariance agrees with the target. Its weight determines how far training can move from that target in exchange for a better result on the other terms. Once an individual draw varies more, the decoder may find the exact source sentence harder to recover. In dialogue, variability in the code provides a route to varied replies, provided the decoder responds to the resulting changes.
Training the stochastic Wasserstein sentence autoencoder
The steps in order.
How the training runs were configured
Both tasks use single-layer LSTMs and feed the latent vector at every decoder step. The authors train with Adam using β₁ = 0.9 and β₂ = 0.999. These coefficients govern the optimizer’s running estimates of the gradient and its square. The batch size is 128 in both experiments, and the maximum sequence length is 20. The recurrent and latent dimensions differ between the sentence and dialogue experiments.
For SNLI, the LSTM hidden dimension is 100d and the latent dimension is 100d. Word embeddings are 300d and pretrained on SNLI. The vocabulary size is 30,000. The setup runs for 20 epochs at a fixed learning rate of 0.001. In this experiment, the target is the input sentence. The authors also draw directly from the prior to evaluate the decoder as an unconditional sentence generator.
For dialogue, the LSTM hidden dimension is 500d and the latent dimension is 300d. The 300d word embeddings are pretrained on DailyDialog, and the vocabulary size is 20,000. The setup runs for 200 epochs. The learning rate starts at 0.001, uses multiplicative decay of 0.98 and has a minimum of 0.00001. The encoder reads an utterance and the decoder learns to produce a reply in place of a copy of the input. The dialogue systems’ variational and Wasserstein hyper-parameters are selected from the sentence-generation comparison.
For the VAE, the authors use a sigmoid schedule for its KL weight. They monitor the weighted KL contribution and stop increasing the weight when that quantity reaches its peak. They call the procedure peaking annealing. Word dropout starts at zero and rises by 0.05 each epoch until it reaches 0.5. In the WAE experiments the aggregate penalty is used without an annealing schedule, and the decoder is trained without word dropout. The authors release their implementation and make the cleaned dialogue test data available.
Experiments and results
SNLI tests reconstruction and independent sampling
The SNLI experiment uses sentences from the Stanford Natural Language Inference corpus. Here the sentences supply a domain for learning to reconstruct and generate text. The authors describe the corpus as large and the sentences as comparatively simple, with image-description content. The question is how well the systems handle that kind of sentence under two access patterns. A reconstruction begins with a particular sentence and uses its encoding. An unconditional generation begins with a draw from the same standard normal prior used in the probabilistic objectives.
The baselines are a deterministic autoencoder, DAE, and the annealed VAE. WAE-D denotes a Wasserstein autoencoder with a deterministic encoder, while WAE-S denotes the Gaussian version. The deterministic autoencoder is included in the sampling comparison by giving its decoder draws from the standard normal, even though its training has imposed no matching requirement. That is a test of a specific sampling choice for this baseline. It also provides a contrast with WAE-D, which learns deterministic codes while explicitly making their distribution accessible from the prior.
Reconstruction is measured by BLEU, a surface-overlap score. In this use, the reconstructed sentence is compared with the original. High BLEU indicates that much of the wording has been recovered. That is useful for the specific task of copying, where the known original is the intended output. The other measurements evaluate sentences generated from independent prior draws. Consequently a system’s reconstruction BLEU and sampling perplexity answer questions about different outputs.
Reconstruction BLEU on SNLI
The deterministic Wasserstein setting nearly matches the deterministic autoencoder.
The numbers
| System or setting | BLEU |
|---|---|
| DAE | 86.35 |
| VAE with KL annealing | 43.18 |
| WAE-D, WAE weight 3 (this paper) | 86.03 |
| WAE-D, WAE weight 10 | 84.29 |
| WAE-S, auxiliary weight 0.0 | 75.66 |
| WAE-S, auxiliary weight 0.01 | 82.01 |
| WAE-S, auxiliary weight 0.1 | 47.63 |
The DAE reaches 86.35 on SNLI reconstruction BLEU. Among the Wasserstein settings, WAE-D with aggregate weight 3 comes closest at 86.03. WAE-D with weight 10 reaches 84.29. The annealed VAE reaches 43.18. The comparison supports the paper’s explanation that a penalty operating on the aggregate can leave more room for sentence-specific reconstruction information than the per-input variational penalty did in these runs.
With the Gaussian encoder, the results depend on the auxiliary KL weight. SNLI reconstruction BLEU is 75.66 at 0.0, 82.01 at 0.01 and 47.63 at 0.1. The middle setting is the authors’ preferred compromise among reconstruction, fluency and resemblance to the corpus. The reconstruction values alone already show why the weight cannot be interpreted as a dial that monotonically trades copying ability for variety. Adding the smaller penalty improves reconstruction over the version without the penalty. A further increase accompanies a much lower reconstruction score. These are outcomes of separately trained systems whose centers, scales and decoders can all change.
What comes out of prior draws
The first sampling measure is perplexity, abbreviated PPL. The authors use a separate n-gram predictor trained on Wikipedia. It scores the generated sentences by the probabilities it assigns to their word sequences. Lower perplexity means the sequences were easier for this external predictor to anticipate. The paper uses that as a proxy for fluency. The score is also sensitive to whether the generator chooses familiar sequences, so the authors report distributional statistics alongside it.
Perplexity of sentences sampled in the SNLI experiment
The strongest auxiliary penalty gives the lowest perplexity, while the preferred compromise preserves more reconstruction accuracy.
The numbers
| System or setting | PPL |
|---|---|
| DAE | 146.2 |
| VAE with KL annealing | 79.4 |
| WAE-D, WAE weight 3 | 113.8 |
| WAE-D, WAE weight 10 | 104.9 |
| WAE-S, auxiliary weight 0.0 | 115.2 |
| WAE-S, auxiliary weight 0.01 (this paper) | 84.9 |
| WAE-S, auxiliary weight 0.1 | 62.5 |
In the SNLI sampling experiment, DAE has perplexity of 146.2. WAE-D has 113.8 at aggregate weight 3 and 104.9 at weight 10. The annealed VAE has 79.4. WAE-S has 115.2 with auxiliary weight 0.0 and 84.9 with weight 0.01. At 0.1 it reaches 62.5, the lowest value in the comparison. This last stochastic setting also exceeds the annealed VAE in reconstruction BLEU, though the preferred WAE-S balance recovers much more of the input. The paper’s choice of a compromise depends on inspecting both axes.
Unigram KL, or UniKL, compares the generated word-frequency distribution with the distribution in the SNLI training corpus. Lower is better under that measure. At the level of a single word, it can detect that sampling makes some vocabulary much more or less common than in the data. The order of the words is outside its scope. The DAE has UniKL of 0.178. The annealed VAE has 0.081. The WAE-D values are 0.071 at aggregate weight 3 and 0.073 at weight 10. The stochastic settings at auxiliary weights 0.0, 0.01 and 0.1 have UniKL of 0.069, 0.058 and 0.150, respectively. The setting with the lowest perplexity is therefore substantially farther from the training word distribution than the preferred compromise.
The remaining reference statistics are the entropy of the corpus word distribution and average sentence length. Entropy describes how spread out word usage is across the vocabulary. The paper treats proximity to the corpus value as desirable for both statistics. The corpus has entropy of 5.65 and average length of 9.6. DAE samples have entropy of 6.23 and average length of 11.0. The annealed VAE has entropy of 5.04 and average length of 8.8. The two WAE-D settings have entropy of 5.59 and 5.57, with average length of 10.0 and 9.9, for aggregate weights 3 and 10, respectively.
For WAE-S, the zero-penalty setting has entropy of 5.61 and average length of 9.9. At auxiliary weight 0.01, entropy is 5.26 and average length is 9.4. At 0.1, entropy falls to 4.65 and average length is 8.7. The strong-penalty setting’s advantage on perplexity comes with less dispersed word use. The weaker setting does better on unigram KL and sentence length, while the setting without the auxiliary penalty is closer to corpus entropy. Those measures capture different properties of the same generated text, so each can favor a different setting.
The paper also presents actual prior samples. The deterministic autoencoder’s samples include jumbled word sequences and phrases with awkward local connections. Samples from the annealed VAE cover several situations but include combinations that read awkwardly. The deterministic WAE frequently stays within the familiar scene-description style of the corpus. The stochastic WAE at the preferred weight supplies examples with changes in who is pictured, what they are doing and where the scene takes place, along with implausible or awkward details. These examples let a reader inspect qualities that word-frequency statistics cannot express. They are examples of individual decodes from the prior, so each line starts from a different latent draw.
DailyDialog tests replies to an utterance
The second experiment uses DailyDialog. Its input is an utterance and its output is a reply. DED denotes the deterministic encoder-decoder baseline. VED is its variational counterpart. WED-D and WED-S are the Wasserstein systems with deterministic and stochastic encoders, respectively. This setting gives the stochastic encoder a direct role because the input can remain fixed while the hidden vector varies.
The test set required a change before the authors reported the comparison. In a pilot run, a plain recurrent sequence-to-sequence system trained for 200 epochs reached BLEU-4 of 6. The paper reports earlier DailyDialog BLEU-4 values of 0.009 and 2.84, which motivated an investigation of the split. The authors found overlap between the training and test sets and removed duplicate data from the test set used for their results. The pilot value and the earlier results concern the original evaluation conditions. The scores below concern the cleaned test data, on which the authors make their comparisons within the paper.
The dialogue quality metrics are BLEU-2 and BLEU-4. They count overlapping word sequences with the reference response, with BLEU-4 including longer sequences in its calculation. On the cleaned test set, DED scores 3.96 on BLEU-2 and 0.85 on BLEU-4. VED scores 3.26 and 0.59, respectively. WED-D has the highest values, 4.05 and 0.98. WED-S scores 3.72 and 0.69. Thus WED-S outperforms VED on both overlap measures, while WED-D leads the remaining systems.
The authors also measure entropy and how often the generated text uses distinct word sequences. Dist-1 concerns distinct unigrams, and Dist-2 concerns distinct bigrams. They are set-level measurements taken over the generated test responses. The choice of these distinctness measures follows earlier work on diversity in neural conversation. The test references supply a separate point of comparison for how varied human-written responses are in this set.
Dist-2 on the cleaned DailyDialog test set
The stochastic Wasserstein encoder-decoder leads the generated replies in bigram diversity.
The numbers
| System or setting | Dist-2 |
|---|---|
| DED | 0.275 |
| VED | 0.204 |
| WED-D | 0.272 |
| WED-S (this paper) | 0.309 |
On the cleaned DailyDialog test set, the reference responses have entropy of 6.15, Dist-1 of 0.077 and Dist-2 of 0.414. DED produces entropy of 5.55, Dist-1 of 0.044 and Dist-2 of 0.275. VED has entropy of 5.45, Dist-1 of 0.053 and Dist-2 of 0.204. WED-D has entropy of 5.53, Dist-1 of 0.042 and Dist-2 of 0.272. WED-S leads the generated responses with entropy of 5.59, Dist-1 of 0.066 and Dist-2 of 0.309. The references remain ahead on each of these diversity measures.
Together, the dialogue scores report a difference between matching references and broadening the vocabulary and phrasing used in the reply collection. The deterministic Wasserstein encoder has the best reference overlap. The stochastic encoder has the greatest output diversity, with both BLEU scores still higher than those of the variational encoder-decoder. The paper’s claim about the stochastic variant is strongest against that variational baseline. Against the deterministic Wasserstein variant, the outcome depends on the metric and the purpose of the generation task.
What the ablations show
Changing the auxiliary weight changes the spread
The most direct check of the proposed mechanism is the histogram of predicted standard deviations for the Gaussian WAE on SNLI. It examines the encoder’s output parameters. It can therefore test whether nominally stochastic encoding actually leaves any substantial room for a draw to vary. The histogram uses 200 buckets over the range from 0 to 1. With the auxiliary coefficient set to 0, most of the predicted scales collect near 0. This is the experiment that comes closest to the conditions of the first theorem, since the scale receives its training signal through the sampled code.
The histogram is informative because aggregate matching alone could look successful while leaving conditional spread almost absent. Codes for different sentences may still vary widely in location. The scale values reveal that a fixed sentence can have very little variability in its code even in that situation. Applying the auxiliary KL gives the scales their own objective. The paper uses the histogram and the comparison across settings to support its claim that the penalty keeps the stochastic encoder from becoming effectively deterministic.
The middle and strongest auxiliary settings separate preserving spread from maximizing the quality of every output. The increase from 0.0 to 0.01 in the SNLI comparison accompanies better reconstruction BLEU, lower perplexity and lower unigram KL. At 0.1, perplexity improves further, while reconstruction BLEU and resemblance to the corpus word distribution worsen. The test demonstrates why it matters to report the intended use of a setting. A configuration chosen for external-predictor fluency and one chosen for preserving words from the source can lead to different conclusions about the same penalty.
A comparison between WAE-D and WAE-S provides a complementary check, with a different interpretation. In WAE-D, the absence of within-input variation is built into the encoder. In WAE-S at zero auxiliary weight, it emerges during training. Their SNLI scores differ. For example, WAE-S at 0.0 achieves 75.66 reconstruction BLEU, while the reported WAE-D settings achieve 86.03 and 84.29. The proof concerns the limiting behavior of scales under its assumptions. As the authors point out, the training trajectory of a Gaussian encoder can differ from the path taken by a deterministic encoder even if the eventual codes have very little spread.
Changing aggregate matching inside the deterministic WAE
The WAE-D comparison at weights 3 and 10 shows what happens as the paper gives the aggregate penalty more influence without introducing an input-dependent sampling scale. At the higher weight, SNLI reconstruction BLEU is lower and prior-sample perplexity is lower. The higher weight therefore improves the fluency proxy in this comparison while sacrificing some copying performance. The lower weight produces the lower unigram KL of the two, so the fluency comparison cannot stand in for all forms of resemblance to the corpus.
This comparison helps isolate the role of aggregate regularization. WAE-D can generate from prior draws in spite of assigning a fixed vector to each input, and adjusting its penalty changes properties of those prior samples. The stochastic penalty addresses a different level of variation. The authors can vary the geometry of the collection even when the encoder has no variance parameter, then reintroduce variance when they want the same input to support a range of codes.
The displayed dialogue variants show a practical consequence of using those two encoder choices. Compared with WED-D, WED-S has higher entropy and higher distinctness at both word-sequence orders. WED-D has higher BLEU on both measures. This is a system-level comparison of the implementations selected for dialogue, rather than a sweep over dialogue-specific auxiliary weights. It supports the association between the stochastic implementation and more varied responses in the corpus-level evaluation.
Varying the VAE schedule and inspecting the outputs
The authors also train VAEs without KL annealing. Their learning curves display the weighted KL term under different fixed coefficients and contrast those runs with annealing. With an overly large fixed coefficient, the KL term falls to zero and the authors diagnose that the decoder ignores the encoded input. With a very small coefficient, the weighted contribution also becomes small, but the paper gives a different interpretation. There is too little pressure from the prior for the variational component to materially shape the reconstruction objective, and the encoder tends toward deterministic behavior. The weighted curve is consequently best interpreted together with the coefficient and the output samples. A small product can arise from a small divergence or a small multiplier.
The examples from a VAE trained without annealing show how low variety manifests. The generated sentences repeatedly return to closely related scenes about a man playing an instrument or interacting with a dog. The annealed VAE samples cover more situations. The qualitative contrast provides a visible outcome consistent with the learning curves. Because the displayed examples come from prior draws, they illustrate limited responsiveness to changes in that draw, as opposed to changes in the wording of an input.
The appendix also considers a variational approach using distributions on a sphere. As described in the paper, the prior is uniform on the surface of a unit hypersphere, and the encoder uses a posterior on the same surface. With the concentration parameter κ fixed, the KL term stays constant and annealing is unnecessary. The authors report reproducing the reconstruction negative log-likelihood used for that comparison, while the displayed prior samples contain conspicuous repetition of words and incomplete constructions. They discuss the cost of fixing concentration for a system meant to learn uncertainty, and report that allowing the uncertainty parameter to be learned brings back the collapse problem in the earlier study. The appendix uses this example to distinguish stability in the objective from the quality of generated sentences.
Limitations
Qualifications the authors give
The first theorem applies under the conditions used in the local argument. The standard deviations have to begin small relative to how quickly the objective changes around the mean. The scale gradient must come completely through the sampled vector. The sign of the expected update follows from positive local curvature near an optimum. These conditions explain why the authors pair the argument with the SNLI histogram. The proof identifies a tendency in a particular regime, and the histogram checks whether concentrated scales actually arise in their setting. The authors expressly distinguish this tendency from equality of the results produced by deterministic and stochastic training trajectories.
The paper also qualifies which hyper-parameter setting to choose. The stochastic WAE that scores best on perplexity comes with markedly lower reconstruction BLEU and a larger unigram discrepancy. The authors favor the setting they judge to offer a better balance, with the aggregate weight at 10.0 and the auxiliary weight at 0.01. Their simpler training claim concerns removing the annealing schedule and word dropout in the WAE runs. The distribution penalties still have coefficients, and the tables show why their values matter.
The DailyDialog result has a specific comparability limit. Deleting test examples that overlap with training changes the evaluation relative to earlier work on the original split. The authors use the cleaned set to compare their own systems and explicitly rule out a straightforward comparison with earlier reported scores. The dialogue experiment therefore gives evidence about choices among the four evaluated systems under one cleaned test protocol.
Limits of the evidence from the setup
Reconstruction BLEU measures preservation of wording more directly than preservation of meaning. A code that supports accurate copying can retain lexical and positional details without organizing them into sentence properties that are easy to control. The reverse case is possible too. A decoder can produce a sensible reformulation and score lower because the target is the original string. The reconstruction results establish how much text the systems recover under the paper’s evaluation. The paper’s broader discussion of useful continuous representations goes beyond what that score measures by itself.
The sampling evidence likewise gives several partial views of quality. The Wikipedia-based predictor scores how familiar a generated sequence looks to its own learned word statistics. Entropy and UniKL describe word usage. Average length describes the size of the output. The qualitative samples reveal problems of grammar and plausibility that these scores can miss, but a small set of examples cannot establish how common each problem is. The paper associates the WAE with smoothness and continuity, yet the numerical comparisons chiefly evaluate reconstruction and independent prior sampling. They do not map how sentence meaning changes along paths through the latent space.
The histogram measures predicted uncertainty in latent coordinates. Those scales are optimized for the auxiliary target and the generation objectives. The experiment supplies no direct test of whether a larger predicted scale corresponds to a genuinely more ambiguous utterance. The constraint interpretation also stops short of such a test. Bounding the covariance penalty restricts a family of posteriors. It gives the decoder opportunities to encounter different vectors, but still leaves open how it uses that variation. A meaningful change in a reply’s content is a property of the encoder and decoder together.
Dialogue distinctness and entropy are measured across generated test responses. A larger value can reflect more variation across different inputs, more variation when one input is sampled repeatedly, or both. The scores do not isolate those sources. A direct measure of the conditional behavior would have to examine groups of replies to the same utterance. Reference overlap also assigns value to wording shared with the recorded reply, while the motivating problem is that several different replies may be suitable. The reported BLEU and diversity results show changed output behavior, with appropriateness to a fixed input left less directly tested.
The scope of the training comparison is the recurrent setup used in these two experiments. SNLI supplies relatively simple sentences, and both tasks use a maximum sequence length of 20. The comparisons establish that these WAE configurations can be trained without the scheduling interventions used for the paper’s VAE baseline. They provide no measured comparison for longer sequences, other domains or other decoder architectures. The fixed-weight appendix does help explain why a particular VAE training recipe is difficult. The selected annealing and dropout procedure is still one implementation of a variational baseline, so the numerical gaps describe the reported comparison.
Finally, the empirical MMD penalty is estimated from batches, while the ideal constraint is agreement between full distributions. A favorable sample-based comparison gives the training procedure a signal about that agreement. The sentence scores test whether useful outputs result when the prior is used in practice. Neither measurement establishes exact equality between the aggregate and the prior or guarantees that all regions covered by the prior will decode to equally good sentences. The DAE and WAE sampling comparison is informative precisely because it evaluates actual prior draws under each training objective.
What came after
Towards Cross-Tokenizer Distillation: the Universal Logit Distillation Loss for LLMs (2024) cites the stochastic Wasserstein autoencoder paper. It concerns distillation across different tokenizers, the procedures that divide text into units before a system makes predictions. In distillation, one system learns from another system’s predictions. The title identifies the proposed loss as operating on logits, the scores used to form probabilities over output choices.
The two papers address distribution comparisons at different points in a generator. Bahuleyan and colleagues compare sets of continuous sentence codes with an agreed prior. That comparison regulates the space the decoder receives as input. Cross-tokenizer distillation concerns output scores from systems whose prediction units are defined by different tokenization procedures. Its comparison therefore concerns what the systems predict over, as well as how to use one system’s scores to guide another.
The citation establishes that the earlier paper is part of the later work’s context. The specific role of the citation is undetermined. The available description of the later work identifies its problem and its proposed logit loss, while leaving open whether it adopts any element of the aggregate matching, Gaussian encoder or covariance penalty studied by Bahuleyan and colleagues.
Cite
Cite as Hareesh Bahuleyan, Lili Mou, Hao Zhou and Olga Vechtomova. 2019. Stochastic Wasserstein Autoencoder for Probabilistic Sentence Generation. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers).
@inproceedings{bahuleyan2019stochastic,
title = {{Stochastic Wasserstein Autoencoder for Probabilistic Sentence Generation}},
author = {Hareesh Bahuleyan, Lili Mou, Hao Zhou and Olga Vechtomova},
booktitle = {Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)},
year = {2019},
doi = {10.18653/v1/n19-1411},
url = {https://doi.org/10.18653/v1/n19-1411}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/bahuleyan-2019-stochastic-wasserstein-autoencoder-probabilistic-sentence/