A perturbation too small to see
- : the budget, often 8 out of 255 for images, which is invisible on a screen.
The constraint is what makes this an attack rather than a different input: the image still looks identical and the label still obviously applies.
Training minimises the loss with respect to the weights. An attack maximises the same loss with respect to the input, using the same gradient.
FGSM, one step
Take the gradient of the loss with respect to the pixels, keep only its sign, and move every pixel to the edge of the budget.
The sign is used rather than the gradient itself because the constraint is on the maximum change per pixel, so the largest allowed step is the corner of the box.
It takes one backward pass, it is the cheapest attack there is, and it succeeds on an undefended model most of the time.
PGD, which is the real benchmark
- : projection back into the allowed ball after each step.
- : the step size, smaller than .
Projected gradient descent takes many small steps instead of one large one, re-projecting each time, and it starts from a random point inside the ball.
It usually runs for 20 to 100 steps.
It is far stronger than FGSM, and a defence that only reports FGSM accuracy is reporting almost nothing.
One evaluation, in order
- Fix the threat model: the norm, the budget, and whether the attacker sees the weights.
- Run PGD with several random restarts, not a single one.
- Report accuracy under attack, not the attack's success rate on a subset.
- Check that the gradients are not simply unusable, which flatters a defence without adding robustness.
- Try a transfer attack from a substitute model, since a real attacker often has no access to the weights.
Why it happens at all
Networks are locally close to linear, and in a space of 150,000 dimensions a small change per pixel adds up to a large change in the logits.
That sum grows with dimension, which is why high resolution inputs are more vulnerable rather than less.
Adversarial examples also transfer between models trained on the same data, which means they exploit something about the data and the class of functions rather than a quirk of one network.
The only defence that has held
Adversarial training generates attacks during training and learns on them, which is a minimax problem solved by running PGD inside the training loop.
It costs several times the training compute, and it reduces clean accuracy by a few points, and after a decade of proposals it remains the only method that has not been broken.
Certified defences give a provable radius instead of an empirical one, and the radii they can prove are still far smaller than the perturbations attackers use.