# Towards Evaluating the Robustness of Neural Networks

Three new attacks show defensive distillation does not stop adversarial examples

Carlini, Nicholas, Wagner, David · arXiv · 2016-8-16

- **Problem** Defensive distillation cut the success of existing attacks from 95% to 0.5%, but it was unclear whether this reflected real robustness. The earlier attacks failed because their gradients vanish on distilled networks.
- **Method** The authors build three targeted attacks, one for each of three distance metrics. Each attack minimizes the distance plus c times a margin loss, and it searches over c with binary search.
- **Results** The attacks reach 100% success on distilled MNIST and CIFAR-10 networks, where earlier attacks found no adversarial examples. On undistilled MNIST, the best-case mean L2 distance is 1.36 for the authors' attack and 2.11 for Deepfool.

## Why defensive distillation looked like a fix

Adversarial examples are inputs changed by a small amount so that a trained network assigns them a different label. For self-driving cars, that gap decides which tasks a network can safely be trusted with. Defensive distillation was proposed as a defense that can be added to any feed-forward network with one extra training pass. Its reported effect was large, since existing attacks fell from 95% to 0.5% success.

The open question is whether that drop reflects real robustness or only attacks that are too weak to find adversarial examples.

The recipe trains a teacher network whose softmax is divided by a temperature T. The teacher then labels every training instance with its soft outputs, and a student of the same shape is trained on those labels. The student is deployed at temperature 1, so an attacker faces the sharpened version of the output. That sharpening is where the trouble for attacks starts.

## Why gradient attacks stall on the distilled model

The authors trace the failure of L-BFGS and Deepfool to gradients that are almost always zero. Training at temperature T and testing at 1 scales the logits up by a factor of T, which pushes the softmax output toward a hard 0 or 1. The authors measured this: the mean L1 norm of the logits is 5.8 on the undistilled network and 482 on the network distilled at T = 100.

At that scale most wrong-class probabilities round to zero in 32-bit floating point, so the gradient vanishes as well.

The authors read this as fragility in the loss function rather than as a property of distillation alone. Computing the loss through softmax of Z divided by T, or using their stable objective, lets L-BFGS keep making progress. JSMA-F fails because its softmax becomes a hard maximum, and it is the variant Papernot et al. used against distillation.

JSMA-Z avoids vanishing gradients, but it treats every change in the logits as equally important whatever it does to the output. Fast gradient sign fails at first for the same reason as L-BFGS, yet dividing the logits by T still leaves distillation effective, and the authors can't explain why.

## One objective and a box constraint

The key idea is to replace the hard requirement that the target class wins with a function f that is at most zero exactly when it does. The attack then minimizes the distance plus c times f, so the constant c decides how much closeness is traded for success. \\\[ \\min\_{\\delta}\\; D(x,x+\\delta) + c\\cdot f(x+\\delta) \\quad \\text{s.t.} \\quad x+\\delta\\in\[0,1\]^n \\\] The authors list seven candidate choices of f, and the logit margin f6 is the one they found most effective.

