The Autoencoding Variational Autoencoder

A. Taylan Cemgil, Sumedh Ghaisas, Krishnamurthy Dvijotham, Sven Gowal, Pushmeet Kohli

Standard Variational Autoencoders (VAEs) often fail to consistently encode the very samples they generate, leading to fragile latent representations. The Autoencoding VAE (AVAE) enforces self-consistency between the encoder and decoder, resulting in latent features that are significantly more robust to adversarial attacks without requiring expensive adversarial training.

The Missing "Auto" in VAEs

In theory, a VAE is an "autoencoder"—it should be able to take data, compress it into a latent representation, and reconstruct it accurately. However, a surprising inconsistency plagues standard VAEs: if you take a "typical" sample generated by the decoder, the encoder often fails to map it back to the latent code that originally created it.

This mismatch occurs because the standard VAE objective (the Evidence Lower Bound, or ELBO) doesn't explicitly force the encoder to act as the inverse of the decoder for samples outside the training set. This inconsistency is a major hurdle for representation learning. It results in an encoder that is "jittery"—small, imperceptible changes to an input (such as adversarial perturbations) can lead to wildly different latent codes, making the model unreliable for downstream tasks like classification.

Iterative encoding and decoding reveals the "drift" symptom in standard VAEs (a), where a '9' morphs into a '4' and '8'. The AVAE (b) remains stable.

The paper illustrates this problem with a striking visual of "drift." If you iteratively encode and decode an image using a standard VAE, the image drifts and loses its identity entirely (e.g., a '9' turns into a '4'). In an AVAE, the image remains stable across iterations.

The AVAE Framework

To solve this, the authors propose the Autoencoding Variational Autoencoder (AVAE). The core idea is to treat the VAE as an extended model involving pairs of observations and enforcing a self-consistency objective.

Graphical model of the AVAE target distribution and variational approximation, illustrating how the model accounts for generated "delusions."
  1. Self-Consistency Objective: The authors derive a novel variational lower bound that includes an additional consistency term. This term forces the encoder to be accurate not just on the original training data, but also on "delusions"—auxiliary observations generated by the decoder itself.
  2. The "Delusion" Mechanism: During training, the model generates a sample (a delusion) from the current decoder and then asks the encoder to map it back. The objective minimizes the discrepancy between the latent code used to generate the delusion and the code produced by encoding it.
  3. AVAE-SS (Self-Supervised): A particularly clever variant of this method can be used as a post-processing step. If you already have a trained VAE, you can "fix" its encoder in an entirely self-supervised way using only generated samples, without needing access to the original training data.

Key Insights and Performance

By forcing the encoder to understand the decoder’s output space, the representation becomes naturally "smoother." This smoothness translates directly into adversarial robustness, bypassing the need for traditional, computationally expensive adversarial training.

The researchers evaluated their approach on benchmarks like ColorMNIST (where both digit identity and color are classification targets) and CelebA (focusing on facial attributes).

  • Adversarial Accuracy: On ColorMNIST, the AVAE encoder proved vastly more robust than a standard VAE. For digit classification under a moderate adversarial attack ($\epsilon=0.1$), the AVAE maintained 88.1% accuracy, while the standard VAE collapsed to just 5.8%.
  • Computational Efficiency: Traditional robust models (like "Smooth Encoders") take about 4x longer to train due to their reliance on iterative adversarial attacks in the inner loop. AVAE achieves similar robustness levels much faster, running only about 1.5x slower than a standard VAE by using the decoder's own generative process as a source of perturbations.
  • Generalization: The robustness gained via AVAE extends to complex datasets like CelebA, where it matched or outperformed specialized robust training methods while remaining entirely task-agnostic.

Limitations and Future Work

While highly effective for robustness, the authors noted a slight "cost" to generation quality. AVAE models tended to have slightly higher Mean Squared Error (MSE) and Frechet Inception Distance (FID) scores compared to standard VAEs. This suggests that constraining the encoder for consistency might slightly limit the decoder's reconstructive flexibility.

Additionally, the method relies on a "coupling strength" hyperparameter ($\rho$). While the paper shows that a $\rho$ close to 1 is generally best, finding the optimal balance for specific datasets remains an empirical task. Future work will likely explore how these consistency constraints behave in very large-scale generative models used for high-resolution synthesis.

Summary updated

BibTeX
@inproceedings{cemgil2020autoencoding,
  author = {A. Taylan Cemgil and Sumedh Ghaisas and Krishnamurthy Dvijotham and Sven Gowal and Pushmeet Kohli},
  title = {{The Autoencoding Variational Autoencoder}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
}
Figure