Hogwarts never kept a teacher for this class. Trustworthy machine learning and AI safety have the same problem.
Improve robustness, certify a radius, or screen an input or reply.
Every point should keep its label anywhere inside its \(\epsilon\)-box.
A min–max problem: the attacker maximises the loss, the model minimises it.
Fast Gradient Sign Method (FGSM): one gradient step makes the adversarial example.
Projected Gradient Descent (PGD): many small steps, each kept inside the \(\epsilon\)-box.
The same graph is used \(K\) times to update \(\delta\), then once to update \(\theta\).
Papernot et al. (2016): train a second model on the soft outputs of the first.
Near an image, a smaller input gradient can mean a smaller loss increase—but only locally.
A defence \(g\) sits before \(f\). In the tested cases, failed gradient attacks did not mean the models were safe.
† BPDA = Backward Pass Differentiable Approximation; EOT = Expectation over Transformation.
Ilyas et al. (2019): adversarial examples are not bugs. They exploit real but fragile patterns in the data.
Robustness can cost accuracy, time, and data. The comparisons below are illustrative.
Same min–max idea. Different losses, or cheaper ways to find the attack.
Train on the image found by the PGD search.
Fit the clean image, and keep the output stable inside the box. \(\beta\) sets the trade-off.
Like TRADES, but weight images more when the correct label has low probability.
Replay batches and share gradient work to reduce cost.
Random-start FGSM can be faster; test whether it matches PGD training here.
Mathematically proven robustness: a guarantee, not just a test.
If each pixel can only move by \(\epsilon=0.1\), how far can the score move?
Interval bound propagation (IBP): repeat the one-neuron rule, layer by layer.
IBP is fast and simple. That speed comes at a price.
Add noise to the image many times. If most noisy copies are called cat, the answer is cat.
The vote does not flip at once. It needs a large enough move.
Gaussian noise around the input: blue area = cat votes, red area = dog votes.
How we get the radius for one image.
Randomised smoothing gives a guarantee—but only within a certified radius.
Same pipeline, different transformations. The images and scores are illustrative.
All these methods follow the same idea: transform first, then classify.
Use anomaly and OOD detection methods to flag inputs that may be adversarial examples.
Use a separate detector to screen the request and the draft reply.
Learn safe, helpful behaviour from example replies and human preferences.
Next lectureDefences II: training-time attacks and the public good