In Table III, f6 with change of variables reaches a best-case mean L2 of 1.94 with 100% success on MNIST. The L2 attack uses a clipped version of the margin, \\\[ f(x') = \\max\\big(\\max\_{i\\neq t} Z(x')\_i - Z(x')\_t,\\; -\\kappa\\big) \\\], so the solver stops pushing once the target leads by κ. The authors set κ = 0 in their attacks, and κ is the knob that controls how confidently the target class wins.

To keep every pixel inside the valid range, the authors write δ\_i as ½(tanh(w\_i)+1) − x\_i and optimize over w. They optimize w with Adam, which converged faster than the other solvers they tried while reaching the same quality. Greedy gradient descent can stall in a local minimum, so they also restart from several random points in a ball around the input.

Rather than tuning c by hand, the authors search over it: the smallest c that makes f at most zero gives a solution within 5% of optimal in 70% of cases. The attack runs 20 iterations of binary search over c, and each candidate c gets 10,000 Adam iterations.

## Adapting the L2 machinery to L0 and L∞

The L0 distance counts changed pixels, which gradient descent can't optimize directly. So the authors run their L2 attack repeatedly and, in each round, fix the pixel whose removal costs the least. The choice uses the gradient g of f at the adversarial point, selecting the index i that minimizes g\_i times δ\_i. Picking the smallest \|δ\_i\| is simpler but yields 1.5 times higher L0 distortion.

When the L2 search fails in a round, the authors double c and retry, and each round starts from the previous solution. That warm start cuts the number of gradient rounds, because the solution with k pixels held fixed is close to the one with k+1 fixed.

Penalizing the L∞ norm directly makes gradient descent oscillate, since the norm only penalizes the largest coordinate. The authors replace this naive penalty with an iterative procedure that avoids the oscillation.

The optimizer works on continuous values, so the authors round each pixel to the nearest integer intensity. A greedy search on the integer grid then restores attack quality, and it did not fail in any of their attacks.

## Results on defensively distilled networks

On distilled MNIST and CIFAR-10 networks at T = 100, each of the three attacks succeeds on every image. In best-case mean distortion on MNIST, the distilled model needs 10 for L0, 1.7 for L2 and 0.14 for L∞. On the undistilled network the same best-case figures are 8.5, 1.36 and 0.13, so distillation adds only a small increase in needed change.

The earlier attacks, by contrast, fail to find any adversarial example on the distilled networks. The authors attribute that failure to the gradient problems described earlier, not to a lack of adversarial examples.

The authors' Figure 8 plots mean adversarial distance against distillation temperature on MNIST and reports that the two are uncorrelated.

## Comparison on undistilled networks

On undistilled MNIST, the best-case mean L2 distance is 1.36 for the authors' attack and 2.11 for Deepfool. On the same model and metric, the authors' attack lands closer to the original image than Deepfool.

Under L0, the best-case mean on MNIST is 8.5 for the authors' attack, compared to 20 for JSMA-Z and 17 for JSMA-F. The gain comes at a runtime cost, since the L0 attack is slower than the authors' own optimized JSMA. The authors warn that exact runtime comparisons can mislead, so they don't report precise timings.

The authors claim their L0 attack is the first published attack to cause targeted misclassification on ImageNet.

## Limitations

The distillation results cover only MNIST and CIFAR-10, and the attack tables use the single temperature T = 100. The ImageNet experiments attack the pre-trained Inception v3 model, and the authors did not re-implement distillation there. On ImageNet the best and worst cases are approximated by sampling 100 random target classes out of 1,000.

The authors leave the choice of distance metric open and accept that L0, L2 and L∞ are imperfect proxies for human perception. The selected text describes the transferability test but does not show its numbers. The attacks assume full white-box access to the architecture and all parameters.

## Paper info

- **Authors**: Carlini, Nicholas, Wagner, David
- **Venue**: arXiv · Preprint
- **First published**: 2016-8-16
- **Added**: 2026-11-11
- **Updated**: 2017-3-22
- **Version**: v2
- **arXiv**: 1608.04644
- **Category**: cs.CR · cs.CV
- **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/1608.04644v2) · [PDF ↗](https://arxiv.org/pdf/1608.04644v2)

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

Carlini, Nicholas, Wagner, David (2016). Towards Evaluating the Robustness of Neural Networks. arXiv:1608.04644v2. https://arxiv.org/abs/1608.04644v2

**BibTeX**

```
@misc{nicholas2016towards,
  title = {{Towards Evaluating the Robustness of Neural Networks}},
  author = {Carlini, Nicholas and Wagner, David},
  year = {2016},
  eprint = {1608.04644},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1608.04644v2}
}
```

## Other paper commentary

- [Attention U-Net: Learning Where to Look for the Pancreas](https://refivu.com/en/papers/b480e08e-027d-4c11-b1c5-0d3a4a63ead9-attention-u-net-learning-where-to-look-for.md)
- [node2vec: Scalable Feature Learning for Networks](https://refivu.com/en/papers/dc0725e4-ec21-4d60-9363-0eac2fc69a10-node2vec-scalable-feature-learning-for-networks.md)
- [Explainable Artificial Intelligence (XAI): Concepts, Taxonomies, Opportunities and Challenges toward Responsible AI](https://refivu.com/en/papers/3f686a20-03db-4642-80bb-f85fafc1d04f-explainable-artificial-intelligence-xai-concepts-taxonomies.md)
- [Intriguing properties of neural networks](https://refivu.com/en/papers/5d9b1ffd-1b1d-4795-87df-32680ad74683-intriguing-properties-of-neural-networks.md)
- [Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling](https://refivu.com/en/papers/136a3b1f-3eb6-469b-8a8a-7536056851d5-empirical-evaluation-of-gated-recurrent-neural-networks-on.md)
- [Convolutional Neural Networks for Sentence Classification](https://refivu.com/en/papers/e03eeb97-8544-4ef6-a8e6-47276e072373-convolutional-neural-networks-for-sentence-classification.md)
- [Multi-Scale Context Aggregation by Dilated Convolutions](https://refivu.com/en/papers/d3d006c0-f6b8-44aa-adba-a3ef2b601bbf-multi-scale-context-aggregation-by-dilated-convolutions.md)
- [Learning Spatiotemporal Features with 3D Convolutional Networks](https://refivu.com/en/papers/ea19793d-36a8-4fd0-8e8c-f8d836d8146c-learning-spatiotemporal-features-with-3d-convolutional.md)
- [PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space](https://refivu.com/en/papers/34b11e2b-6f2e-4cbb-88e2-1045aeb46f06-pointnet-deep-hierarchical-feature-learning-on-point-sets.md)
- [Image Super-Resolution Using Deep Convolutional Networks](https://refivu.com/en/papers/cb0f63f2-2b9c-40a6-9d74-55cfce2a1ea6-image-super-resolution-using-deep-convolutional-networks.md)
- [ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices](https://refivu.com/en/papers/5e319185-7793-46fa-a04c-1eefe3a80e23-shufflenet-an-extremely-efficient-convolutional-neural.md)
- [Path Aggregation Network for Instance Segmentation](https://refivu.com/en/papers/a3658986-d50d-4da4-997a-1b69d8a09d76-path-aggregation-network-for-instance-segmentation.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [CIFAR-10](https://refivu.com/en/terms/19035a518d0a-cifar-10)
- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [ADAM](https://refivu.com/en/terms/0e9ad0199e08-adam)
- [softmax](https://refivu.com/en/terms/4a7673b6518d-softmax)
- [adversarial examples](https://refivu.com/en/terms/277fed423ea7-adversarial-examples)
- [Inception v3](https://refivu.com/en/terms/cdc0c667ddbc-inception-v3)
- [DeepFool](https://refivu.com/en/terms/60b20595f296-deepfool)
- [discretization](https://refivu.com/en/terms/afe058f09ebe-discretization)
- [defensive distillation](https://refivu.com/en/terms/b6e09e50ff14-defensive-distillation)
- [L-BFGS](https://refivu.com/en/terms/433a40c1d5e1-l-bfgs)
- [L2 distance](https://refivu.com/en/terms/40da6edb7870-l2-distance)
- [change of variables](https://refivu.com/en/terms/5fc77d6089e2-change-of-variables)
- [distillation temperature](https://refivu.com/en/terms/021b4ada2e6a-distillation-temperature)
- [JSMA](https://refivu.com/en/terms/966f0db5a084-jsma)
- [logits](https://refivu.com/en/terms/fd7ffdb00225-logits)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/6d9ac642-a922-416e-871a-f2ef8022e354-towards-evaluating-the-robustness-of-neural-networks)
