Search

Search papers and lessons

Adversarial Examples Are Not Bugs, They Are Features

Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras et al. · 2019

Ilyas and colleagues show that adversarial examples come from non-robust features, which are predictive but fragile, and that models trained on those features alone still generalise.

On this page

  • Colour = topic mix
  • Calculus
  • Discrete math
  • Neural network basics
  • Linear algebra
  • Losses & regularization
  • Probability
  • ReadReady to readNot yet

TL;DR

Ilyas and colleagues argue that adversarial examples are not bugs in a model's logic. They come from non-robust features: patterns in the data that predict the label well but break under small, deliberate changes. The paper supports this with experiments that separate robust from non-robust features in CIFAR-10. A model trained only on non-robust features still generalises to the normal test set.

Builds on: Adversarial Examples, Adversarial Training, Linear Classifier · Leads to: Robust and Non-Robust Features (the concept this paper introduces)

Why it mattered

Before this paper, most explanations of Adversarial Examples treated them as side effects of high-dimensional geometry or of Overfitting to noise in the training set. The paper gives a different account: the same patterns that let a model generalise are the ones an attacker exploits. That reframing changed how researchers test defences. It also made adversarial transferability, the fact that an attack on one model often fools another, look like a predictable result rather than a surprise.

The ideas are used now in robustness work on image classifiers, where Adversarial Training is a common defence. The vocabulary of "useful" and "robust" features gives researchers a shared way to talk about why a model is brittle.

The problem

Standard training of a classifier minimises a average loss that rewards any feature correlated with the label on clean data. It does not ask whether the feature stays correlated under a small change to the input. Adversarial training was the known fix, but it costs accuracy and computation, and nobody had a clear account of why a fix of that kind should be needed.

The question the paper asks is precise: are adversarial examples a flaw that happens to come with standard training, or are they a consequence of what the data itself contains? If the data contains features that are both predictive and fragile, then standard training will use them, and adversarial examples follow.

How it works

The paper's argument runs in four stages. Each stage tests a claim the previous one made.

  1. Define the feature view. Treat every function from input to a real number as a feature. A feature is useful if its correlation with the label is positive on average. A feature is robust if it stays useful under the worst change in the allowed set, and non-robust if it is useful but not robust. Standard training treats useful features alike, so it uses non-robust ones too.

  2. Build a robust dataset. Take a robustly trained model CC, and find for each training image xx a new image xrx_r that keeps the features CC uses (its penultimate-layer activations g(x)g(x)) close to g(x)g(x). Keep xrx_r labelled with the original label. The result, D^R\widehat{\mathcal{D}}_R, has only the features that matter to the robust model. Train a standard model on it and test on the original test set. The paper reports that the standard model gains robustness.

  3. Build a non-robust dataset. Repeat stage 2 with a standard (non-robust) model. This time the new images are pushed towards a target class tt and labelled tt, so they look wrong to a person. Train on this set, and test on the original test set. The paper's Table 1 reports the result (see Results).

  4. Check transferability. Train five architectures on the deterministic set. Then make adversarial examples against a standard ResNet-50 and count how often they also fool each architecture. The paper finds that the accuracy of each architecture predicts how often the attacks transfer to it.

The math

The definitions

Labels are y∈{±1}y \in \{\pm 1\}, and inputs come from a distribution D\mathcal{D}. A feature ff is any function from inputs to real numbers. The paper scales each feature to mean zero and unit variance, so that E[f(x)]=0\mathbb{E}[f(x)] = 0 and E[f(x)2]=1\mathbb{E}[f(x)^2] = 1, which makes the definitions scale-free.

Useful. A feature is ρ\rho-useful, for some ρ>0\rho \gt 0, if

E(x,y)∼D[ y⋅f(x) ]≥ρ.\mathbb{E}_{(x,y)\sim\mathcal{D}}[\, y \cdot f(x) \,] \geq \rho.

With balanced labels and normalised features, this is the correlation between yy and f(x)f(x).

Robustly useful. Let Δ(x)\Delta(x) be the set of allowed perturbations. A ρ\rho-useful feature is robust if, for some γ>0\gamma \gt 0,

E(x,y)∼D[ inf⁡δ∈Δ(x)y⋅f(x+δ) ]≥γ.\mathbb{E}_{(x,y)\sim\mathcal{D}}\Big[\, \inf_{\delta\in\Delta(x)} y \cdot f(x+\delta) \,\Big] \geq \gamma.

Non-robust. A feature is useful but non-robust if it is ρ\rho-useful for some ρ>0\rho \gt 0 and is not γ\gamma-robust for any γ≥0\gamma \geq 0.

Stage 1 in symbols: standard training cannot tell them apart

