Szegedy et al. pose it as an optimization. Given an image x and a target label, find the change r that minimizes c·|r| + loss(x + r, target), keeping every pixel of x + r between 0 and 1. A large c keeps r small but may not reach the target; so search for the smallest c that still works. Every step needs the gradient of the loss with respect to the input pixels, the backward pass carried to the input. Pick a digit and a target, and watch.
The search. The paper solves the inner problem with box-constrained L-BFGS; here it is projected gradient descent (step on the gradient, then clip every pixel back into [0, 1]), which needs the same input gradient and finds similar answers. |r| is the squared length of the change. The outer loop is the paper’s line search: start with some c, double it while the attack still succeeds, halve toward the last success when it fails, and keep the smallest successful change. The middle image shows r itself, red where pixels got brighter and blue where they got darker, rescaled so its largest change is fully saturated; the number under it is the paper’s measure of distortion, the root-mean-square change per pixel on a 0–1 scale. The paper’s Table 1 reports averages of 0.058 to 0.086 for its MNIST networks with hidden layers (more for heavily regularized softmax models); these small networks, trained on 12,000 digits instead of 60,000, land in about the same range.
One step. Goodfellow et al. 2015, a year later, asked what happens if you take a single step of size ε on every pixel, in the direction of the gradient’s sign. If the loss were linear in x, that would be the strongest change allowed when no pixel may move by more than ε: each pixel contributes ε·|gradient| to the change in loss, all with the same sign, so the effect adds up over the 784 pixels. It is cruder (every pixel moves, visibly so at large ε) but needs only one gradient, which is why it is the attack used to make adversarial training cheap.
Noise of the same size. The fourth image adds Gaussian noise with the same root-mean-square size as the adversarial change. It almost never changes the answer: what matters is not how big the change is but which way it points.
Tiny crafted vs. large random measures this over many digits.