Learning from Attacks: Attacking Variational Autoencoder for Improving Image Classification

Jianzhang Zheng, Fan Yang, Hao Shen, Xuan Tang, Mingsong Chen, Liang Song, Xian WeiarXiv 2022 · DOI · arXiv

Introduction

Deep Neural Networks (DNNs) are notoriously vulnerable to adversarial attacks—small, human-imperceptible perturbations that cause models to misclassify images. Traditionally, researchers treat these attacks as a "bug" to be fixed through defensive techniques like adversarial training. However, these defenses often come with a "robustness-accuracy trade-off," where the model becomes harder to fool but performs worse on clean, everyday images.

This paper introduces AVIC (Attacking VAE for Improved Classification), a framework that flips the script on adversarial examples. Instead of viewing them solely as threats, AVIC treats adversarial perturbations as a source of useful, abstract features that can boost classification accuracy. By shifting the target of the attack from a task-specific classifier to a self-expressive model like a Variational Autoencoder (VAE), the authors aim to capture structural data representations that improve standard performance.

Conceptual overview of the AVIC framework showing the interaction between the Generator, VAE, and Classifier.

The AVIC Framework

The proposed framework consists of three main components: a VAE, a Generator (the attacker), and a Classifier. The core idea is that attacking a VAE's reconstruction ability forces the generator to find regular patterns that represent the underlying data distribution more effectively than noise-like classifier attacks.

Training Pipeline

The AVIC training process follows a structured four-step pipeline designed to distill structural information into the classifier:

  1. VAE Training: A VAE is trained on clean data ($x$) to learn how to reconstruct images ($\tilde{x}$), capturing the intrinsic structure of the dataset.
  2. Generator Training: A separate DNN generator is trained to produce adversarial examples ($x_a$). Its goal is to maximize the VAE’s reconstruction error. By trying to make the VAE "fail," the generator identifies the most critical structural features of the image.
  3. Classifier Training: A standard classifier (e.g., ResNet-18) is trained using the adversarial examples ($x_a$) produced by the generator.
  4. Global End-to-End Training: The generator and classifier are fine-tuned together. The generator’s loss function is modified to balance two goals: attacking the VAE while helping the classifier achieve higher accuracy.
The four-step training pipeline for AVIC, detailing the loss functions and data flow for each stage.

Key Insights and Results

The experimental results demonstrate that "learning from attacks" consistently outperforms vanilla training across multiple benchmarks, including MNIST, CIFAR10, and CIFAR100.

  • Accuracy Gains: On CIFAR10, AVIC achieved 84.34% accuracy, compared to 83.00% for vanilla training. On CIFAR100, it reached 63.65% vs 62.76%.
  • Superiority over Traditional Adversarial Training: Traditional adversarial training (attacking the classifier) actually reduced accuracy on clean CIFAR10 images to roughly 80%. In contrast, AVIC’s method of attacking the VAE improved it.
  • Structured Perturbations: Visualizations show that while classifier-based attacks often look like disorganized noise, VAE-based attacks produce structured, regular perturbations that highlight the "essence" of the object's form.

Discussion and Limitations

While AVIC offers a promising new paradigm, it is sensitive to the perturbation size ($\epsilon$). If the attack is too strong (e.g., $\epsilon > 0.05$), it destroys the intrinsic information of the image, causing classification accuracy to drop sharply. Additionally, the framework is more computationally expensive than standard training as it requires managing three separate models.

Conclusion

AVIC demonstrates that adversarial examples contain "non-robust features" that, when harvested correctly, provide a richer training signal than clean images alone. By attacking the reconstruction ability of a VAE rather than the decision boundary of a classifier, the framework successfully turns adversarial threats into a tool for improving model performance.

Summary updated

Abstract

Adversarial attacks are often considered as threats to the robustness of Deep Neural Networks (DNNs). Various defending techniques have been developed to mitigate the potential negative impact of adversarial attacks against task predictions. This work analyzes adversarial attacks from a different perspective. Namely, adversarial examples contain implicit information that is useful to the predictions i.e., image classification, and treat the adversarial attacks against DNNs for data self-expression as extracted abstract representations that are capable of facilitating specific learning tasks. We propose an algorithmic framework that leverages the advantages of the DNNs for data self-expression and task-specific predictions, to improve image classification. The framework jointly learns a DNN for attacking Variational Autoencoder (VAE) networks and a DNN for classification, coined as Attacking VAE for Improve Classification (AVIC). The experiment results show that AVIC can achieve higher accuracy on standard datasets compared to the training with clean examples and the traditional adversarial training.
BibTeX
@misc{zheng2022learning,
  author = {Jianzhang Zheng and Fan Yang and Hao Shen and Xuan Tang and Mingsong Chen and Liang Song and Xian Wei},
  title = {{Learning from Attacks: Attacking Variational Autoencoder for Improving Image Classification}},
  year = {2022},
  eprint = {2203.07027},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.07027},
}
Figure