# Ensemble Adversarial Training: Attacks and Defenses

Single-step adversarial training learns weak perturbations instead of robust defenses

Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, Patrick McDaniel · arXiv · 2017-5-19

- **Problem** Single-step adversarial training on ImageNet looked robust to black-box attacks, but that robustness rests on a loss surface that one linear step cannot describe.
- **Method** Ensemble Adversarial Training augments training data with perturbations transferred from fixed pre-trained models, instead of the trained model's own attacks.
- **Results** IRv2adv-ens reached 95.3% average accuracy, ranking first among 70 submissions in the first round of the NIPS 2017 competition.

## Why single-step adversarial training was expected to transfer

Adversarial training augments the training data with adversarial examples. Madry et al. showed that this yields white-box robustness when the perturbations computed during training come close to maximizing the loss. Scaling the same idea to ImageNet proved hard, so Kurakin et al. used a single-step attack based on a linearization of the loss to train an Inception v3 model.

That model resisted single-step perturbations but stayed vulnerable to more costly multi-step attacks.

Kurakin et al. found that multi-step attacks computed on other models rarely transferred to their model, and concluded that its robustness should carry over to black-box adversaries. The paper tests this conclusion directly and finds that it does not hold for single-step adversarial training, which is the setting the rest of the argument builds on.

The same black-box concern also covers an adversarially trained Inception ResNet v2 model and a set of MNIST models, which the authors examine alongside the ImageNet model.

Transfer is the mechanism that makes black-box attacks practical: adversarial examples crafted for one model are often misclassified by other models. The relevant question is therefore whether perturbations computed on an undefended model still work against an adversarially trained one.

## How single-step training can settle on a degenerate minimum

Single-step training replaces the inner maximization with the output of one attack step and minimizes the loss on those points. For highly expressive model families, the authors identify two kinds of global minimum: a model that is robust to every l-infinity bounded perturbation, and a model whose loss the attack's linearization fits poorly.

The second kind is the one that matters here, because the attack then produces examples that are far from the worst case.

The authors describe this effect as more subtle than overfitting to the attack used in training: the trained model makes that attack weaker in general, which they relate to reward hacking.

To test which minimum v3adv falls into, the authors compare the loss reached by Step-LL with a lower bound on the maximum loss obtained from an iterative attack, an approximation ratio. Over 1,000 random test points, the ratio averages 19% for standard Inception v3 and 7% for v3adv, so the linearization fits the adversarially trained model far worse.

Cosine similarity between the single-step and multi-step perturbations falls from 0.13 for Inception v3 to 0.02 for v3adv.

The authors plot the loss of v3adv on points of the form \\(x^\* = x + \\epsilon\_1 g + \\epsilon\_2 g^\\perp\\), where g is the signed gradient and g perp is a signed orthogonal direction taken from another Inception model. The loss curves sharply near x, so the gradient at x says little about the loss a few steps away.

## Adding a random step before the single-step attack

Because sharp curvature near a data point can hide the direction of steepest ascent, the authors move the input randomly before taking the gradient step. This lets the attack leave the non-smooth neighbourhood of the point before it linearizes the loss.

With step size alpha smaller than epsilon, R+FGSM first sets \\(x' = x + \\alpha\\,\\mathrm{sign}(N(0\_d, I\_d))\\) and then forms \\(x\_{adv} = x' + (\\epsilon-\\alpha)\\,\\mathrm{sign}(\\nabla\_{x'} J(x', y\_{true}))\\). It needs a single gradient computation, which makes it a single-step variant of the PGD method.

With epsilon 16/256 and alpha equal to epsilon/2, the random step gives a stronger attack than Step-LL for all models, including those without adversarial training. On the adversarially trained Inception v3, R+Step-LL outperforms a two-step Iter-LL attack, which the authors read as the learned gradients being worse than random directions for finding adversarial examples.

The random step, however, hinders transferability.

Later work by Wong et al. reports that single-step training with a similar attack gives white-box robustness when the step sizes are tuned.

## Building training batches from transferred examples

The method augments the training data with adversarial examples crafted on static pre-trained models, so the trained model cannot shape the strength of those examples. Since adversarial examples transfer between models, perturbations from an external model serve as approximations to the maximization in the training objective.

The authors frame the setup as multiple-source Domain Adaptation, with the clean data and the attacks as source distributions and an unseen black-box adversary as the target. Their informal Theorem 1 says that a model robust to the training-time black-box attacks has bounded error on a future attack that is not much stronger, on average, than those attacks.

The formal statement and its assumptions are in an appendix, and for ImageNet the authors rely on experiments rather than such guarantees.

In each minibatch the source of adversarial examples is the current model or one pre-trained model, selected at random. Half of the examples in each minibatch are Step-LL examples. With n minus 1 pre-trained models, only every nth batch needs a forward-backward pass to compute adversarial gradients. The gradients of the pre-trained models could be precomputed for the full training set, but the experiments did not precompute them, so the minibatch size was lowered to 16 to fit all models in memory.

