Paper commentary
Adversarial Autoencoders
Adversarial autoencoders turn a plain autoencoder into a generative model
- Problem Plain autoencoders learn hidden codes with no reliable link to a sampling distribution. Their decoders therefore cannot turn prior samples into realistic data.
- Method The adversarial autoencoder adds a discriminator to the hidden code. It pushes the code distribution toward a chosen prior, so the decoder maps prior samples to data.
- Results On real-valued MNIST, it reaches a Parzen window log-likelihood of 340 ± 2 with 10K generated samples. Ladder Networks and GAN are not the comparison here; GAN reaches 225 ± 2.
Why an autoencoder needs a prior to generate
Deep generative models such as RBMs, DBNs and DBMs were trained mostly with MCMC algorithms, and their gradient estimates become less accurate as training proceeds. The cause is that chains drawn from the model mix between modes too slowly for the estimate to stay reliable. Later models such as VAEs, importance weighted autoencoders and GANs can be trained with direct back-propagation and avoid that difficulty.
An ordinary autoencoder learns to reconstruct its inputs, but nothing in its objective forces the codes into a region that a sampler can reach. Without a regularizer the code distribution can take whatever shape reconstruction favors, so drawing codes from a simple prior need not land where the decoder has learned to produce data. The question is therefore whether the hidden code can be pushed toward a chosen prior while the autoencoder keeps its reconstruction objective, so that the decoder becomes the generator.
Pushing the code distribution toward a prior adversarially
A GAN is a min-max game between a generative model G and a discriminative model D. D estimates the probability that a point came from the data rather than from the generator, while G maps prior samples into data space and tries to fool D. Training alternates between updating D to separate true samples from generated ones and updating G to fool it.
The adversarial autoencoder keeps the encoder and decoder of an ordinary autoencoder but attaches a discriminator to the hidden code z. Encoding the data gives an aggregated posterior q(z) equal to the integral over x of q(z|x) times p_d(x) dx, and the discriminator works to make this q(z) match the prior p(z). The encoder doubles as the generator of the adversarial network, so the same network that compresses an image also produces the codes the discriminator judges.
Each mini-batch passes through two steps, and both use SGD. In the reconstruction phase, the encoder and decoder are updated to lower the reconstruction error of the inputs. In the regularization phase, the discriminator is first updated to separate prior samples from hidden codes, and then the encoder is updated to fool it. After training, the decoder alone turns prior samples into data-like outputs.
Deterministic, Gaussian or universal approximator encoders
The encoder q(z|x) can be chosen in three ways. A deterministic encoder makes z a function of x, so the only randomness in q(z) comes from the data distribution. A Gaussian posterior predicts a mean and variance for each dimension, and the re-parametrization trick of Kingma and Welling lets gradients pass through the encoder. The universal approximator version feeds x together with noise from a fixed distribution through a function, so the posterior can take an arbitrary form.
The authors argue that a deterministic encoder may give a less smooth q(z), since its randomness comes only from the fixed training set. After extensive hyper-parameter search, the three encoder types gave similar test-likelihood, so the reported results use the deterministic encoder.
Comparing the coding space with a VAE
The VAE minimizes an upper bound on the negative log-likelihood that contains a reconstruction term and two regularization terms. The adversarial autoencoder replaces those two terms with adversarial training, which aims to match the whole of p(z) rather than its modes. The authors argue that the KL or cross-entropy term pulls q(z) toward the modes of p(z).
On MNIST with a 2-D Gaussian prior, the coding space of the adversarial autoencoder shows sharp transitions and no holes, so interpolating in it gives images on the data manifold. The VAE coding space roughly matches the shape of a 2-D Gaussian, but some local regions receive no data points. With a mixture of 10 2-D Gaussians as the prior, the adversarial autoencoder matches the mixture, while the VAE shows systematic differences from it.
This comparison uses coding-space plots of hold-out images, so it is qualitative and gives no likelihood or error value. A practical difference is that the VAE needs the exact functional form of the prior to back-propagate through the KL term, whereas the adversarial autoencoder only needs to sample from the prior.
How the method differs from GAN and GMMN training
The adversarial autoencoder instead relies on the autoencoder to model the data and imposes a simpler distribution in a lower-dimensional code space, for example 20 dimensions instead of 1000. The authors connect this design to better test-likelihood, which the likelihood section reports.
GMMN uses the maximum mean discrepancy objective to shape the output layer, and GMMN+AE combines it with pre-trained dropout autoencoders. The authors distinguish their method by training the autoencoder from scratch with the adversarial term acting as a regularizer on the code distribution, whereas GMMN+AE first trains a standard dropout autoencoder and then fits a distribution to its code.
The authors report that this joint training gives higher test-likelihood than GMMN and GMMN+AE on MNIST and TFD.
Shaping each mixture mode with a label
Labels enter the discriminator through a one-hot vector appended to its input, which selects the decision boundary for one mixture component. The one-hot vector has an extra class for unlabeled points, so a mixture of 10 2-D Gaussians gives a one-hot vector with 11 classes. When an unlabeled point is presented, the extra class is active and the discriminator judges against the full mixture.
In the negative phase, it carries the label of the training image. Trained on 10K labeled and 40K unlabeled MNIST examples, the i-th mixture component ends up assigned to the i-th class.
Style stays consistent within each mixture component regardless of class, so the upper-left region of the panels corresponds to upright writing and the lower-right region to tilted writing. The same mechanism extends to a swiss roll prior, a conditional Gaussian whose mean is uniformly distributed along a swiss roll axis, without an explicit functional form for the prior.
Separating label from style in supervised and semi-supervised models
For supervised training, the decoder receives the one-hot label along with the hidden code z, which forces z to hold information independent of the label. On MNIST, z is constrained to a 15-D Gaussian, and fixing z while varying the label keeps the style consistent along each row. On SVHN the one-hot vector encodes only the central digit, so the style code carries information about the outer digits.
The semi-supervised model assumes a categorical latent class y with p(y)=Cat(y) and a Gaussian latent z with p(z)=N(z|0, I). The encoder q(z,y|x) predicts both variables, and two adversarial networks regularize them: one imposes a categorical distribution on the label and the other a Gaussian on the style. Training runs in three phases: reconstruction on unlabeled mini-batches, regularization of both adversarial networks, and a cross-entropy update of q(y|x) on labeled mini-batches.
Likelihood of generated samples on MNIST and TFD
Likelihood is estimated with a Gaussian Parzen window fitted to 10,000 model samples, with its width chosen by cross-validation, and the test data is scored under that density. The model imposes a high-dimensional Gaussian on the hidden code, which is 8-D for MNIST and 15-D for TFD. Nearest training images in pixel-wise Euclidean distance are shown beside the samples to check for copying.
On real-valued MNIST with 10K samples the adversarial autoencoder reaches 340 ± 2, against 225 ± 2 for GAN, 282 ± 2 for GMMN + AE and 138 ± 2 for DBN. On TFD with 10K samples it reaches 2252 ± 16, above 2204 ± 20 for GMMN + AE and 2057 ± 26 for GAN.
With 10M samples, MNIST reaches 427 against 386 for GAN. With 10M samples on TFD it reaches 2522, and the table lists no value for the other methods in that column.
The Parzen estimate is a lower bound, and its tightness depends on the number of samples drawn, which is why the 10M column is reported as well. The authors report superior log-likelihoods in all the comparisons they ran and caution that the metrics for GAN-type models are deeply flawed, citing Theis et al. on the 10K and 10M estimates.
Semi-supervised classification error
Error rates are reported for MNIST with 100, 1000 and all labels, and for SVHN with 1000 labels, where lower is better. The NN baseline gives 25.80, 8.73 and 1.25 on MNIST and 47.50 on SVHN.
With 100 labels the adversarial autoencoder reaches 1.90 (±0.10), far below the baseline but above Ladder Networks at 1.06 (±0.37) and ADGM at 0.96 (±0.02). The authors place it on par with VAT and CatGAN, which report 2.33 and 1.91 (±0.1) at this label count. With 1000 labels it reaches 1.60 (±0.08), against 0.84 (±0.08) for Ladder Networks.
Trained on all labels, the supervised variant reaches an error rate of 0.85%, while a dropout network of the same architecture reaches 1.25%.
On SVHN with 1000 labels the adversarial autoencoder reaches 17.70 (±0.30) against 16.61 (±0.24) for ADGM, which the authors describe as almost matching ADGM.
The authors note that all AAE models are trained end-to-end, whereas semi-supervised VAE models were trained one layer at a time.
Unsupervised clustering of MNIST
Unsupervised clustering reuses the architecture of figure 8 without the semi-supervised classification stage, so no labeled mini-batch is used. The inference network q(y|x) outputs a one-hot vector whose length is the number of clusters.
For each cluster, the validation example x_n that maximizes q(y_i|x_n) is found, and its label is given to all points in that cluster. Test error is computed from these assigned labels.
The adversarial autoencoder reaches an error of 9.55 (±2.05) with 16 clusters and 4.10 (±1.13) with 30 clusters. The authors observe that the classification rate improves as the number of clusters grows, so error falls with more clusters. CatGAN reports 9.70 with 20 clusters, which is a different cluster count from the 16-cluster setting, so the two numbers are not matched conditions.
Some clusters capture discrete styles: tilted 1s and 6s fall into clusters separate from straight ones, and 2s split according to whether they have a loop.
Dimensionality reduction and visualization
Parametric t-SNE was proposed because t-SNE has no encoder that can place new points. Autoencoders can provide the non-linear mapping an embedding needs, but without regularization they fracture a manifold into domains with very different codes for similar images. The adversarial regularization is meant to keep the codes of similar images together and so to prevent this fracturing.
The final n-dimensional code is the sum of an n-dimensional cluster head and an n-dimensional style code. The cluster head is the m-dimensional one-hot label multiplied by an m by n matrix W_C whose rows are learned with SGD. An extra cost penalizes the Euclidean distance between every two cluster heads: it is zero when the distance is larger than a threshold eta, and it penalizes the distance linearly when the distance is smaller.
With n=2 on MNIST with m=10, semi-supervised embedding reaches 4.20% error with 1000 labels and 6.08% with 100 labels.
The unsupervised 2D embedding with 20 clusters reaches 13.95% error. The authors report that the network gives separate clusters to straight and tilted 1s, three clusters to 6s by tilt, and two clusters to 2s by loop.
A linear map then places the cluster heads on a 2D circle for visualization. With 100 labels the 10D embedding has error 3.90%, which is worse than the 1.90% of the adversarial autoencoder with concatenated style and label representation.
Limits of the evidence
The likelihood results rest on a Parzen window estimate that the authors call a lower bound, and the tightness of that bound depends on the sample count. The likelihood table covers only MNIST and TFD. The comparison with the VAE is qualitative and rests on coding-space plots.
Clustering is reported only on MNIST, with 16 and 30 clusters. Semi-supervised SVHN results are reported only with 1000 labels. Reported results use only the deterministic encoder, and the stochastic encoder variants are not reported in the units.
The 2D and 10D embeddings have higher error than the high-dimensional semi-supervised model, and the 2D embedding gives a style that is not quite Gaussian. The authors caution that the metrics for GAN-type models are deeply flawed.
Paper info
- Authors
- Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, Brendan Frey
- Venue
- arXiv · Preprint
- First published
- 2015-11-18
- Added
- 2026-11-12
- Updated
- 2016-5-25
- Version
- v2
- arXiv
- 1511.05644
- Category
- cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, Brendan Frey (2015). Adversarial Autoencoders. arXiv:1511.05644v2. https://arxiv.org/abs/1511.05644v2
BibTeX
@misc{makhzani2015adversarial,
title = {{Adversarial Autoencoders}},
author = {Alireza Makhzani and Jonathon Shlens and Navdeep Jaitly and Ian Goodfellow and Brendan Frey},
year = {2015},
eprint = {1511.05644},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1511.05644v2}
}