A linear classifier is C(x)=sgn(b+∑f∈Fwff(x))C(x) = \mathrm{sgn}\big(b + \sum_{f \in F} w_f f(x)\big), where FF is a set of features. The standard loss is −E[ y⋅(b+∑fwff(x)) ]-\mathbb{E}[\, y \cdot (b + \sum_f w_f f(x)) \,]. Its value depends only on each feature's usefulness, so a robust and a non-robust feature with the same ρ\rho look the same to it. The paper states that a training objective of this kind gives "no distinction" between them. Adversarial training replaces the loss with E[max⁡δ∈Δ(x)L(x+δ,y)]\mathbb{E}[\max_{\delta \in \Delta(x)} \mathcal{L}(x+\delta, y)], which can discern them.

Stage 3 in symbols: the non-robust dataset

For a target class tt, the construction produces images xtx_t whose features match those of a source image xx on the features the standard model uses, while the label is set to tt. A feature the model does not use is, approximately, uncorrelated with the label on the new set, because the starting point is drawn independently of its label. The expected label correlation on the new set is

ED^[ y⋅f(x) ]{>0if f is non-robustly useful under D,≃0otherwise.\mathbb{E}_{\widehat{\mathcal{D}}}[\, y \cdot f(x) \,] \begin{cases} \gt 0 & \text{if } f \text{ is non-robustly useful under } \mathcal{D}, \\ \simeq 0 & \text{otherwise.} \end{cases}

So the new set carries only the non-robust features, and only in the direction of the new label. The non-robust features are correct here, while a person sees the labels as wrong.

Stage 4 in symbols: transfer

If two models rely on the same non-robust features, an attack built from one model's gradient will change the other's output too. The paper's claim is that architectures which fit the non-robust dataset better share more of these features, so they are more vulnerable to the attack. This is an argument from shared features, not from shared weights.

Results

The paper's Table 1 reports test accuracy on the original CIFAR-10 test set, for models trained on three training sets. The numbers are those in the paper; the table caption is the source of the labels.

Training setTest accuracy on CIFAR-10
Original training set95.3%
Random-target non-robust set D^rand\widehat{\mathcal{D}}_{rand}63.3%
Deterministic-target non-robust set D^det\widehat{\mathcal{D}}_{det}43.7%

Chance on CIFAR-10 is 10 percent, so the deterministic set's 43.7 percent shows that the non-robust features carry real signal. The table also shows that the original data gives the best accuracy, as expected.

For the robust set (stage 2), the paper reports that a standard model trained on it attains good accuracy on the original test set, under both clean and adversarial evaluation, and that its robustness is much higher than that of the standard model. The paper's figures show these curves; the text does not report one headline number for them, so do not quote a single figure from the text.

Transferability (stage 4) is reported as a relationship across five architectures. Architectures that learn better from the deterministic set transfer more attacks from the original ResNet-50. This is the paper's evidence that transfer comes from shared non-robust features.

Limits. The experiments use CIFAR-10 and a ResNet-50 source. The robust set does not fully match the accuracy of the robust model it was built from, and the paper names distribution shift as one possible reason. The theory in section 4 uses a two-Gaussian problem, which is much simpler than deep networks. The paper says its framework does not capture every intuitive meaning of "non-robust", and it leaves that gap for future work.

Reading guide

Read the paper in this order, with the lessons to have ready:

Check yourself

QuestionRecall: what makes a feature non-robust, and why does the paper say standard training cannot tell it apart from a robust feature?Show answer
A non-robust feature is useful, meaning it is positively correlated with the label on average, but it is not robust, so no positive value of γ\gamma bounds its worst-case correlation under the allowed perturbations. Standard training scores a feature only by its usefulness, so robust and non-robust features with the same usefulness look the same to it.
QuestionComputation: on the CIFAR-10 test set, a model trained on the original data reaches 95.3 percent accuracy, and one trained on the deterministic non-robust set reaches 43.7 percent. What is the gap in percentage points, and how far above chance is the second model, given that chance is 10 percent?Show answer
The gap is 95.3−43.7=51.695.3 - 43.7 = 51.6 percentage points. The second model is 43.7−10=33.743.7 - 10 = 33.7 percentage points above chance.
QuestionWhy: why does the paper build the non-robust dataset with images labelled as a target class tt, and why does this make the dataset look wrong to a person?Show answer
The construction moves each image towards a target class tt on the features a standard model uses, and labels the image tt. The new labels agree with the non-robust features, which carry the signal, so a model trained on the set learns those features. A person looks at the image content, which still resembles the source image, and sees a label that does not match it.
QuestionApplied: a team finds that an attack built on their model also fools a different architecture trained on the same data. What does the paper suggest is the cause, and what experiment would you run to test it?Show answer
The paper suggests the two models rely on the same non-robust features, so the attack transfers through shared features rather than shared weights. To test it, train several architectures on the same data, measure their accuracy and how often attacks from the first model transfer to each, and check whether better-fitting architectures are the ones most affected. The paper's Figure 3 does this for five architectures.

Sources

Read the full paper

Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras et al., 2019. arXiv:1905.02175