The trained models are v3adv-ens3, v3adv-ens4 and IRv2adv-ens, which differ in their pre-trained sources. v3adv-ens3 uses Inception v3 and ResNet v2 (50) as pre-trained sources, with Inception v4, ResNet v1 (50) and ResNet v2 (101) as holdout models. v3adv-ens4 adds Inception ResNet v2 as a pre-trained source, and IRv2adv-ens uses Inception v3 and Inception ResNet v2.

Convergence is slower than for standard adversarial training, since the model trains on harder examples with smaller batches. v3adv-ens3 and v3adv-ens4 converged after 280 epochs, with 450k iterations at minibatch size 16, while the v3adv baseline reached 78% accuracy after 187 epochs with minibatch size 32, as reported by Kurakin et al.

## Black-box and white-box error on ImageNet

Black-box attacks are the Step-LL, R+Step-LL, FGSM, I-FGSM and PGD attacks, transferred from the three holdout models and from an ensemble of them. For each model the table reports the worst-case error over 20 black-box attacks, next to clean error and white-box Step-LL error, with epsilon 16/256 and 10,000 random test inputs. Attacking the ensemble of all three holdout models was not stronger than attacking each holdout model separately.

Relative to the clean accuracy of IRv2, the accuracy loss of IRv2adv-ens under these attacks is 7.4% for top-1 and 3.1% for top-5. The strongest black-box attacks in the test suite are the FGSM attacks, while R+Step-LL and iterative attacks transfer less often.

Clean error is also slightly higher for these models, and the authors attribute the white-box loss to training on fewer white-box single-step examples, with 1/4 of the examples for v3adv-ens4 against 1/3 for v3adv-ens3. The authors judge the white-box cost large relative to the modest gain on transferred examples, and conclude that the main benefit comes from decoupling the attacks from the trained model.

## Gradient masking and the dimension of the adversarial cone

The approximation ratio of Step-LL reaches 13% for v3adv-ens3 and 18% for v3adv-ens4, against 19% for standard Inception v3 and 7% for v3adv. For IRv2adv-ens the ratio rises from 8% for IRv2adv to 14%. The authors note that training on a single-step white-box attack alone does not reduce gradient masking, and that after ensemble training a two-step iterative attack outperforms R+Step-LL, which they read as evidence of meaningful gradients.

The authors measure the size of the adversarial set near a point with the Gradient-Aligned Adversarial Subspace method of Tramèr et al., which looks for orthogonal perturbations of norm epsilon that are all adversarial. The authors note that these perturbations form a cone rather than a subspace, and that its dimension grows with epsilon.

The method of Tramèr et al. finds k orthogonal vectors r\_i with a bound of \\(g^\\top r\_i \\ge \\epsilon \\\|g\\\|\_2 \\frac{1}{\\sqrt{k}}\\), and the authors extend this to the l-infinity norm with \\(\\mathbb{E}\[g^\\top r\_i\] \\ge \\epsilon \\\|g\\\|\_1 \\frac{1}{\\sqrt{k}}\\), which they show is tight.

The study uses 500 correctly classified test points for v3, v3adv and v3adv-ens3, with epsilon in {4, 10, 16} and a search capped at k at most 100. For standard Inception v3, over 50 orthogonal adversarial directions exist for 30% of the points. For v3adv with epsilon at least 10, about 80% of the points have no adversarial direction aligned with the gradient, while most remaining points have k of at least 90.

## NIPS 2017 competition and later attacks

In the competition, attacks were non-interactive black-box attacks with bounded l-infinity norm, and a defense scored by its average accuracy over all adversarial examples. IRv2adv-ens ranked first among 70 submissions in the first development round, with a score of 95.3%, against 89.9% for the second-placed defense. The test set was an easy subset of ImageNet, and the model reached 97.9% accuracy on clean test data.

After the first round the model was released, which allowed white-box attacks, and most final submissions were built on it. The winning defense used adversarial denoising and scored 95.3%, but it dropped to 11.8% on some attacks. The defense that used random padding and resizing scored 92.4%, and the best defense under the worst-case metric kept at least 53.6% against all submitted attacks.

Later work proposes transfer attacks using momentum, data augmentation and gradients from skip connections, which improve transferability. The addendum also notes that adversarial training with multi-step attacks has since been scaled to ImageNet and now gives white-box robustness, which supersedes these results.

## Limitations

Black-box robustness was measured against transferred attacks and the subsequent attacks listed in the addendum, and the 22% accuracy under Wu et al. (2020) shows the gap that remains. The trained models are not robust to white-box Iter-LL or R+Step-LL attacks, and the authors conjecture that larger models would be needed.

Black-box adversaries that attack by means other than transferring examples from a local model were not considered. Interactive adversaries that query the target's prediction function were not evaluated, and the R+FGSM attack does not apply when queries return only the predicted label. Generative attacks were examined by Xiao et al. on MNIST and CIFAR10 and not by this paper.

