TL;DR
Neural networks can be fooled by inputs that differ from a normal input by an amount too small for a person to notice. A defense called defensive distillation had cut the success rate of the attacks known at the time from 95% to 0.5%. Carlini and Wagner built three new attacks, one for each of the common distance measures , and , and each succeeded with 100% probability on the images the paper tested, on both the distilled and the ordinary network. The paper's lasting contribution is a standard for defenses: test them against strong attacks before trusting them.
Builds on: Adversarial Examples, Constrained Optimization, Cross-Entropy Loss, Softmax · Leads to: the attack-evaluation practice used for later defenses, and Adversarial Training as a method whose claims are judged against such attacks
Why it mattered
Adversarial examples were known since 2013, but defensive distillation in 2016 looked like a real fix for a network that could be trained in one extra pass. The paper showed that the apparent security came from weak attacks rather than from a robust network. The attacks were released as code, and the authors recommended that anyone proposing a defense first check whether it resists these attacks, and whether its high-confidence adversarial examples transfer to the defended model.
The paper also changed how people talk about robustness. A defense that stops a weak attack says little. A defense is only meaningful when it survives an attack that is strong enough, and the paper gave concrete attacks that could serve as that test.
The problem
A classifier assigns an input a label. An adversarial example is a new input that is close to under some distance, but is labeled with a chosen target class . Robustness means how far the nearest adversarial example is. The difficulty is that the attacker must find a point that both looks like and gets the target label, and the classifier's output is a smooth function that is hard to push toward a specific label.
Before this paper, the attacks used to test defenses had three weaknesses. They were often fast but found large distortions. Some failed completely on hardened networks. And they were fragile: as Section VIII-A shows, they could fail even when adversarial examples existed, so a failure did not prove the network was safe. Defensive distillation seemed to defeat the attacks of the time, which made it look robust, but the authors showed the attacks were failing for reasons that had nothing to do with robustness.
How it works
The method turns the attack into a numerical optimization problem, then solves it with gradient descent. Here is the walkthrough for one target, with the attack, which is the one the paper relies on most.
- Choose a source image and a target class. Start from an image with correct label , and pick a target class different from it. Check: the attack must make the network output for the changed image .
- Measure distortion. Use the squared distance , the sum of squared pixel changes. Check: moving one pixel from 0 to 0.5 costs , and moving it from 0 to 1 costs .
- Measure how far the target is from winning. Let be the logits, the network's scores before softmax. The loss is positive while some other class has a higher score than class , and stops decreasing once leads by a margin. Check: with margin , if is already the largest score, equals .
- Keep pixels in range. Write each pixel as , where is an unconstrained number. Any real gives a pixel in , so no box constraint is needed. Check: gives pixel .
- Trade off distortion against success. Minimise over with gradient descent. The constant sets the balance: a larger puts more weight on success. Check: with too small the example stays on the original class; with too large it is far from .
- Search over . Use binary search over , and for each value run gradient descent with the Adam optimizer. Keep the smallest distortion that still succeeds. Check: the search stops at a that is large enough to succeed and as small as possible.
- Restart from several points. Start gradient descent from several random points near the best example found so far, to avoid getting stuck in a poor local minimum.
flowchart LR
A["Image x, target t"] --> B["Reparametrise pixels with tanh"]
B --> C["Minimise distortion + c times f"]
C --> D{"Target wins?"}
D -- no --> E["Adjust c with binary search"]
E --> C
D -- yes --> F["Keep the smallest distortion found"]
A tiny trace of step 4. Take . Then , so the pixel is . Take . The pixel is . Both values stay inside without any clipping step.
The math
Given an input with correct label , a target , and a distance , a targeted adversarial example is an input with that minimises among inputs of the same kind. Here .
The paper uses the norm , with counting changed pixels, the Euclidean length of the change, and the largest single change. All pixel values lie in , so changing one pixel from fully on to fully off has and .
Step 2 in symbols: the distance
Step 3 in symbols: the margin loss
Let be the logit of class . The paper's loss is
The inner term is positive while some other class leads . It becomes negative once leads by more than , and the outer max stops the loss from falling below . The paper sets for its main attacks. Raising asks for a more confident misclassification, which the transferability experiment uses.
Step 4 in symbols: the change of variables
The function has range , so lies in for every real . This is why the paper can drop the box constraint and use an unconstrained optimiser. The same identity gives , where is the logistic sigmoid.
Step 5 in symbols: the full problem
The first term keeps the example close to . The second pushes it to class . The constant balances them.
Step 6 in symbols: choosing c
For each candidate , the paper runs the minimiser and records whether the target is reached. Binary search over finds the smallest value that succeeds. The paper reports 20 binary-search steps, each with 10,000 Adam iterations. It notes that Adam reaches 95% of the optimum within 1,000 iterations in 92% of runs.
Worked examples
A toy image has one pixel with value . We want the change to give target , and we try and .
- Start with . Then , so .
- The change is , so the distance is .
- Now try . Then , so .
- The change is about , so the squared distance is about .
- Check: .
- Interpretation: the transform keeps every candidate in , and a larger moves the pixel further from the original. The optimiser trades this distance against the margin loss.
Table IV of the paper reports the average distortion of the targeted attack on the undistilled MNIST network, with the target chosen at random. The paper's convention puts pixel values in .
- The average-case mean for MNIST is 1.76, with success probability 100%.
- The best-case mean is 1.36, and the worst-case mean is 2.60, both with success 100%.
- The best previously reported attack in the same table, DeepFool, has a best-case mean of 2.11 on MNIST.
- Ratio: . On this best-case MNIST row the new attack needs about 1.55 times less distortion than DeepFool.
- Interpretation: the paper's general claim, that its and attacks need 2 to 10 times lower distortion than the best previous attacks, covers all the comparisons together. This one row shows a smaller gap, so read the claim against the individual rows.
Defensive distillation trains the network at temperature . Table VI reports the attack on distilled networks.
- On distilled MNIST the mean distortions are 1.7 (best case), 2.2 (average case) and 2.9 (worst case). Each has success probability 100%.
- On the same undistilled network (Table IV), the means were 1.36, 1.76 and 2.60.
- On average the distilled network needs about 25% more distortion, comparing 2.2 with 1.76.
- Check: .
- The previous attacks, which the paper says all fail on distilled networks, are the reason distillation had looked strong. The new attack succeeds on every image, so the distilled network gave only a small increase in distortion.
- Interpretation: distillation adds a little distance but does not stop an attack that is willing to search longer.
Try it: Table IV gives a worst-case mean of 0.51 for the undistilled CIFAR network and Table VI gives 0.92 for the distilled one. By what factor did the distilled distortion rise?
Answer: . The distilled network needs about 1.8 times the distortion in the worst case.
Results
Attack strength against the undistilled networks (Table IV). On MNIST and CIFAR-10, every new attack succeeded on every target, with mean distortions of 1.36 to 2.60 on MNIST and 0.17 to 0.51 on CIFAR-10 across the best, average and worst cases. The fast gradient sign method failed on some cases; on the worst case for MNIST it succeeded 0% of the time, and on the average and worst cases for CIFAR-10 its success rate fell to 51% and 1%.
Attack strength on ImageNet (Table V). The paper used the pre-trained Inception v3 network, which has 96% top-5 accuracy. The attack found untargeted adversarial examples with mean distortion 0.32, and the least-likely-target variant reached 2.22, both with success probability 100%. JSMA could not run on ImageNet at all within the paper's setup, so the paper reports it as failing.
Attacks on distillation (Table VI). Each of the three new attacks succeeded on 100% of cases on distilled networks. The means were close to the undistilled values: the paper concluded that distillation "has added almost no value."
Temperature. The paper cites the original work for a drop in attack success on MNIST from 91% at , to 24% at , to 0.5% at . With its own attack, the mean distance was uncorrelated with temperature, with correlation coefficient . Higher temperature therefore made the old attacks fail, not the network safer.
Transferability. Adversarial examples built on one ordinary MNIST model transferred to a second ordinary model with success rising with the margin , reaching near 100% at . Transfer to the distilled model reached 100% only at . This gives a second, separate test that the authors recommend.
Models used. The MNIST network reached 99.5% accuracy, comparable to the state of the art, and the CIFAR-10 network 80%, identical to the accuracy in the original distillation work. The CIFAR-10 model overfits: training accuracy was 98% against 80% on validation.
Limits. The paper gives upper bounds on robustness, not proofs. The distance measures are imperfect models of human perception, which the paper says it does not settle. The ImageNet best and worst cases are estimated from 100 random target classes out of 1,000. Some earlier attacks are compared using numbers from their papers and others are re-implemented by the authors, and the paper notes that results across different models are not directly comparable.
Reading guide
- Section I, Introduction. Motivation and the three contributions. Read it with Adversarial Examples in mind.
- Section II-A and II-B, threat model and notation. The white-box assumption, and softmax and logits. Needs Softmax and Activation Function.
- Section II-C and II-D, adversarial examples and distance metrics. Needs Vector Norm for the definitions.
- Section II-E, defensive distillation. Needs Knowledge Distillation and softmax with a temperature.
- Section III, existing attacks. L-BFGS needs Constrained Optimization and Gradient Descent. The fast gradient sign method is covered in Fast Gradient Sign Method.
- Section V-A, objective functions. Needs Cross-Entropy Loss and Hinge Loss. This is where the margin loss is chosen.
- Section V-B, box constraints. The change of variables with . Needs Constrained Optimization.
- Section VI-A, the attack. Needs Binary Search and Adam Optimizer. The core of the paper.
- Section VII, evaluation. Tables IV and V. Read the numbers against the success column, not only the means.
- Section VIII, distillation. Table VI, the temperature experiment, and transferability. Needs Adversarial Training for the wider context.
Check yourself
QuestionWhy does the paper replace the box constraint on pixels with the change of variables ?Show answer
Because takes values in for every real , so always lies in . The optimiser can then work over all real with plain gradient descent, and no clipping or constrained solver is needed.
QuestionFor the pixel , compute to two decimal places, given .Show answer
. So the pixel is . This is close to 0, as expected for a very negative .
QuestionThe margin loss uses in the main experiments. What does a larger change, and why is it useful?Show answer
A larger keeps the loss from reaching its floor until the target class leads by at least . The optimiser then produces examples that the network puts in class with more confidence. The paper uses this to build high-confidence examples that transfer to a distilled network, which needs rather than .
QuestionA new defense reduces the success of the fast gradient sign method from 95% to 2%. Why does the paper say this is not enough evidence that the defense is robust?Show answer
Because the paper showed that the older attacks can fail on a defended network even when adversarial examples exist, as with distillation. Success on a weak attack says little about the strongest attack. The paper's recommendation is to test the defense against a strong attack such as its method, and to check whether high-confidence examples transfer to the defended model.