Mahir Shahriar Tamim

AI Researcher · Explainable & Responsible AI · Vision, Language & Agentic Systems

Part 2 of Adversarial Attacks

Stronger attacks: from one step to many

Module 2 · 4 min read

Stronger attacks: from one step to many

TL;DR

  • PGD takes many small gradient steps from a random start, pulling back into the ε box each time. It beats FGSM on curved boundaries and is the minimum bar for testing.
  • DeepFool and C&W find the smallest fooling change. JSMA and the one-pixel attack change as few pixels as possible.
  • One universal pattern can fool a network on most images.

One big step is a guess

FGSM jumps to the edge of the budget using the gradient at the original image, which only works if the model is perfectly linear. Real networks are roughly linear with curved boundaries, so one big jump can overshoot or head somewhere that stops being good halfway. The fix is to take a small step, look again and repeat.

BIM and PGD

Alexey Kurakin, Goodfellow and Samy Bengio did this in Adversarial examples in the physical world. Their Basic Iterative Method (BIM), also called I-FGSM, takes many small FGSM steps and clips the image after each one so no pixel moves more than ε from the original. They also printed adversarial images, photographed them with a phone, and many still fooled the classifier.

A year later Aleksander Mądry and colleagues gave it its best-known form in Towards Deep Learning Models Resistant to Adversarial Attacks. Projected Gradient Descent (PGD) is BIM with a random start inside the allowed region. “Projected” is the clipping, so a step that leaves the box gets pulled back to the nearest point inside.

start:  x' = x + small random noise
repeat: x' = x' + α × sign(gradient)       # small step uphill
        x' = clip x' to [x − ε, x + ε]       # project back into the box

Mądry argued PGD is the strongest attack using only first-order (gradient) information, so a model that survives it will likely survive the others. That claim shaped the next five years, and PGD became the standard way to test and train robust models (module 4).

In this toy the dashed square is the ε budget around the blue point. The attacker wins if the point lands in the red region.

original classattacker’s goalFGSM step

At the default ε FGSM jumps to the corner its first gradient points at and lands just short; PGD follows the curve and crosses with the same budget. Raise ε and FGSM eventually works too.

DeepFool and C&W find the smallest change

FGSM and PGD ask whether a budget of ε is enough. Another family asks for the smallest change that fools the model. That tells you how close the boundary really is, and a real attacker only needs a change small enough to go unnoticed.

  • DeepFool (Moosavi-Dezfooli et al., 2016) pretends the model is linear around the current point, steps to the nearest boundary and repeats until the label changes. It usually finds much smaller changes than FGSM.
  • Carlini & Wagner (C&W, 2017) minimises the size of the change plus a term that rewards fooling the model, with tricks to keep pixels in the valid range. Slower, but very strong. Its best-known result broke a defence that claimed to stop almost every attack (module 4).

Changing as few pixels as possible

Attacks for the L0 ruler look for the few pixels that matter most.

  • JSMA (Papernot et al., 2016) builds a “saliency map” from the gradients (which pixels, if increased, most raise the target class and lower the others) and changes those one pair at a time.
  • The one-pixel attack (Su, Vargas & Sakurai) changes one pixel with no gradients, just an evolutionary search over position and colour. It fooled networks on roughly two thirds of small 32×32 CIFAR-10 test images and roughly one in six larger ImageNet photos, which I still find a bit wild.

One pattern for every image

Everything above computes a new change per image. Moosavi-Dezfooli et al. (2017) found one image-independent pattern (a universal perturbation) that fools a network on most natural images and even transfers between architectures. In principle an attacker could apply that one file to anything.

The attacks side by side

AttackYearRulerIdea in one line
L-BFGS (Szegedy)2014L2Optimise for the smallest change; slow
FGSM2015L∞One gradient-sign step
BIM / PGD2016 / 2017L∞ (also L2)Many small steps, projected back into the budget
DeepFool2016L2Repeatedly step to the nearest linearised boundary
C&W2017L2, L∞, L0Careful optimisation; very strong
JSMA2016L0Change the most influential pixels
One-pixel2017L0Evolutionary search over a single pixel
Universal2017L∞ / L2One pattern that fools most images

Why defenders care about the strongest attack. A defence is only as good as the best attack tried on it. Testing with FGSM alone is like testing a lock by pushing the door once. PGD (and later AutoAttack, module 4) became the minimum standard.

Quick check

PGD and FGSM have the same budget ε. Why can PGD succeed when FGSM fails?

Q&A

Why does PGD start from a random point?

Starting exactly at the original image can leave the attack stuck in a bad spot, e.g. where the gradient is nearly zero. A random start, often with several restarts, makes it much more likely that one run succeeds.

Targeted or untargeted, which is harder?

Targeted. Untargeted needs any wrong class, usually the nearest one. Targeted has to reach one particular class, which may be much further away.

Papers