Improving VAEs' Robustness to Adversarial Attack

Matthew Jf Willetts, Alexander Camuto, Tom Rainforth, S Roberts, Christopher C HolmesICLR 2021

Introduction

Variational Autoencoders (VAEs) are powerful generative models, but they harbor a significant weakness: they are highly vulnerable to adversarial attacks. This paper reveals that the same regularization techniques used to "disentangle" VAEs also make them significantly more robust to these attacks. By extending these techniques to a hierarchical architecture—dubbed the Seatbelt-VAE—the authors create a model that resists being fooled by malicious input distortions while maintaining high-quality image reconstructions.

The Vulnerability of VAEs

VAEs learn to compress data into a lower-dimensional "latent space" and then reconstruct it. However, this latent space can be surprisingly fragile. An adversary can add a tiny, nearly invisible distortion to an input image (for example, a photo of Hugh Jackman) to trick the VAE into reconstructing a completely different target image (like Anna Wintour).

This vulnerability is dangerous because VAEs are frequently used as pre-processing steps for downstream tasks, such as classification or reinforcement learning. If the VAE can be easily manipulated, the entire downstream system becomes insecure. The core challenge is building a "robust" VAE that resists these attacks without sacrificing the clarity and detail of its reconstructions.

Proposed Solution: Disentanglement and Hierarchy

The authors identify that VAEs are vulnerable because their latent spaces often have "gaps" or regions where the model's behavior is overly sensitive. To fix this, they adapt methods from the literature on disentanglement.

  1. Total Correlation (TC) Regularization: The authors demonstrate that models like the $\beta$-TCVAE, which penalize the "Total Correlation" between latent variables, produce smoother latent spaces. This regularization forces the distributions for different inputs to overlap significantly. This "overlap" makes it much harder for an adversary to find a clean path to shift the encoding toward a specific target.
  2. The Seatbelt-VAE: While $\beta$-TCVAE is robust, it often produces blurry reconstructions because the heavy regularization limits the model's capacity. To solve this, the authors propose a hierarchical VAE where the final output depends on all layers of the hierarchy, not just the bottom one.
  3. Hierarchical TC: They derive a new mathematical objective to apply TC regularization primarily to the top-most layer of this hierarchy. This allows the model to use the lower layers for fine-grained detail (high fidelity) while the top layer provides the "seatbelt" of adversarial robustness.

Key Insights

  • Robustness via Overlap: The critical insight is that robustness in VAEs is essentially about overlap in the latent space. If the latent distributions are smooth and overlapping, an adversary cannot easily isolate a specific target representation.
  • Disentanglement Regularizers $\neq$ Perfect Disentanglement: Interestingly, while the regularizers used for disentanglement (like TC) provide robustness, the models do not actually need to achieve perfect disentanglement to be robust. The induced smoothness is the active ingredient.
  • Hierarchy is the Key to Quality: Standard robust VAEs are often blurry. By spreading the latent representation across multiple layers and regularizing the top one, the Seatbelt-VAE achieves the "best of both worlds": the resilience of a heavily regularized model and the sharpness of a deep generative model.

Experimental Results

The authors evaluated their models on several standard benchmarks, including CelebA (high-resolution faces), dSprites, 3D Chairs, SVHN, and CIFAR10.

Visual comparison of adversarial attacks on standard VAE, beta-TCVAE, and Seatbelt-VAE.
  • Visual Proof: Qualitatively, when a standard VAE is attacked, the output looks exactly like the adversary's target. When the Seatbelt-VAE is attacked, the output still looks like the original image, effectively thwarting the attack while maintaining image sharpness compared to the blurry $\beta$-TCVAE.
  • Massive Resistance: In quantitative tests, the "adversarial loss" (the effort an attacker must expend to fool the model) was up to $10^7$ times higher for the Seatbelt-VAE compared to a standard VAE.
  • Downstream Security: When using the VAE's latent space for classification on SVHN, the Seatbelt-VAE maintained an accuracy of 57% under attack, whereas a standard VAE's accuracy plummeted to 15%.

Limitations and Future Work

While highly effective, the approach has limitations. Estimating the Total Correlation (TC) term requires large batch sizes during training, which can be computationally and memory-intensive. Furthermore, while the paper provides strong empirical evidence and intuitive arguments about "smoothness," the authors note that more formal theoretical work is needed to define the exact limits of VAE robustness. Finally, the study focuses primarily on "latent space" attacks; future work could investigate if these defenses hold up against a wider variety of attack vectors in complex, real-world pipelines.

Summary updated

BibTeX
@inproceedings{willetts2021improving,
  author = {Matthew JF Willetts and Alexander Camuto and Tom Rainforth and S Roberts and Christopher C Holmes},
  title = {{Improving VAEs' Robustness to Adversarial Attack}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=-Hs_otp2RB},
}
Figure