Skip to main content
QUICK REVIEW

[Paper Review] Enhance the Visual Representation via Discrete Adversarial Training

Xiaofeng Mao, Yuefeng Chen|arXiv (Cornell University)|Sep 16, 2022
Digital Media Forensic DetectionComputer Science10 citations
TL;DR

This paper proposes Discrete Adversarial Training (DAT), a novel method that enhances visual representation by discretizing images into symbolic visual words using VQGAN and applying adversarial training on these discrete representations. DAT achieves state-of-the-art robustness—31.40 mCE on ImageNet-C and 32.77% top-1 accuracy on Stylized-ImageNet—while preserving clean accuracy, outperforming standard adversarial training by generating more in-distribution adversarial examples through straight-through gradient estimation on discrete tokens.

ABSTRACT

Adversarial Training (AT), which is commonly accepted as one of the most effective approaches defending against adversarial examples, can largely harm the standard performance, thus has limited usefulness on industrial-scale production and applications. Surprisingly, this phenomenon is totally opposite in Natural Language Processing (NLP) task, where AT can even benefit for generalization. We notice the merit of AT in NLP tasks could derive from the discrete and symbolic input space. For borrowing the advantage from NLP-style AT, we propose Discrete Adversarial Training (DAT). DAT leverages VQGAN to reform the image data to discrete text-like inputs, i.e. visual words. Then it minimizes the maximal risk on such discrete images with symbolic adversarial perturbations. We further give an explanation from the perspective of distribution to demonstrate the effectiveness of DAT. As a plug-and-play technique for enhancing the visual representation, DAT achieves significant improvement on multiple tasks including image classification, object detection and self-supervised learning. Especially, the model pre-trained with Masked Auto-Encoding (MAE) and fine-tuned by our DAT without extra data can get 31.40 mCE on ImageNet-C and 32.77% top-1 accuracy on Stylized-ImageNet, building the new state-of-the-art. The code will be available at https://github.com/alibaba/easyrobust.

Motivation & Objective

  • To address the trade-off between robustness and standard accuracy in adversarial training for vision models, which commonly degrades clean performance.
  • To investigate whether the generalization benefits of adversarial training in NLP—where discrete, symbolic inputs exist—can be transferred to computer vision.
  • To develop a plug-and-play method that enhances visual representation learning across multiple vision tasks without architectural changes.
  • To improve robustness against both $l_p$-bounded and unrestricted semantic adversarial attacks by generating more realistic, in-distribution adversarial examples.
  • To demonstrate that discrete adversarial training can achieve state-of-the-art performance in robust image classification and self-supervised learning.

Proposed method

  • Discretize continuous image inputs into symbolic visual words using a pre-trained VQGAN-based codebook, transforming images into sequences of discrete indices similar to natural language tokens.
  • Apply adversarial training on the discrete representation space by generating adversarial examples through one-step gradient ascent on the discrete indices, using a straight-through gradient estimator to backpropagate through the discrete bottleneck.
  • Use a differentiable straight-through approximation to enable gradient flow from the discrete representation back to the original image space, allowing end-to-end training.
  • Train the vision model on both clean images and the resulting discrete adversarial examples, minimizing the maximum risk over these perturbed discrete inputs.
  • Leverage the distributional proximity of discrete adversarial examples to clean data to improve generalization and robustness, as shown by distributional analysis.
  • Combine DAT with pre-training methods like Masked Autoencoding (MAE) for strong initialization, enabling SOTA performance with no extra data.

Experimental results

Research questions

  • RQ1Can the generalization benefits of NLP-style adversarial training be transferred to vision models by leveraging discrete, symbolic representations?
  • RQ2Does adversarial training on discrete visual tokens lead to better robustness and generalization compared to standard adversarial training on continuous pixels?
  • RQ3How does the quality of the discretizer (e.g., FID, codebook size) affect the performance of discrete adversarial training?
  • RQ4Can DAT improve robustness against both $l_p$-bounded and unrestricted semantic adversarial attacks, such as AdvDrop and PerC-Adversarial?
  • RQ5Does DAT maintain or improve clean accuracy while enhancing robustness across diverse vision tasks like classification, detection, and self-supervised learning?

Key findings

  • DAT achieves a new state-of-the-art robustness of 31.40 mCE on ImageNet-C and 32.77% top-1 accuracy on Stylized-ImageNet when fine-tuning a MAE-pretrained ViT-Huge model.
  • The method improves robustness against both $l_p$-bounded attacks (e.g., FGSM) and unrestricted semantic attacks (e.g., PerC-Adversarial), with ViT models showing particular resilience to perturbation magnitude.
  • DAT maintains high clean accuracy (e.g., 76.52% on ImageNet) even when adversarial magnitude $\alpha$ is increased, unlike standard AT, which suffers from accuracy degradation.
  • Larger codebook sizes ($K=16384$) improve generalization and reduce FID of generated images, though clean accuracy plateaus beyond a certain size.
  • A high-quality discretizer (e.g., VQGAN on OpenImages with FID=1.14) significantly improves performance, while a weaker one (e.g., DALL-E with FID=32.01) reduces clean accuracy by 1.3%.
  • ViT models show lower sensitivity to the adversarial magnitude $\alpha$ than ResNet50, suggesting better compatibility with discrete representation learning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.