Learning to Defense by Learning to Attack

Zhehui Chen, Haoming Jiang, Yuyang Shi, Bo Dai, Tuo Zhao

This paper introduces a "Learning to Learn" (L2L) approach to adversarial training. Instead of relying on hand-designed optimization algorithms to generate adversarial examples, the authors train a dedicated "attacker" neural network to find vulnerabilities. This creates a more robust defense through a co-evolutionary training process between the attacker and the classifier.

TL;DR

The authors replace traditional, hand-designed adversarial attack algorithms (like the Projected Gradient Method, or PGM) with a learned "attacker network" that co-evolves with the classifier. Inspired by the "Learning to Learn" framework, this approach results in models that are more robust to white-box and black-box attacks while significantly reducing the computational overhead of adversarial training.

What Problem Does This Paper Address?

Adversarial training is the gold standard for defending neural networks against malicious perturbations. Mathematically, it is framed as a minmax optimization problem: the "inner" part tries to find a perturbation that maximizes the loss (the attack), while the "outer" part tries to minimize that loss (the defense).

However, this is notoriously difficult because the loss landscape of a neural network is non-concave with respect to the input pixels. Standard tools like PGM are computationally expensive—requiring many iterations of backpropagation for every single training step—and often get stuck in local maxima. This leads to a "weak" inner solver and, consequently, a brittle defense.

Methods

The core innovation is parameterizing the "attacker" as a neural network $g$ with its own parameters $\phi$. Instead of running a multi-step optimization loop for every image, the system performs a simple forward pass through the attacker network to generate the perturbation.

Gradient Attacker Architecture

The authors propose three flavors of attacker networks:

  1. Naive Attacker: Takes only the original image $x$ as input.
  2. Gradient Attacker: Takes both the image $x$ and the gradient of the loss $\nabla_x \ell$ as input. This allows the attacker to "see" the current direction of vulnerability, as illustrated in the architecture diagram above.
  3. Multi-Step Gradient Attacker: Uses a Recurrent Neural Network (RNN) structure to mimic iterative optimization, essentially "learning" a better, amortized version of PGM.

To ensure the attacks stay within a specific budget (the $\epsilon$-ball), the attacker's final layer uses a tanh activation function rescaled by $\epsilon$. The classifier and the attacker are trained jointly: the classifier learns to minimize loss on the attacker's outputs, while the attacker learns to maximize that same loss.

Datasets

The researchers evaluated their method on three standard computer vision benchmarks:

  • CIFAR-10
  • CIFAR-100
  • SVHN (Street View House Numbers)

Key Insights and Ideas

  • Amortized Optimization: Traditional attacks start from scratch for every image. The L2L attacker learns a general strategy across the entire dataset. This "amortization" makes the attack generation much faster during training.
  • Structural Learning: By using a CNN/RNN as an attacker, the model learns common structural vulnerabilities (e.g., edges or specific textures) that are shared across images, rather than just finding pixel-level noise.
  • Stability through Co-evolution: The training process resembles a Generative Adversarial Network (GAN). As the classifier gets better at defending, the attacker is forced to find more sophisticated ways to fool it, leading to a more robust equilibrium.
  • Gradient Information is Key: The "Gradient Attacker" significantly outperformed the "Naive Attacker," proving that providing the attacker with the classifier's local loss surface is crucial for generating strong perturbations.

Key Results

The L2L approach yields significant improvements in both robustness and computational efficiency.

Accuracy vs. PGM Iterations
  • Superior Robustness: On CIFAR-10, the "2-Step L2L" method achieved a white-box accuracy of 51.47% against a PGM10 attack, noticeably outperforming the standard PGM-trained network (40.69%). As shown in the performance charts, the GradL2L networks maintain higher accuracy across increasing numbers of PGM iterations compared to standard baselines.
  • Efficiency Gains: The "Grad L2L" method is roughly 3.5x faster than PGM training. While PGM requires 10 or more backpropagation passes to generate one attack, the learned attacker only needs a single forward pass.
  • Visual Differences: Visualizations (noted in the study) show that L2L attacks are less "noisy" than PGM attacks. They appear more structured and targeted, suggesting the learned attacker has found more meaningful ways to manipulate the classifier's features.

Limitations and Future Work

  • Black-box Transferability: While the defense is strong in white-box scenarios, the authors note that black-box attacks (where the attacker doesn't know the model's parameters) remain a challenge due to the inherent instability of transferability.
  • SVHN Anomalies: The results on the SVHN dataset against Carlini-Wagner (CW) attacks were less impressive than on CIFAR. The authors conjecture this is due to the specific loss functions used by CW attacks, which differ from the softmax entropy used during training.
  • Complexity of Minmax: The authors acknowledge that non-convex-non-concave minmax problems are "notorious for their difficulty" and suggest that L2L is a starting point for more principled follow-up work in solving these complex optimization landscapes.

Summary updated

BibTeX
@inproceedings{chen2021learning,
  author = {Zhehui Chen and Haoming Jiang and Yuyang Shi 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