The formal guarantees cover only the domain adaptation setting, and for ImageNet the robustness conclusions rest on experiments. Convergence is slower than for standard adversarial training, with 280 epochs against 187 epochs for the v3adv baseline.

## Paper info

- **Authors**: Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, Patrick McDaniel
- **Venue**: arXiv · Preprint
- **First published**: 2017-5-19
- **Added**: 2026-11-12
- **Updated**: 2020-4-26
- **Version**: v5
- **arXiv**: 1705.07204
- **Category**: stat.ML · cs.CR · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1705.07204v5) · [PDF ↗](https://arxiv.org/pdf/1705.07204v5)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, Patrick McDaniel (2017). Ensemble Adversarial Training: Attacks and Defenses. arXiv:1705.07204v5. https://arxiv.org/abs/1705.07204v5

**BibTeX**

```
@misc{tramr2017ensemble,
  title = {{Ensemble Adversarial Training: Attacks and Defenses}},
  author = {Florian Tramèr and Alexey Kurakin and Nicolas Papernot and Ian Goodfellow and Dan Boneh and Patrick McDaniel},
  year = {2017},
  eprint = {1705.07204},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1705.07204v5}
}
```

## Other paper commentary

- [Virtual Adversarial Training: A Regularization Method for Supervised and Semi-Supervised Learning](https://refivu.com/en/papers/e553048e-8e0b-413a-97b2-7c98f997c30c-virtual-adversarial-training-a-regularization-method-for.md)
- [Conditional Image Synthesis With Auxiliary Classifier GANs](https://refivu.com/en/papers/cbb27823-75f1-4fb6-b4c8-dcc645b1f162-conditional-image-synthesis-with-auxiliary-classifier-gans.md)
- [StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks](https://refivu.com/en/papers/5f81473c-85d8-4d1a-acd2-1cc917ea3535-stackgan-text-to-photo-realistic-image-synthesis-with.md)
- [Boosting Adversarial Attacks with Momentum](https://refivu.com/en/papers/b89dce42-c994-4509-9776-b934fb9a9d13-boosting-adversarial-attacks-with-momentum.md)
- [InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets](https://refivu.com/en/papers/9891b5b5-2ddd-42e7-a5df-4b7e02d593dc-infogan-interpretable-representation-learning-by-information.md)
- [Self-Attention Generative Adversarial Networks](https://refivu.com/en/papers/819d5b11-1213-4c83-93af-58db3c44b12f-self-attention-generative-adversarial-networks.md)
- [Towards Federated Learning at Scale: System Design](https://refivu.com/en/papers/5a416c7f-9637-4efb-9bcc-4ff43e95b3bd-towards-federated-learning-at-scale-system-design.md)
- [A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT](https://refivu.com/en/papers/188edd2a-83fb-45cc-adcf-4ddabef4e43b-a-prompt-pattern-catalog-to-enhance-prompt-engineering.md)
- [A Contextual-Bandit Approach to Personalized News Article Recommendation](https://refivu.com/en/papers/8024ed96-4fed-4baf-950b-7340e29feb0a-a-contextual-bandit-approach-to-personalized-news-article.md)
- [Learning Efficient Convolutional Networks through Network Slimming](https://refivu.com/en/papers/d840aead-455e-4eaf-8f2c-7e4bff390606-learning-efficient-convolutional-networks-through-network.md)
- [Shortcut Learning in Deep Neural Networks](https://refivu.com/en/papers/429eb10d-b6ea-4d00-b18e-0509b85a5062-shortcut-learning-in-deep-neural-networks.md)
- [BLOOM: A 176B-Parameter Open-Access Multilingual Language Model](https://refivu.com/en/papers/e5a30d68-220d-4a9f-9cf2-26d76639a605-bloom-a-176b-parameter-open-access-multilingual-language.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [domain adaptation](https://refivu.com/en/terms/dfc6e2afbc1f-domain-adaptation)
- [Adversarial training](https://refivu.com/en/terms/79bc85d56747-adversarial-training)
- [Fast gradient sign method](https://refivu.com/en/terms/75749bc5431d-fast-gradient-sign-method)
- [Transferability](https://refivu.com/en/terms/8f5342d83d2f-transferability)
- [Inception v3](https://refivu.com/en/terms/cdc0c667ddbc-inception-v3)
- [PGD](https://refivu.com/en/terms/e60d8e4ac9fb-pgd)
- [Reward Hacking](https://refivu.com/en/terms/2413bbf555b3-reward-hacking)
- [gradient masking](https://refivu.com/en/terms/ec5153e5264a-gradient-masking)
- [approximation ratio](https://refivu.com/en/terms/449529580ef3-approximation-ratio)
- [Ensemble Adversarial Training](https://refivu.com/en/terms/af3bc3b2908c-ensemble-adversarial-training)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/c363c126-7d65-4e0a-aa01-0b7a02e39200-ensemble-adversarial-training-attacks-and-defenses)
