TL;DR
Neural networks, and many other classifiers, can be fooled by an input changed by an amount too small for a person to notice. Earlier work blamed strong nonlinearity or overfitting. This paper argues the main cause is that the models are too linear: a sum over many small input changes, all pushed in the harmful direction, can move the output a long way. The authors also give the fast gradient sign method (FGSM), a single-step way to build such inputs, and show that training on them regularizes a maxout network on MNIST.
Builds on: FGSM, Logistic Regression · Leads to: Adversarial Training
Why it mattered
The paper turned adversarial examples from a curiosity into a standard research problem. FGSM became the baseline attack that new defences are tested against. Its one-step recipe needs only one gradient, so it runs in the time of one backward pass, which made it cheap enough to generate new examples during training. The paper has been cited more than 20,000 times according to Semantic Scholar. Its idea of adversarial training, mixing clean and perturbed inputs in each batch, is still a common baseline for making image classifiers robust, and its linear explanation is still the starting point for many follow-up analyses.
The problem
Before this paper, the observations from Szegedy and colleagues were clear. A trained network can be pushed to a wrong answer with a change to the input that a person cannot see. The same perturbed input often fools several different networks. Shallow softmax models were fooled too. The explanations on offer were nonlinearity, overfitting and insufficient regularization.
Those explanations are hard to test and do not account for why the same wrong answer appears across models. The paper's question is simple: if a model is built from weighted sums, how much can a tiny change to the input move the score? Answering that needs only the ideas of dot products and norms (the size of a perturbation), and the claim is that this is already enough.
How it works
The paper's argument has four steps. Trace them on one tiny linear model first.
- Take a linear score , where is the weight vector and the input. Use and . Then . Check: each product is , and .
- Allow a change to each input value, but keep every change within a small budget : . The best choice for growing the score is to push each input in the direction of its weight's sign: . With , . Check: the signs of are .
- Compute the new score: . The change, , equals . Check: the three contributions are , and .
- Now scale up. The paper's point is that the change is times the average weight size , times the number of inputs . Here and , giving . Each input moved by only , but if the average weight size stays 2 across a thousand inputs, the same budget moves the score by .
The growth in step 4 is linear in , as the plot shows. A budget that looks harmless per input adds up across many inputs.
- score change, eps = 0.1, mean weight 2
The paper then makes this a method. Let be the training cost. Approximate it near the input by a linear function and choose the perturbation that increases it most within the budget. That perturbation is the fast gradient sign method, and it is one step using one gradient, which backpropagation computes.
flowchart LR A["Input x and true label y"] --> B["Compute gradient of cost with respect to x"] B --> C["Take sign of each entry"] C --> D["Multiply by budget epsilon"] D --> E["Add to x to get adversarial input"] E --> F["Model output changes"]
The math
The linear argument
For a model with weight vector and an input , the score is
The perturbation adds to the score. Under the constraint , the largest possible increase is reached at , and it equals . If each weight has average magnitude and there are of them, this is . This is step 4 in symbols, and it is the source of the paper's high-dimension argument.
Step 2 in symbols: the sign rule
Step 2 used the sign of the weights. The max-norm budget says each entry is limited to , so the best entry is always at the edge of that box, with the sign of whatever direction helps. The sum is largest when each has the sign of . That gives .
The general method in symbols
For a nonlinear model, the same idea works after a linear approximation of the cost. The gradient plays the role of , and the paper's rule is
Each entry of the gradient says how the cost changes when that input value rises. The sign turns each one into a step of size in the uphill direction. Only the sign is kept, so the size of the gradient does not matter. The step is one backward pass, which is why the paper calls it fast.
The adversarial training objective
The paper trains with a mix of clean and perturbed costs:
with in all of the paper's experiments. Because the perturbation is recomputed from the current model at every step, the supply of adversarial examples keeps pace with the model as it learns.
Logistic regression, where the method is exact
For logistic regression with labels , the worst-case perturbed cost has a closed form. Take a positive example, : the sign of the gradient is , and , so the adversarial cost is
where is the softplus function. The paper writes the general case with multiplying the whole bracket, which gives the same result for . The term looks like an L1 penalty, but the paper points out that it is subtracted from the activation rather than added to the cost, so it can fade once the model is confident. That makes it a different form of regularization from weight decay.
Results
The paper's numbers come from three kinds of experiment.
Attacks on shallow and deep models. With on MNIST pixel values in , FGSM made a shallow softmax classifier wrong on 99.9% of test images, with an average confidence of 79.3% in its wrong answers. On ImageNet with GoogLeNet, a change of , the size of the smallest bit of an 8-bit image, changed the predicted class of the image shown in Figure 1 of the paper. The attack needs no search, so it works on any differentiable model.
Adversarial training as regularization. A maxout network with dropout had a test error of 0.94% on MNIST. Training with the adversarial objective brought it to 0.84%. A larger version, with 1600 units per layer, had 1.14% test error without adversarial training and overfit slightly. The authors enlarged the model because it could not reach zero error on the adversarial examples in its training set. On adversarial examples, the same kind of model had an error rate of 89.4% without adversarial training and 17.9% with it. The paper's control experiments with L1 weight decay and with added noise did not produce the same effect.
Limits of the explanation. A shallow RBF network had an error rate of 55.4% on FGSM examples at , but its confidence on those mistakes was only 1.2%, against 60.6% on clean examples. The authors read this as a sign that nonlinear units with local support fail more gracefully. An ensemble of twelve maxout networks still had a 91.1% error rate on adversarial examples built against the whole ensemble at . The main experiments use MNIST, CIFAR-10 and one ImageNet example, and the regularization result is shown on one network, so the claim is supported but not tested widely in this paper.
Reading guide
The paper has nine short sections after the introduction. Read them with these lessons nearby.
- Section 1, Introduction, and Section 2, Related work. You need Adversarial Examples for the phenomenon, and Dot Product to follow why a sum over inputs can grow.
- Section 3, The linear explanation. This is the core argument. You need Dot Product, Vector Norm for the max-norm budget, and the step-by-step example above.
- Section 4, Linear perturbation of nonlinear models. The fast method itself. You need Gradient and Fast Gradient Sign Method, since the paper's rule is the one defined there.
- Section 5, Adversarial training of linear models versus weight decay. Read it with Logistic Regression, where the method is exact.
- Section 6, Adversarial training of deep networks. You need Universal Approximation Theorem for the claim that a hidden layer can represent resistant functions, and Dropout for the baseline the paper beats.
- Sections 7 to 10. These compare model capacity, the transfer of adversarial examples between models, and the alternative hypotheses. You need Radial Basis Function and Ensemble Learning to follow the RBF and ensemble tests.
Check yourself
QuestionIn one sentence, what does the paper claim causes adversarial examples, and what is its evidence for the claim?Show answer
The paper claims that the models are too linear. A linear score can be pushed far by many small input changes that all point the harmful way, and the amount grows with the number of inputs. The evidence is the analysis of linear models, the exact result for logistic regression, and the fact that a simple linear-style attack fools many trained models.
QuestionA linear model has weights and an input budget . By how much can the score change, at most, under the max-norm budget?Show answer
The largest change is . The best perturbation is , and its effect on the score is .
QuestionWhy does the paper keep only the sign of the gradient instead of the gradient itself?Show answer
The max-norm budget limits each input entry to plus or minus , so the best move for each entry is to the edge of the box in the direction that increases the cost. Only the direction matters for that choice, so the sign is enough and the size of each gradient entry is discarded. This keeps the perturbation at a known size, which makes it easy to compare across inputs.
QuestionA team adds FGSM adversarial training to a classifier and sees its clean test error rise slightly while its FGSM error falls sharply. Using the paper's setup, what could explain this, and what would you check next?Show answer
The paper mixed clean and adversarial costs with a fixed weight of 0.5, and it did not tune that weight. A model with limited capacity may spend its effort on the perturbed inputs at the expense of clean ones, which is what the paper's enlargement of its network hints at. Check the mixing weight, check whether the model has enough units, and test on attacks other than FGSM, because robustness to one attack does not imply robustness to another.