Learning to Defense by Learning to Attack

Zhehui Chen, Haoming Jiang, Bo Dai, Tuo Zhao

Abstract

Adversarial training is a critical technique for securing deep neural networks against malicious perturbations. However, traditional methods rely on hand-crafted iterative optimization algorithms like the Projected Gradient Method (PGM) for the inner-loop attack generation, which is computationally expensive and potentially suboptimal. This paper introduces a Learning-to-Learn (L2L) framework that replaces manual attack algorithms with a learned neural network attacker. By parameterizing the attacker and training it jointly with the classifier, the proposed method achieves superior robustness and significantly faster training speeds compared to standard baselines.

Introduction

Deep neural networks (DNNs) are notoriously fragile; small, often imperceptible perturbations can cause a world-class classifier to fail. Adversarial training addresses this by solving a bilevel optimization problem: an inner loop finds the worst-case perturbation for the current model, and an outer loop updates the model to resist those specific perturbations. The primary bottleneck is the inner loop. Standard iterative methods like PGM require multiple gradient steps per training sample, making the process computationally expensive and reliant on human-designed heuristics that may not capture the most effective paths to fooling a model.

Methodology

The core innovation of this work is the shift from hand-designed optimization to a learned attacker network, $g_\phi$. This approach "amortizes" the cost of finding adversarial examples by learning a shared model that exploits structural vulnerabilities across the entire dataset.

The Gradient Attacker

A key finding is that a "naive" attacker looking only at the input image is insufficient. Instead, the proposed "Gradient Attacker" takes both the original image and the gradient of the loss with respect to that image as input. This allows the attacker to "see" where the model is currently weak.

The architecture of the L2L framework, showing the interaction between the attacker $g$ and classifier $f$ across multiple passes.

As shown in the figure above, the process involves concatenating the input and gradient, passing them through the attacker network to generate a perturbation, and then adding this to the original input. This learned inner loop can generate effective attacks in a single forward pass, significantly reducing the overhead of traditional iterative methods.

Unfolding Optimization

The L2L framework can be conceptualized as "unfolding" the traditional iterative optimization process into a sequence of operations that can be learned as a feed-forward or recurrent structure.

The unfolding of the optimization process from a loop into discrete steps (Zero-Step to Multi-Step).

By unfolding the optimizer, the framework allows for varying degrees of complexity, from simple one-step attacks to more complex multi-step learned strategies. This provides a flexible trade-off between computational speed and defensive robustness.

Experiments and Results

The researchers evaluated the framework on the CIFAR-10 and CIFAR-100 datasets, using both CNN and RNN architectures for the attacker network.

Efficiency and Speed

The L2L approach provides a significant speedup. On CIFAR-10, training with the "Grad L2L" method was more than twice as fast as PGM-based training. Specifically, one epoch of PGM training took approximately 1310 seconds, while the L2L approach completed the same task in only 617 seconds.

Robustness Performance

Beyond speed, the learned attacker improves the quality of the defense. On CIFAR-100, the L2L-trained model achieved a robust accuracy of ~31% against PGM-20 attacks, compared to only ~23.7% for the standard PGM-trained baseline. Furthermore, the defense generalizes well to unseen attack types, such as the powerful Carlini-Wagner (CW) attack, demonstrating that the model learns a generalizable resistance rather than just over-fitting to a specific attack algorithm.

Discussion and Limitations

While the L2L framework offers clear advantages, it introduces new architectural considerations. The authors found that "slim" attacker architectures with heavy downsampling were less stable and reduced performance. Additionally, joint training requires careful balancing of learning rates between the attacker and defender. Future work will explore scaling this approach to high-resolution datasets like ImageNet, where the memory overhead of a large attacker network may become a more significant factor.

Summary updated

BibTeX
@inproceedings{chen2021learning,
  author = {Zhehui Chen and Haoming Jiang and Bo Dai and Tuo Zhao},
  title = {{Learning to Defense by Learning to Attack}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2021},
  url = {https://openreview.net/forum?id=HVnZk2X9cl9},
}
Figure