Exploring the Relationship between Architecture and Adversarially Robust Generalization

Shiyu Tang, Siyuan Liang, Ruihao Gong, Aishan Liu, Xianglong Liu, Dacheng Tao · DOI

TL;DR

This paper investigates how neural network architecture impacts adversarial robustness generalization. They found that Vision Transformers (ViTs) generally outperform Convolutional Neural Networks (CNNs) in generalizing to unseen adversarial attacks, attributing this to the inherent weight sparsity introduced by attention mechanisms.

What Problem Does This Paper Address?

Deep learning models, despite their impressive performance, are vulnerable to adversarial examples – subtly modified inputs that can fool the model. Adversarial training is a leading defense strategy, but it often suffers from a significant "robustness generalization gap." This means models trained to be robust against specific types of adversarial attacks may not perform well against other, unseen attacks. While previous work has explored various aspects of this gap, the influence of the model's architectural design has remained largely unexplored. This paper aims to systematically bridge this gap by understanding how different architectures contribute to or hinder adversarially robust generalization.

Methods

The authors conducted a large-scale empirical study, evaluating 20 diverse neural network architectures (including popular CNNs like ResNet and ViTs like PVT and CoAtNet) trained with adversarial training. They specifically focused on their ability to generalize across multiple types of adversarial attacks (l1, l2, and l-infinity norms) on the ImageNette and CIFAR-10 datasets.

To understand the underlying mechanisms, they employed theoretical analysis using Rademacher complexity, a concept used to bound generalization error. This theoretical framework helped them connect architectural properties to generalization performance. They also visualized weight distributions to examine sparsity and analyzed the impact of specific architectural components like attention layers.

Datasets

  • CIFAR-10: A standard dataset with 10 classes, used for training and evaluation.
  • ImageNette: A subset of ImageNet with 10 classes, also used for training and evaluation.
  • ImageNet: A larger dataset with 1,000 classes, used for further analysis of generalization.
  • CIFAR-10-C and ImageNet-C: Datasets incorporating common corruptions (e.g., fog, noise) were used to evaluate generalization beyond adversarial attacks.

Key Insights and Ideas

  • Architectural Design Matters Significantly: The choice of architecture has a substantial impact (over 20% difference observed) on an adversarially trained model's ability to generalize its robustness.
  • Vision Transformers Shine: ViTs, particularly those with sophisticated attention mechanisms like PVTv2 and CoAtNet, consistently demonstrated superior adversarially robust generalization compared to CNNs.
  • CNNs Tend to Overfit: CNNs, while sometimes performing well against the specific attack they were trained on (often l-infinity), struggle to generalize to other attack types. This suggests they are more prone to overfitting to particular adversarial perturbations.
  • Weight Sparsity is Key: Theoretical analysis revealed that higher weight sparsity in a model is strongly correlated with better adversarially robust generalization.
  • Attention Mechanisms Drive Sparsity: The attention blocks within Transformer architectures are identified as the primary drivers of this beneficial weight sparsity.
  • Model Size is Less Critical: While model capacity plays a role, the paper suggests that architectural design choices have a more pronounced effect on robust generalization than simply scaling up model size.

Key Results

  • On CIFAR-10 and ImageNette, ViTs like PVTv2 and CoAtNet achieved the highest worst-case robust accuracy across multiple adversarial attacks, significantly outperforming CNNs like ResNet. For instance, on CIFAR-10, PVTv2 achieved 33.54% worst-case robust accuracy, while ResNet achieved 14.32%.
  • The paper provides visualizations of weight distributions, showing that ViTs (e.g., PVTv2, CoAtNet) have a much higher proportion of weights close to zero (higher sparsity) compared to CNNs (e.g., ResNet, WideResNet).
  • Experiments with imposing L1 regularization on ResNet to artificially increase sparsity showed a modest improvement in robust generalization, but also a trade-off with clean accuracy and sensitivity to hyperparameter tuning. This suggests that architectural design (like attention blocks) is a more effective way to achieve sparsity.
  • Analysis on ImageNet confirmed the trend: ViT showed better worst-case accuracy (24.77%) than ResNet (20.08%) even on this larger scale.

Limitations and Future Work

  • Generalization to Common Corruptions: While the paper focuses on adversarial robustness, generalization to common corruptions (like noise, blur) is also important. The results here are mixed, with CNNs sometimes showing better performance on CIFAR-10-C, suggesting that adversarial robustness and robustness to common corruptions might not always align perfectly and could be influenced by dataset characteristics.
  • Trade-offs: The paper notes that while L1 regularization can improve robustness, it can also negatively impact clean accuracy, highlighting a potential trade-off that needs careful management.
  • Future Directions: The authors suggest further exploring how to design architectural ingredients that inherently promote sparsity and robustness. They also point to the need for more research into the complex interplay between adversarial robustness, generalization to common corruptions, and natural accuracy. The open-sourced model weights aim to facilitate future research in this area.

Summary updated

BibTeX
@inproceedings{tang2023exploring,
  author = {Shiyu Tang and Siyuan Liang and Ruihao Gong and Aishan Liu and Xianglong Liu and Dacheng Tao},
  title = {{Exploring the Relationship between Architecture and Adversarially Robust Generalization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  doi = {10.1109/cvpr52729.2023.00399},
}
Figure