Proposition 4I.13.P0447 of 100 in the corpus
The KL term puts a price on the code, and a code priced too high is ignored.
The ELBO trades a rate against a distortion. For a linear decoder the trade is exact: raising the weight on the rate shrinks the code until, past a threshold, the decoder stops using it. The rate pays for information and for every hole the prior does not cover.
Rate and distortion
Average the ELBO over the data and give its two terms names. The average KL term is the rate : the cost, in nats, of the code relative to the prior. The average reconstruction term, negated, is the distortion. With a Gaussian decoder of fixed variance the distortion is the mean squared error , up to the factor and a constant, and the ELBO is minus their sum.
Higgins and colleagues (2017) put a weight on the rate and found that gave codes whose coordinates varied more independently. A weight changes which point on the trade-off training reaches. Alemi and colleagues (2018) drew that trade-off as a curve in the plane of rate and distortion, and showed that models with the same ELBO can sit at very different points of it. The ELBO alone does not say how much the code is used.
The linear β-VAE, solved exactly
Keep probabilistic PCA’s decoder with one latent dimension and fixed, and let the encoder be any Gaussian for each input. Write and . The -weighted ELBO of one input is a quadratic in and a sum of and , so the best encoder can be found by setting two derivatives to zero:
At this is the exact posterior of (I.13.2). Substituting back and averaging over the data, using for along , leaves a function of alone whose derivative is
It is positive until and negative after. If it is never positive, and the best is zero. Evaluating the rate and the distortion at the optimum gives
A linear β-VAE trades rate for distortion and switches off past a threshold.
the last two while . Past the threshold the rate is zero and the distortion is the total variance. This is I.13.T3, and I.13.B03 derives every line.
On the four points, with , and , (I.13.8) gives a rate of and a distortion of . The figure draws the curve:
| rate | |||
|---|---|---|---|
At the solution is probabilistic PCA, and the rate is the price of the code found in proposition 2. As the distortion falls to , which is the principal-axis autoencoder’s loss in I.12, and the rate grows without bound: the encoder’s variance goes to zero and the code becomes a point. The deterministic autoencoder of I.12 is the corner of this curve where the code is free and infinitely expensive.
Posterior collapse
At the optimum is . The decoder ignores the code, the encoder returns the prior for every input, the rate is zero and the distortion is , the whole variance of the data. That is posterior collapse, and here it is not a failure of optimisation. It is the maximum of the objective: the variance the code could explain, , is not worth its price, .
With and learned, the same threshold appears per direction: probabilistic PCA gives zero weight to every direction whose eigenvalue does not exceed the noise variance. Lucas, Tucker, Grosse and Norouzi (2019) showed that linear VAEs collapse exactly where probabilistic PCA does, and that the ELBO adds no bad maxima of its own. The threshold is the one weight decay imposed in (I.12.6), with in place of .
Nonlinear decoders add a second route. A decoder powerful enough to model well without , such as one that predicts each word of a sentence from the words before it, can reach a good reconstruction term at zero rate. The KL term is then pure cost, and training removes the code. Bowman and colleagues (2016) met this with sentence VAEs. They annealed the KL weight up from zero during training, and weakened the decoder by hiding some of its input words, so that the code had work to do.
What the rate pays for
The rate is an average over the training examples, indexed by . Write for the aggregate posterior, the average of the encoder’s distributions. Then
The rate pays for information in the code and for mismatch with the prior.
To see it, write each as plus . The first averages to the mutual information between the code and the index of the example (Mutual information 0.IT.04), the second to the KL from the aggregate posterior to the prior. Hoffman and Johnson (2016) introduced this split. It is I.13.T4.
Both parts mean something. Zero rate forces zero information: collapse is exactly a code that says nothing about which example it came from. And the second part is the hole problem of I.12, given a price. Where is thin and the prior is not, codes drawn for generation land in places the decoder rarely saw in training.
On the four points at , every encoder distribution has variance and mean , so is a mixture of two Gaussians. The rate splits into of information and of mismatch (I.13.X06). The mixture has variance exactly , like the prior, but not its shape: at its density is where the prior’s is . The prior draws codes near zero more than twice as often as the encoder produced them.
What the variational autoencoder fixed, and what it did not
Against I.12 it fixed three things. Codes have a distribution, so new ones can be drawn. The space between training codes is trained, because each input is decoded from a cloud of codes. And the objective is a lower bound on the likelihood, which an autoencoder never offered.
Three things remain. The bound can be loose, and proposition 2 showed the gap cannot be measured on its own. The holes are priced, not removed. And a Gaussian decoder still returns a conditional mean, so ambiguous inputs are reconstructed as blurred averages, for the reason given in I.12.X08.
The curve, in six lines
from math import log
lam1, lam2, var = 4.0, 1.0, 1.0
for beta in (0.25, 0.5, 1, 2, 4, 8):
r = max(lam1 - beta*var, 0.0) # ||w||^2 at the optimum
rate = 0.5*log(lam1/(beta*var)) if r > 0 else 0.0
distortion = lam2 + beta*var if r > 0 else lam1 + lam2
print(f"beta {beta}: ||w||^2 {r:.2f}, rate {rate:.6f}, distortion {distortion:.2f}")
It prints the table above with and added: rate with distortion , and a collapsed code with distortion . The check script compares these closed forms with a direct maximisation of the averaged objective.
Sources
Depends on
Used by
Nothing yet.
Problems using this
- I.13.B03 — When the code switches offlimit▲▲△
- I.13.X04 — A point code has unbounded ratelimit▲▲△
- I.13.X06 — The rate splits into information and a mismatchprobability▲▲△
- I.13.X07 — A mean reduction weights the KL by the input widthshape▲▲△
- I.13.X09 — The rate is information plus mismatch, for any encoderproof▲▲▲
- I.BOOK.B08 — Depth adds nothing to a linear autoencoderproof▲▲▲