Fundamentals of Security and Robustness for AI
M2 · P2 (announced) · Year 2 · Period 2
Contents
- Introduction and overview
- 0. Recap: the foundation and the vocabulary
- 1. Threat model and taxonomy of attacks
- 2. Adversarial examples: the phenomenon and its distances
- 3. Optimization-based attacks: FGSM, PGD, CW, AutoAttack
- 4. Defenses: adversarial training
- 5. Certification: randomized smoothing and formal verification
- 6. Trojans and backdoors
- 7. Data poisoning
- 8. Model stealing and membership inference
- 9. Beyond images: LLMs and graphs
- 10. Evaluating and deploying
- Exercises / Labs
- Projects and assessment
- References
Introduction and overview
| Module | Fundamentals of Security and Robustness for AI |
| Code | M2 · P2 (announced) — official code not published (course description not published) |
| Team and workload | Instructor: master’s team · ~24 h · the mathematical foundation of learning security: threat model, adversarial examples (FGSM/PGD proven), adversarial training and its cost, certification (randomized smoothing), trojans, poisoning, extraction and membership inference, up to evaluation protocols (RobustBench) and defensive deployment. |
| Status in the program | M2Both routes · preselected by both routes of the home page (Graph × LLM and AI systems) · M2 program being finalized |
Audience: an engineer shipping a model who must anticipate attacks on it. Empirical first: the module starts from concrete failures — a classifier whose clean accuracy of 94% falls to 11% under a PGD attack with budget \varepsilon_{\mathrm{atk}} = 8/255, an ad-hoc defense that collapses under an adaptive attack — and only then names the concepts (threat model, adversarial training, certification).
It covers the defensive foundations of machine-learning security: adversarial examples, poisoning, extraction and membership inference, and standardized evaluation (RobustBench).
What you will be able to do
- Write the threat model of a system: what the adversary knows, can modify, and seeks to obtain;
- Build adversarial examples by optimization (FGSM, PGD, CW) and understand what AutoAttack guarantees;
- Measure the adversarial phenomenon with the right distances and separate the problem from plain classification errors;
- Train a robust model (adversarial training) and quantify its extra cost in compute and accuracy;
- Certify robustness by randomized smoothing or formal verification, and state what the certificate covers;
- Detect and analyze trojans, backdoors and data poisoning;
- Situate intellectual-property attacks: model stealing, membership inference;
- Transpose the approach to LLMs and graphs, and read a robustness benchmark (RobustBench) with a critical eye.
Official objectives and syllabus
Official course description not published (S3/S4 catalog empty): as of the start of the 2026 academic year, the “LLGA 2 – Semestre 3” and “LLGA 2 – Semestre 4” tracks of the 2026-2027 SynapseS catalog still list no courses, and the master’s wiki indicates that the detailed M2 program is “under development” (period 2: “to be completed soon”).
The program below therefore reflects the master’s brochure (period 2), with an indicative volume of ~24 h; these course materials are calibrated to that volume, i.e. about two hours of work per chapter, labs included. The following table maps each brochure theme to the course sections; the materials’ own additions are marked “going beyond the syllabus”.
| Brochure theme | Course section covering it |
|---|---|
| Threat model and taxonomy of attacks | ch. 1 (adversary’s knowledge, attack goals) |
| Adversarial examples: the phenomenon | ch. 2 (distances, separation from plain errors) |
| Proven optimization-based attacks (FGSM, PGD) | ch. 3 (FGSM, PGD, CW, up to AutoAttack) |
| Adversarial training and its cost | ch. 4 (minimax formulation, extra cost in compute and accuracy) |
| Certification (randomized smoothing) | ch. 5 (randomized smoothing and formal verification) |
| Trojans and backdoors | ch. 6 |
| Data poisoning | ch. 7 |
| Extraction and membership inference | ch. 8 |
| Evaluation protocols (RobustBench) and defensive deployment | ch. 10 |
| Going beyond the syllabus — carrying the foundation over to LLMs and graphs | ch. 9 (adversarial prompts, structure attacks) |
| Going beyond the syllabus — recap: attacker, surface, guarantee | ch. 0 |
| Going beyond the syllabus — labs (FGSM/PGD, adversarial training, graph attack) | Exercises / Labs (graph attack: Exercise 10) |
Where this course fits in the program
An M2 module offered in period 2 and preselected by both routes of the home page: it is the “security” foundation on which the specialized modules at the end of the master open.
Prerequisites:
- Deep Learning or its P2 variant (gradient training, convolutions — the optimization attacks are grafted onto it);
- Graph ML ch. 5 (message passing and the GCN layer of Derivation 5.2), the model attacked in ch. 9;
- Large Language Models 9.4 (jailbreaks, prompt injections), recalled in the primer that opens ch. 9.
Useful if taken: Advanced Graph Neural Networks ch. 7, which develops Nettack and the graph defenses; the federated learning part of Emerging ML, where Byzantine clients prepare the poisoning question and differential privacy is first met (ch. 5). Differential privacy is recalled in one page in ch. 5 (Definition 5.4), with the proofs in Privacy and Uncertainty ch. 1–4.
Co-requisite and downstream modules: Explainability, Security, Privacy of LLMs runs in the same period and is an optional co-requisite, not a prerequisite: it takes up this taxonomy on LLMs (jailbreaks, injections, defenses in depth, ch. 5–6), and neither module requires the other. The threat-model reflexes also serve the operational guardrails of the ML Ops and LLM Engineering Principles module, and the trust work package of the end-of-year project Y2.5.
Course outline
- Recap: the foundation and the vocabulary — attacker, surface, guarantee: the lexicon without which nothing can be discussed.
- Threat model and taxonomy of attacks — classify attacks by knowledge (white/black/gray box) and by goal.
- Adversarial examples: the phenomenon and its distances — the experimental phenomenon, and why the choice of distance changes everything.
- Optimization-based attacks: FGSM, PGD, CW, AutoAttack — the derived and proven attacks, up to standardized evaluation.
- Defenses: adversarial training — the reference defense, its minimax formulation and its real cost.
- Certification: randomized smoothing and formal verification — going from “it resists tests” to “it is proven”, and under what conditions.
- Trojans and backdoors — models that behave well until the attacker’s chosen trigger.
- Data poisoning — corrupting learning upstream, when only the data is touched.
- Model stealing and membership inference — the intellectual-property and confidentiality attacks, a bridge to the LLM privacy module.
- Beyond images: LLMs and graphs — adversarial prompts, structure attacks: the foundation transported to the master’s objects.
- Evaluating and deploying — rigorous protocols (RobustBench) and defensive deployment decisions.
- Exercises / Labs — implement FGSM/PGD, adversarial training and a graph attack (Nettack-style, Exercise 10).
- Projects and assessment — solo and group project subjects, a written-exam proposal and a grading rubric.
- References — the founding papers of each family of attacks and defenses.
Session plan
24 h in class (announced) = 8 sessions of 3 h. The SynapseS 2026–2027 sheet publishes no volume for this module; 24 h is the indicative volume quoted with the brochure programme in the fiche above, and also the M2 volume published for the Large Language Models course (CSC_53432_EP: 24 h, 2 ECTS); the session split below is our proposal for covering these notes in that time. Level 1 = foundations (reviews, definitions, first worked examples), 2 = core methods and their main theorems; the level never goes down from one session to the next.
| Session | Hours | Level | Content | Practice |
|---|---|---|---|---|
| 1 | 3 h | 1 | ch. 0 Recap: robustness, security, safety; ch. 1 Threat model and taxonomy of attacks | write the threat model of a fraud detector (Definition 1.1) |
| 2 | 3 h | 1 | ch. 2 Adversarial examples: the phenomenon, the three balls, the linear hypothesis | Ex. 1 (training the CNN, FGSM) |
| 3 | 3 h | 2 | ch. 3 Optimization-based attacks: FGSM, PGD, CW, AutoAttack | Ex. 1 (PGD, transfer) |
| 4 | 3 h | 2 | ch. 4 Adversarial training, the linear min-max, robust overfitting | Ex. 2 |
| 5 | 3 h | 2 | ch. 5 Certification: randomized smoothing and formal verification; the one-page DP recall (Definition 5.4) | Ex. 5 |
| 6 | 3 h | 2 | ch. 6 Trojans and backdoors; ch. 7 Data poisoning | Ex. 6, 7 |
| 7 | 3 h | 2 | ch. 8 Model stealing and membership inference | Ex. 3, 8 |
| 8 | 3 h | 2 | ch. 9 Beyond images: LLMs and graphs (LLM-attack recall, Nettack and its lab skeleton); ch. 10 Evaluating and deploying | Ex. 4, 9, 10 |
Self-study, outside the 24 h: no chapter — every chapter is covered in class; the labs (Ex. 1–8) each need about 2 h of personal work after their session, the final synthesis (Ex. 9) about 4 h and the graph attack lab (Ex. 10) about 3 h.
How to study this module
- Attack before defending: implement PGD from the very first week — one understands a defense only after failing to break it.
- For each attack, write formally what the adversary optimizes, under which constraints, with what knowledge: this is the central discipline of the module.
- Beware of “miracle defenses”: train yourself to identify why a defense not evaluated against an adaptive attack proves nothing.
- Redo the numbers of the cost of robustness (accuracy, training time) on a small model: the trade-off is better seen than read.
- Reread Graph ML ch. 5 (the GCN layer) and LLM 9.4 at the start of the module, plus Advanced GNN ch. 7 and the Byzantine part of Emerging ML if you took them: the graphs, LLM and poisoning chapters build on them.
The LLGA perspective Robustness is a crossroads of the master: adversarial examples are born on images, and carry over to graphs (structure attacked around a node) and to LLMs (hostile prompts) — the three families of models of the LLGA. Completed by differential privacy and by the dedicated LLM module, this foundation makes you able to audit a learning system, a skill that European regulation now expects from industry as much as from research laboratories.
0. Recap: the foundation and the vocabulary
One cannot discuss attacks on a model without agreeing on what the model is, what “robust” means and who the adversary is. This chapter recalls the prerequisites from the M1 modules and separates three properties that are often confused.
Prerequisites (M1/M2 modules)
- Networks and optimization (cf. Deep Learning module): stochastic gradient descent, backpropagation, softmax and the cross-entropy loss \ell(f(x), y) = -\log p_f(y \mid x) , convolutions — the playing field for all the attacks of ch. 2-5;
- Generalization (cf. Machine Learning module ch. 8): empirical risk vs true risk, overfitting — the vocabulary to understand why robustness generalizes poorly (ch. 4);
- Statistics (Refresher Statistics): hypothesis testing, type I/II errors, the Neyman-Pearson lemma — the hidden tool behind randomized smoothing (ch. 5) and membership inference (ch. 8);
- Differential privacy: the (\varepsilon, \delta) definition, Gaussian mechanism, group privacy and DP-SGD are recalled in one page in ch. 5 (Definition 5.4), so no DP course is required; the proofs are in Privacy and Uncertainty ch. 1–4, and Graph × LLM students first met them in Emerging ML ch. 5;
- Byzantine robustness and federated learning (cf. Emerging ML module ch. 4, if taken): malicious clients, robust aggregation — ch. 7 is its “centralized data” counterpart;
- Graph neural networks (Graph ML ch. 5, mandatory): message passing and the GCN layer of Derivation 5.2 — the model attacked in ch. 9 and in Exercise 10;
- LLM attacks (Large Language Models 9.4, mandatory, Year 2 P1): jailbreaks, direct and indirect injections — recalled in the primer that opens ch. 9. The Explainability, Security and Privacy of LLMs module, in the same period, is an optional co-requisite that develops them, not a prerequisite.
Notation. This page follows the site-wide notation conventions. The attack budget, the radius of the threat ball, is written \varepsilon_{\mathrm{atk}} (ch. 2–4, 9–10); \sigma is the standard deviation of the smoothing noise \xi (ch. 5); a bare \varepsilon is always a privacy budget of differential privacy (Definition 5.4, ch. 7–8). \delta is the input perturbation in ch. 2–5 and the failure probability of DP in Definition 5.4.
Definition 0.1 — Robustness, security, safety Three properties that are often confused:
- robustness is a mathematical property of the model (bounding the variation of the output under a constraint on the input);
- security is a property of the system faced with an intentional attacker (it requires a threat model);
- safety covers even unintentional harm (bias, in-distribution errors).
This module covers the first two; the third crosses over with the ethics seminar Ethical Issues and Novel Applications of AI and with Explainability, Security, Privacy of LLMs. A model can be robust and not safe, and vice versa.
Module method Each chapter follows the same grid:
- formalize the attack as an optimization problem;
- prove what is provable (FGSM in ch. 3, the hidden regularization of adversarial training in ch. 4, the certified radius in ch. 5);
- give the standard defense and the way it breaks — a defense not evaluated by adaptive attack is not a defense.
Labs on MNIST/CIFAR (FGSM, PGD, adversarial training), a graph attack on Cora (Exercise 10), then full audits.
1. Threat model and taxonomy of attacks
A fraud detector resists a one-step attack (FGSM) in the validation report, then falls to an iterated attack (PGD) after deployment. This chapter shows that such surprises come from an implicit threat model, and sets out the explicit one that every later chapter uses.
What breaks Three mistakes recur: evaluating a model only against weak attacks, relying on defenses that merely hide the gradient or the weights (security through obscurity), and forgetting the attacks that do not touch the input at all (poisoning, model extraction).
Definition 1.1 — Threat model Every security analysis starts with three explicit assumptions:
- the attacker’s capabilities — white-box (architecture and weights known), gray-box (architecture known, weights not), black-box (access only to the predictions, possibly limited in queries or without scores);
- the timing of the attack — at training time (poisoning, backdoor) or at inference time (evasion, extraction, membership inference);
- the goal — untargeted error, targeted error (one specific class), information leakage, theft of intellectual property, denial of service.
Changing one assumption changes the whole analysis: most misunderstandings in the field come from different implicit threat models.
| Attack | Timing | Access required | Goal | Chapter |
|---|---|---|---|---|
| Evasion (adversarial example) | inference | white → black (transfer) | error, targeted or not | 2-3 |
| Poisoning | training | write access to the data | degrade / bias | 7 |
| Backdoor (trojan) | training | data + trigger | hidden rule triggered | 6 |
| Extraction (model stealing) | inference | black, score API | copy the model | 8 |
| Membership inference | inference | black, score API | “was this individual in the training set?” | 8 |
Reference framework This taxonomy (evasion / poisoning / extraction / inference) is the one from the survey by Biggio & Roli (Wild Patterns: Ten Years After the Rise of Adversarial Machine Learning, 2018), which also structures the evaluation frameworks (ch. 10). The important conceptual point: unlike classical software security (hunting for bugs), here the attack surface is the prediction function itself — every non-trivial classifier has decision boundaries, and boundaries have two sides.
2. Adversarial examples: the phenomenon and its distances
A network with 99% test accuracy can be made to misclassify almost any image by a change invisible to the eye. This chapter defines these adversarial examples, the distances in which “invisible” is measured, and the simple linear reason why they exist.
Definition 2.1 — Adversarial example (Szegedy et al., 2014) For a classifier f : \mathcal{X} \to \{1, \dots, K\}, an adversarial example of x (of class y) is an \tilde{x} = x + \delta such that f(\tilde{x}) \neq f(x) = y (or a target class t chosen by the attacker: f(\tilde{x}) = t) while \|\delta\| is “small” in the sense of a distance to be fixed.
Szegedy et al. showed that these points exist at surprising density around every test point, for networks with very high accuracy — they are not isolated misclassified points, but imperceptible perturbations of correctly classified points.
Definition 2.2 — The three useful balls \|\delta\|_0 = |\{j : \delta_j \neq 0\}| \quad (\text{modified pixels}), \qquad \|\delta\|_2 = \Big(\sum_j \delta_j^2\Big)^{1/2} \quad (\text{energy}), \qquad \|\delta\|_\infty = \max_j |\delta_j| \quad (\text{max amplitude}). The associated balls B_p(x, \varepsilon_{\mathrm{atk}}) define the attacker’s budget. Standard protocols: \varepsilon_{\mathrm{atk}} = 0.3 in L_\infty on MNIST (pixels in [0,1]), \varepsilon_{\mathrm{atk}} = 8/255 on CIFAR-10 (ch. 10).
Each norm models a different threat: sporadically altered sensors (L_0), physical noise (L_2), brightness/contrast (L_\infty).
Proposition 2.3 — The linear hypothesis (Goodfellow et al., 2015) Even a linear classifier admits adversarial examples in high dimension. For f(x) = w^\top x + b (the score of one class), and \|\delta\|_\infty \leq \varepsilon_{\mathrm{atk}}: |f(x + \delta) - f(x)| = |w^\top \delta| \leq \varepsilon_{\mathrm{atk}}\, \|w\|_1. In dimension d with typical weights |w_j| \approx m, the shift reaches \varepsilon_{\mathrm{atk}}\, m\, d: each coordinate only “moves” by \varepsilon_{\mathrm{atk}}, but the d contributions add up.
With d \sim 10^5 pixels, a relative perturbation of 1\% per coordinate suffices to change the score by several logistic units.
Proof. Upper bound: Hölder’s inequality |w^\top \delta| \leq \|w\|_1 \|\delta\|_\infty, attained for \delta = \varepsilon_{\mathrm{atk}}\, \mathrm{sign}(w) . The order of magnitude follows by taking \|w\|_1 \approx m d. ∎
Transfer and the physical world Two properties make the threat practical:
- transfer — an adversarial example computed on one (substitute) model often fools another model, including one with a different architecture: the black-box attack reduces to the white-box case;
- the physical world — Kurakin et al. (2017) printed adversarial images: the perturbation survives printing, photography and change of viewpoint.
Adversarial examples on tabular data also exist (transaction amounts adjusted below the thresholds of detection rules); note that on GBDTs, since the function is piecewise constant, gradient-based attacks do not apply directly — one then attacks by discrete search or via a differentiable substitute.
3. Optimization-based attacks: FGSM, PGD, CW, AutoAttack
Chapter 2 showed that adversarial examples exist; an attacker, or an evaluator, must actually find them. This chapter writes the search as an optimization problem and derives the standard attacks, from the one-step FGSM to the AutoAttack ensemble.
Definition 3.1 — The evasion problem Untargeted attack with budget \varepsilon_{\mathrm{atk}} (norm p): \max_{\delta}\ \ell(f_\theta(x + \delta),\, y) \quad \text{subject to}\quad \|\delta\|_p \leq \varepsilon_{\mathrm{atk}},\ x + \delta \in [0,1]^d, where \ell is the cross-entropy.
Targeted version: maximize \ell(f(x+\delta), y) - \ell(f(x+\delta), t) (push the target class t up and the true one down). The whole difficulty is the non-concave inner max — it cannot be evaluated exactly, only lower-bounded (attacks) or overestimated.
Theorem 3.2 — FGSM = linearization of the problem (Goodfellow et al., 2015) To first order in \delta, \ell(x + \delta) \approx \ell(x) + \nabla_x \ell(x)^\top \delta . The maximum of this linear approximation over the L_\infty ball is attained at
Key result — FGSM \delta^\star = \varepsilon_{\mathrm{atk}}\, \mathrm{sign}\big(\nabla_x \ell(x)\big) \qquad (\text{Fast Gradient Sign Method}),
with increase \varepsilon_{\mathrm{atk}}\, \|\nabla_x \ell(x)\|_1. Over the L_2 ball: \delta^\star = \varepsilon_{\mathrm{atk}}\, \nabla_x \ell(x) / \|\nabla_x \ell(x)\|_2 \qquad (\text{FGM}).
Proof. Hölder: for every \delta with \|\delta\|_\infty \leq \varepsilon_{\mathrm{atk}}, g^\top \delta \leq \sum_j |g_j|\,|\delta_j| \leq \varepsilon_{\mathrm{atk}} \sum_j |g_j| = \varepsilon_{\mathrm{atk}} \|g\|_1, with g = \nabla_x \ell(x). There is equality iff |\delta_j| = \varepsilon_{\mathrm{atk}} and \mathrm{sign}(\delta_j) = \mathrm{sign}(g_j) for every nonzero j — which is exactly \delta^\star.
For L_2: Cauchy-Schwarz g^\top\delta \leq \|g\|_2\|\delta\|_2 \leq \varepsilon_{\mathrm{atk}}\|g\|_2, equality iff \delta is collinear with g. ∎
Definition 3.3 — PGD (Madry et al., 2018) The linearization is only valid locally; one iterates while re-projecting onto the ball and onto [0,1]^d. For L_\infty the projection is a coordinate-wise clamp: each \delta_j is clipped to the interval of radius \varepsilon_{\mathrm{atk}} around 0, then x + \delta is clipped to [0,1]^d: \delta^{(k+1)} = \Pi_{B_\infty(\varepsilon_{\mathrm{atk}})}\Big(\delta^{(k)} + \alpha\, \mathrm{sign}\big(\nabla_x \ell(x + \delta^{(k)})\big)\Big), \qquad \delta^{(0)} \in \{\,0,\ \text{or uniform in } B_\infty(\varepsilon_{\mathrm{atk}})\,\}, with step size \alpha \approx 2.5\,\varepsilon_{\mathrm{atk}}/K for K iterations, and multiple restarts (the inner objective is non-concave: several starting points are sampled).
PGD is the qualitative standard: “robust to PGD” has become a (too convenient) synonym for robust.
Definition 3.4 — CW (Carlini & Wagner, 2017) Attack optimized on the logit margin Z(x), with the change of variable \delta = \tfrac{1}{2}(\tanh(w) + 1) - x to get rid of the box constraints: \min_{w}\ \Big\| \tfrac{1}{2}(\tanh(w)+1) - x \Big\|_2^2 + c \cdot \max\big(Z(x+\delta)_y - \max_{t \neq y} Z(x+\delta)_t,\ -\kappa\big), with a bisection search over c and confidence \kappa \geq 0. CW-L2 long remained the most effective attack — and the tool that demolished the first generation of defenses (ch. 4).
Black box and standard evaluation Without gradients:
- transfer (ch. 2);
- score-based attacks (gradient estimation by queries, random square attacks);
- decision-based attacks (random walk on the boundary).
For evaluation, one no longer uses a single isolated attack but AutoAttack (Croce & Hein, 2020): a parameter-free ensemble — APGD-CE, APGD-T, FAB-T, Square — which cuts the displayed “robustness” of several defended models by more than 10 points. Rule of the module: any robustness measure is worth exactly the worst attack that has been tried.
# FGSM and PGD in about ten lines (PyTorch)
def fgsm(model, x, y, eps):
x.requires_grad_(True)
loss = F.cross_entropy(model(x), y)
loss.backward()
return (x + eps * x.grad.sign()).clamp(0, 1).detach()
def pgd(model, x, y, eps, alpha, iters, restarts=1):
worst, worst_loss = None, float("-inf")
for _ in range(restarts):
d = torch.zeros_like(x).uniform_(-eps, eps) # random start
for _ in range(iters):
d.requires_grad_(True)
loss = F.cross_entropy(model((x + d).clamp(0, 1)), y)
g = torch.autograd.grad(loss, d)[0] # gradient of the inner max
with torch.no_grad():
d = (d + alpha * g.sign()).clamp(-eps, eps)
x_adv = (x + d).clamp(0, 1).detach()
l = F.cross_entropy(model(x_adv), y).item() # candidate loss
if l > worst_loss: # keep the worst case
worst, worst_loss = x_adv, l
return worst4. Defenses: adversarial training
If attacks are optimization problems, the natural defense is to train the model on the worst perturbations it may face. This chapter formulates that defense as a min-max problem, proves what it does on a linear model, and lists the ways it fails.
Definition 4.1 — Adversarial training (Madry et al., 2018) One minimizes the robust risk, a min-max problem:
Key result — the robust risk \min_{\theta}\ \mathbb{E}_{(x,y)}\Big[\ \max_{\|\delta\|_\infty \leq \varepsilon_{\mathrm{atk}}} \ell\big(f_\theta(x + \delta),\, y\big)\ \Big],
the inner max being approximated by PGD (def. 3.3): at each descent step, each example is replaced by its current adversarial version.
This is a form of stochastic minimax; in practice: training cost multiplied by the number of PGD iterations (typically 7-10).
# full lab: PGD-AT on MNIST (the min-max, line by line)
import torch, torch.nn as nn, torch.nn.functional as F
model = nn.Sequential( # small CNN
nn.Conv2d(1, 32, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
nn.Conv2d(32, 64, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
nn.Flatten(), nn.Linear(64 * 7 * 7, 128), nn.ReLU(), nn.Linear(128, 10))
def pgd(model, x, y, eps, steps, alpha): # the inner MAX (def. 3.3)
d = torch.zeros_like(x).uniform_(-eps, eps) # random start
for _ in range(steps):
d.requires_grad_(True)
loss = F.cross_entropy(model((x + d).clamp(0, 1)), y)
g = torch.autograd.grad(loss, d)[0].sign()
with torch.no_grad():
d = (d + alpha * g).clamp(-eps, eps)
return (x + d).clamp(0, 1).detach()
opt = torch.optim.Adam(model.parameters(), lr=1e-3)
eps, steps, alpha = 0.3, 7, 0.3 * 2.5 / 7 # cheap 7 steps, rule 2.5·eps/K (Madry et al.:
# 40 steps of 0.01 on MNIST, 7 of 2/255 on CIFAR-10)
for epoch in range(10):
for x, y in train_loader:
x_adv = pgd(model, x, y, eps, steps, alpha) # approximate the max...
loss = F.cross_entropy(model(x_adv), y) # ...then minimize (outer MIN)
opt.zero_grad(); loss.backward(); opt.step()
def accuracy(model, x, y, attack=None): # honest evaluation
xb = x if attack is None else attack(model, x, y)
return (model(xb).argmax(1) == y).float().mean().item()
# mandatory final report: BOTH numbers (def. 10.1)
print("standard:", accuracy(model, x_test, y_test))
print("robust :", accuracy(model, x_test, y_test,
lambda m, x, y: pgd(m, x, y, eps, 50, 0.01))) # strong PGD in evaluationTheorem 4.2 — The min-max, proven on a linear case For a linear classifier f(x) = w^\top x + b and the hinge loss \ell(y\, f(x)) = \max(0,\ 1 - y\, f(x)) (labels y \in \{\pm1\}), the L_\infty robust risk reads \max_{\|\delta\|_\infty \leq \varepsilon_{\mathrm{atk}}}\ \max\big(0,\ 1 - y\,(w^\top(x+\delta) + b)\big) \;=\; \max\big(0,\ 1 - y\,(w^\top x + b) + \varepsilon_{\mathrm{atk}} \|w\|_1\big). Adversarial training of a linear model with the hinge loss is therefore an SVM whose required margin is inflated by \varepsilon_{\mathrm{atk}} \|w\|_1. For every example inside the original margin, y f(x) \leq 1, the robust loss equals the hinge loss plus \varepsilon_{\mathrm{atk}}\|w\|_1; between the two margins the hinge loss is 0 while the robust loss is positive but smaller than \varepsilon_{\mathrm{atk}}\|w\|_1; beyond the inflated margin both vanish.
Robustness acts as an L_1 penalty on the weights — the L_1 norm being the dual of the L_\infty norm that bounds the attack.
Proof. The max of 1 - y\,(w^\top x + b) - y\, w^\top \delta over the ball is attained (Hölder, cf. proof of thm. 3.2) at \delta^\star = -\varepsilon_{\mathrm{atk}}\, y\, \mathrm{sign}(w) , and equals 1 - y(w^\top x + b) + \varepsilon_{\mathrm{atk}} \|w\|_1 . If this quantity is negative, the robust hinge loss equals 0 — hence the global \max(0, \cdot): the outer and inner max commute because t \mapsto \max(0, t) is nondecreasing.
Summing over the examples gives \sum_i \max(0, 1 - y_i f(x_i) + \varepsilon_{\mathrm{atk}}\|w\|_1) \leq \sum_i \max(0, 1 - y_i f(x_i)) + n\,\varepsilon_{\mathrm{atk}}\|w\|_1 , with equality as soon as every example satisfies 1 - y_i f(x_i) + \varepsilon_{\mathrm{atk}}\|w\|_1 \geq 0 and 1 - y_i f(x_i) \geq 0: the term \varepsilon_{\mathrm{atk}} \|w\|_1, the same for every i, then acts exactly as an L_1 penalty. ∎
Numerical check. Take d = 2, w = (2, -1), b = 0, a point x = (0.5, 0.2) with y = +1 and \varepsilon_{\mathrm{atk}} = 0.1.
- The clean margin is y f(x) = 1 - 0.2 = 0.8, so the clean hinge loss is 0.2.
- The worst perturbation is \delta^\star = -0.1 \cdot \mathrm{sign}(w) = (-0.1, 0.1), which lowers the score by \varepsilon_{\mathrm{atk}}\|w\|_1 = 0.3.
- The robust margin is 0.5 and the robust hinge loss 0.5 = 0.2 + 0.3 .
A model with weights twice smaller but the same signs would pay only 0.15 for the same attack — which is why adversarial training pushes toward small \|w\|_1.
What Theorem 4.2 teaches
- robustness has a statistical price: penalizing w reduces the effective margin, hence the standard accuracy — the robustness/accuracy trade-off is not a bug;
- the scale of w is the real lever: hence in practice bounded weights, input normalization, shared weights (cf. Deep Learning modules, regularization chapter).
Schmidt et al. (2019) formalize point 1: robust generalization requires more data than standard generalization.
Decomposition of the robust error (TRADES, Zhang et al., 2019) For every classifier, the robust error (worst case within the balls) decomposes as \mathcal{R}_{rob} \;\leq\; \mathcal{R}_{nat} \;+\; \mathcal{R}_{bdy}, natural error + “boundary error” (points correctly classified but within \varepsilon_{\mathrm{atk}} of a decision boundary). TRADES explicitly optimizes the second term via a KL term between f(x) and f(x+\delta) — and dominates pure PGD-AT on several benchmarks. “Naive” adversarial training maximizes the margin; TRADES shows that one must also smooth the model.
Definition 4.3 — Robust overfitting (Rice et al., 2020) A specific phenomenon: during adversarial training, test robustness peaks abruptly (often within the first few dozen epochs) then decreases while train robustness keeps rising — a robust overfitting, mitigated (not solved) by early stopping and massive data augmentation (Rebuffi et al., 2021). Counter-intuitive but systematically reproduced: it is one of the most solid experimental facts in the field.
How not to defend The 2017-2019 decade produced hundreds of “masked-gradient” defenses (shrinkage, discretization, derandomization…) broken as soon as they were attacked adaptively. Athalye et al. (2018) (“Obfuscated gradients give a false sense of security”) break several of them with a backward-pass attack (backward-pass differentiable approximation) and reparameterization; Tramèr et al. (2020) codify the answer: every defense must be evaluated by an attack that knows it. Exercise 4 enforces this protocol.
For networks already deployed without retraining: detection (filters, distribution detection), rejection/abstention, preprocessing (quantization, JPEG compression, total-variation denoising — Guo et al., 2018); useful against transferred attacks, these “palliative” defenses are systematically bypassed by an attack that knows the filter — always test against an adapted attack.
5. Certification: randomized smoothing and formal verification
Chapters 3-4 bound robustness from below (attacks) — no guarantee about what has not been found. Certification bounds it from above: a radius within which no perturbation of a given budget can change the prediction.
Definition 5.1 — Randomized smoothing (Cohen, Rosenfeld & Kolter, 2019) Let f be a base classifier and \xi \sim \mathcal{N}(0, \sigma^2 I). The smoothed classifier is g(x) = \arg\max_{c}\ \mathbb{P}\big(f(x + \xi) = c\big), the most likely class when the input is perturbed with Gaussian noise.
g inherits a tight L_2 guarantee (see thm. 5.2), computable for any black-box f — it is the only certification method that has scaled (ImageNet).
Theorem 5.2 — Certified radius (Cohen et al., 2019) Let c_A = g(x), p_A = \mathbb{P}(f(x + \xi) = c_A) and p_B = \max_{c \neq c_A} \mathbb{P}(f(x + \xi) = c) . If one knows bounds \underline{p_A} \leq p_A and p_B \leq \overline{p_B} with \underline{p_A} > \overline{p_B}, then g predicts c_A over the entire L_2 ball of radius
Key result — certified radius R = \frac{\sigma}{2}\Big(\Phi^{-1}(\underline{p_A}) - \Phi^{-1}(\overline{p_B})\Big),
where \Phi^{-1} is the inverse of the standard Gaussian cumulative distribution function.
Proof. (Sketch — the full version is in the paper.)
Key lemma (Neyman-Pearson for two Gaussians with the same covariance): for every set S and every shift \delta, if \mathbb{P}(x + \xi \in S) = p, then \Phi\big(\Phi^{-1}(p) - \|\delta\|_2/\sigma\big) \;\leq\; \mathbb{P}(x + \delta + \xi \in S) \;\leq\; \Phi\big(\Phi^{-1}(p) + \|\delta\|_2/\sigma\big).
Why. Among all sets of probability p under \mathcal{N}(x, \sigma^2 I), the one whose probability under \mathcal{N}(x + \delta, \sigma^2 I) is the smallest is, by the Neyman-Pearson lemma, a set where the likelihood ratio of the second law to the first is below a threshold. This log-ratio, \big(\delta^\top (z - x) - \tfrac12\|\delta\|_2^2\big)/\sigma^2, is affine in z, so the extremal set is a half-space \{z : \delta^\top (z - x) \leq \beta\}.
On a half-space everything reduces to the one-dimensional variable u = \delta^\top \xi / \|\delta\|_2 \sim \mathcal{N}(0, \sigma^2): the half-space has probability p at x when \beta = \sigma\|\delta\|_2\,\Phi^{-1}(p), and after the shift its probability becomes \mathbb{P}(u \leq \beta/\|\delta\|_2 - \|\delta\|_2) = \Phi\big(\Phi^{-1}(p) - \|\delta\|_2/\sigma\big). The upper bound is obtained in the same way with the opposite half-space.
Application. Apply the lower bound to S_A = \{z : f(z) = c_A\} and the upper bound to S_c = \{z : f(z) = c\} for any c \neq c_A. Both bounds are monotone in p, so they hold with \underline{p_A} and \overline{p_B}.
At the point x + \delta, \mathbb{P}\big(f(x + \delta + \xi) = c_A\big) \geq \Phi\big(\Phi^{-1}(\underline{p_A}) - \|\delta\|_2/\sigma\big), \qquad \mathbb{P}\big(f(x + \delta + \xi) = c\big) \leq \Phi\big(\Phi^{-1}(\overline{p_B}) + \|\delta\|_2/\sigma\big). Class c_A remains the most likely as long as \Phi^{-1}(\underline{p_A}) - \|\delta\|_2/\sigma > \Phi^{-1}(\overline{p_B}) + \|\delta\|_2/\sigma, that is \|\delta\|_2 < \frac{\sigma}{2}\big(\Phi^{-1}(\underline{p_A}) - \Phi^{-1}(\overline{p_B})\big) = R. The factor \tfrac12 appears because the same shift lowers the probability of c_A and raises that of its best competitor at the same time. ∎
Example 5.3 — Certification in practice p_A, p_B are unknown: they are estimated by Monte Carlo — n_0 draws to choose g(x), n draws to build a binomial confidence interval (exact: Clopper-Pearson) on p_A; \overline{p_B} is taken as one minus that bound.
The procedure is sound with probability 1 - \alpha — the final guarantee combines sampling randomness and a deterministic theorem.
With \overline{p_B} = 1 - \underline{p_A}, the radius simplifies to R = \sigma\,\Phi^{-1}(\underline{p_A}) .
In numbers, at \sigma = 0.5:
- \underline{p_A} = 0.9 gives R = 0.5 \times 1.28 \approx 0.64;
- \underline{p_A} = 0.99 gives R = 0.5 \times 2.33 \approx 1.16.
The sampling budget caps the radius: even if all n = 10^5 noisy copies are classified c_A, the Clopper-Pearson lower bound at \alpha = 0.001 is \alpha^{1/n} \approx 1 - 6.9 \times 10^{-5} , whose \Phi^{-1} is about 3.8. So no radius above 3.8\,\sigma can be certified with that many draws.
One then plots certified accuracy vs radius: a curve necessarily below the empirical curve (attacks), the gap measuring our ignorance. A useful link: randomized smoothing is the classification analogue of the Gaussian mechanism of DP (Definition 5.4 below); the “PixelDP” variant (Lecuyer et al., 2019) makes it explicit.
Definition 5.4 — Differential privacy in one page (recall for ch. 5, 7, 8) The proofs are in Privacy and Uncertainty ch. 1–4, the canonical home of DP in these notes; Graph × LLM students first met them in Emerging ML ch. 5. Two datasets D, D' are neighbors when one is obtained from the other by adding or removing one record.
A randomized mechanism M is (\varepsilon, \delta)-differentially private if, for all neighbors D, D' and every set S of outputs,
Key result — differential privacy \mathbb{P}\big(M(D) \in S\big) \;\leq\; e^{\varepsilon}\, \mathbb{P}\big(M(D') \in S\big) + \delta .
The four facts this page uses:
- Gaussian mechanism. Releasing q(D) + \mathcal{N}(0, \sigma_G^2 I) is (\varepsilon, \delta)-DP for \varepsilon < 1 as soon as \sigma_G \;\geq\; \frac{\Delta_2 \sqrt{2 \ln(1.25/\delta)}}{\varepsilon}, \qquad \Delta_2 = \max_{D \simeq D'} \|q(D) - q(D')\|_2 . Smoothing (Definition 5.1) adds the same kind of noise to the input instead of the output.
- Post-processing. Any function of M(D) — a trained model, its predictions, an attack run on them — keeps the guarantee.
- Group privacy. Datasets that differ in k records are bounded with factor e^{k\varepsilon} (and \delta grows to k e^{(k-1)\varepsilon}\delta): the poisoning bound of Example 7.4.
- DP-SGD. Clip each per-example gradient to norm C, add Gaussian noise of standard deviation \sigma C to the sum (the noise multiplier \sigma of DP-SGD, not the smoothing \sigma), sample batches at rate q = b/n; an accountant turns the steps into one (\varepsilon, \delta).
Why it matters here. A membership test is a post-processing of the trained model, so on an (\varepsilon, \delta)-DP training every test satisfies \mathrm{TPR} \;\leq\; e^{\varepsilon}\, \mathrm{FPR} + \delta . At \varepsilon = 1, \delta = 0 and an FPR of 0.1%, no attack exceeds a TPR of 0.27% (ch. 8, Exercise 8).
Deterministic certification For ReLU networks, local robustness is decidable: encode the network and the ball as arithmetic constraints (mixed linear/ReLU) and ask a solver — Reluplex (Katz et al., 2017) extends the simplex to ReLU constraints and has verified aircraft collision-avoidance networks. Complete but exponential: in practice one uses incomplete methods (interval bounds, zonotopes) that quickly certify a smaller region. Decision trees: trivial exact certification by enumerating the leaves reachable within the ball — one of the rare cases where “classical” tabular is structurally more certifiable than deep.
6. Trojans and backdoors
An attacker who can touch the training data does not need to perturb inputs at test time: they can plant a hidden rule in the model itself. This chapter describes such backdoors and the two main ways of detecting them.
Definition 6.1 — Backdoor / Trojan horse (Gu et al., 2017) A backdoored model f behaves normally on clean inputs, but an input x + \tau carrying the trigger \tau (patch, high-frequency pattern, watermark) is classified into the target class t: f(x) \approx f_{clean}(x) \ \text{on the clean distribution}, \qquad f(x + \tau) = t \ \text{almost always}. Unlike evasion (ch. 2-3), the attack is cast into training: BadNets obtains it by contaminating a fraction of the training data (legitimate examples + trigger + target label) — validation accuracy remains excellent, which makes the contamination undetectable by standard metrics.
Example 6.2 — Clean-label (Shafahi et al., 2018) “Poison Frogs”: the attacker controls no labels. One fabricates a single poisoned example: starting from an image of the target class t, it is optimized to enter into a feature collision with the victim image (close in the latent space of a pre-trained network) while remaining visibly of class t. After fine-tuning, the victim (a clean image!) is classified as t. A single data point suffices in transfer — the worst nightmare of collaborative data pipelines; cf. Emerging ML module ch. 4 for the federated case (malicious clients), and ch. 7 below for poisoning at scale.
Definition 6.3 — Detection: trigger reverse-engineering (Neural Cleanse, Wang et al., 2019) For each class c, one optimizes the minimal perturbation \delta_c that forces all inputs toward c; a backdoored model exhibits an anomaly: for the target class t, \|\delta_t\|_1 is noticeably smaller (the existing trigger provides a “shortcut”). The anomaly is detected by median absolute deviation (MAD), the trigger is reconstructed, then one repairs: pruning the hyperactive neurons under the trigger, or fine-tuning/unlearning on the reconstructed inputs.
Limits and practice Existing defenses assume small, fixed, patch-shaped triggers: adaptive triggers (distributed, input-dependent, semantic — “a cap” — or sample-specific) escape reverse-engineering.
The second family of detection is spectral (Spectral Signatures, Tran, Li & Madry, NeurIPS 2018): backdoored examples form a cluster in the space of last-layer activations — outliers are isolated in the principal directions (SVD of the activation matrix) and removed from the training set; complementary to reverse-engineering (it assumes no trigger shape), but broken by attacks that minimize their spectral signature.
Deployment rules: traceable data chain, audited source models, dedicated tests (“does the model react oddly to this pattern?”), and above all monitoring the region around the model (ch. 10); cf. Explainability, Security and Privacy of LLMs module ch. 5 for the LLM variant (instruction poisoning).
7. Data poisoning
A backdoor is one goal of an attacker who controls part of the data; more generally they may simply want the model to be worse, or biased against a group. This chapter formalizes poisoning, shows which modifications hurt most, and gives the tool that traces a prediction back to the training points.
Definition 7.1 — Poisoning The attacker modifies a fraction \rho of the training set before learning. Variants:
- label flipping ((x_i, y_i) \to (x_i, 1 - y_i); or chosen “optimal” flips);
- feature manipulation (x_i \to x_i + \delta_i, labels intact — covers the clean-label attack of ch. 6);
- insertion of forged examples.
Goal: global degradation, targeted bias on a subgroup, or a backdoor. The optimal attack (Biggio et al., 2012, on SVMs) maximizes the attacker’s validation risk on the contaminated data — solved by deriving the optimality condition (gradient of the final model with respect to the poison point, via the implicit function theorem).
Proposition 7.2 — Where flipping matters With a fixed budget of flips, the impact on the risk is maximized by moving the boundary as close as possible to well-classified points with a large margin: flipping a point very close to the boundary moves the classifier little (it was already almost an error); flipping points deep inside a class pulls the boundary toward the dense zone of the other class. Empirical consequence: a few percent of “smart” flips degrade more than many random flips — and strong regularization dampens both (the regularized classifier “resists” isolated points).
Definition 7.3 — Influence functions (Koh & Liang, 2017) The influence of a training point z on the prediction at x_{test} measures what would happen if z were upweighted by an infinitesimal amount: \mathcal{I}(z, x_{test}) = -\nabla_\theta \ell(x_{test};\hat\theta)^\top H_{\hat\theta}^{-1}\, \nabla_\theta \ell(z; \hat\theta), \qquad H_{\hat\theta} = \nabla_\theta^2 \hat R(\hat\theta), estimable without retraining (Hessian-vector products, LiSSA). It is the “defensive” tool: points with a large positive influence — upweighting them raises the test loss, so they are harmful — are candidates for audit/removal (a negative influence means a helpful point). It is also the symmetric offensive tool: crafting poisons with maximal influence.
In practice: filtering by influence, anomaly detection in the gradients, truncated losses (robust to outliers), and for the distributed setting, Byzantine aggregates (cf. Emerging ML module ch. 4: trimmed mean, coordinate-wise median…).
Example 7.4 — Data hygiene, the real defense Deduplication (poisons are often amplified duplicates), human validation of examples with high loss + high influence, provenance (data lineage, cf. ML Ops module), and trust budgets: every external source enters with a fraction cap. DP (Definition 5.4) bounds by construction the effect of each individual point: an \varepsilon-DP learner is provably robust to the poisoning of a few points. By group privacy (Privacy and Uncertainty, Proposition 1.2), k poisoned points change the distribution of the trained model by a factor at most e^{k\varepsilon}, at the price of utility — the same trade-off as in ch. 8 for privacy.
8. Model stealing and membership inference
A prediction API answers questions, and each answer leaks a little about the model and its training data. This chapter shows how an attacker turns these answers into a copy of the model, or into the knowledge that a given person was in the training set.
Definition 8.1 — Extraction / model stealing The attacker queries a prediction API to reconstruct the model (or a functional equivalent). Two regimes (Jagielski et al., 2020): high accuracy (a copy that predicts well on the task — functional counterfeiting) or high fidelity (a copy that imitates the boundary, including its errors — to build transferable adversarial examples).
Proposition 8.2 — Exact extraction of a logistic regression (Tramèr et al., 2016) If the API exposes p(y=1 \mid x) = \sigma(w^\top x + b), then d + 1 queries on affinely independent x’s — the augmented vectors (x, 1) \in \mathbb{R}^{d+1} are linearly independent — suffice to recover (w, b) exactly.
Proof. From p = \sigma(w^\top x + b), one gets \mathrm{logit}(p) = \log \frac{p}{1-p} = w^\top x + b (the API gives p, the logit is a function of p). Each query therefore provides a linear equation in (w, b), with coefficient vector (x, 1); with d+1 affinely independent points these coefficient vectors form an invertible (d+1) \times (d+1) matrix, so the linear system has a unique solution. If the API rounds the probabilities, each equation becomes a bounding interval — one solves by linear programming, with a polynomial number of additional queries. ∎
Definition 8.3 — Membership inference (MIA, Shokri et al., 2017) The attacker wants to decide whether an individual (x, y) was part of the training set — a confidentiality attack (membership itself can be sensitive: medical record, fraud).
- Canonical attack: train shadow models on similar data, label member/non-member, learn this membership classifier on the confidence scores.
- Modern version (Carlini et al., 2022, “LiRA”): a likelihood ratio test. For each target, an ensemble of shadow models with and without the target estimates the two logit densities \mathcal{N}(\mu_{in}, \sigma_{in}^2) and \mathcal{N}(\mu_{out}, \sigma_{out}^2); the optimal test is applied.
- Honest metric: TPR at low FPR (0.1%) — that is where membership is dangerous.
This is the canonical statement of membership inference in these notes. Privacy and Uncertainty ch. 5 gives a short introduction that points here, and Explainability, Security, Privacy of LLMs ch. 8 recalls it.
Defenses and links Reduce the exposed precision (top-1 only, rounding — partial effectiveness, cf. prop. 8.2), limit/monitor queries (model stealing is a volume attack), model watermarking (cf. LLMs / Explainability-Security-Privacy module ch. 9); the only strong guarantee is training-time DP (DP-SGD, Definition 5.4; accounting in Privacy and Uncertainty ch. 4): an (\varepsilon, \delta)-DP training bounds the TPR of any MIA by e^{\varepsilon} times its FPR, plus \delta (Definition 5.4) — at the price of a utility loss to be budgeted. MIA is also the auditing tool for synthetic data (cf. Boosting/Foundation Tabular module ch. 8): same box, same tool, two communities.
9. Beyond images: LLMs and graphs
The attacks of chapters 2–8 were stated for images and tables; the master’s main objects are texts and graphs. This chapter first recalls the LLM attacks of the mandatory LLM course, then shows what carries over to texts and graphs and what changes when the input is discrete; Exercise 10 is its graph lab.
LLM attacks in a nutshell (recall of LLM 9.4)
The guaranteed source for jailbreaks and injections is Large Language Models 9.4. GCG, which LLM 9.4 does not cover, is stated here in full. Explainability, Security, Privacy of LLMs ch. 5–6 goes deeper (optional co-requisite).
- Jailbreak: the user’s own prompt circumvents the safety training — role play, hypothetical framing, encodings, multi-turn escalation.
- Direct prompt injection: the user’s text overrides the developer’s instructions (“ignore the previous instructions…”).
- Indirect prompt injection: the payload sits in content the model reads — a web page, a retrieved document, a tool result — so the user can be the victim rather than the attacker; it is the main attack on RAG systems and agents.
- GCG (Zou et al., 2023), the optimization attack, in five steps:
- append a suffix of m tokens (20 in the paper) to the prompt;
- take as loss -\log p_\theta(t \mid x \oplus s), the negative log-probability of a target answer t such as “Sure, here is”;
- the gradient with respect to the one-hot encoding of each suffix token ranks, at each position, the k most promising replacement tokens;
- evaluate a batch of random single-token swaps among these candidates exactly, with forward passes, and keep the best;
- repeat a few hundred times; summing the loss over several prompts and models makes the suffix universal and transferable.
Definition 9.1 — Evasion on token sequences For a language model p_\theta over the vocabulary \mathcal{V}, a prompt x and a target answer t, an adversarial suffix solves \min_{s \in \mathcal{V}^m}\ -\log p_\theta(t \mid x \oplus s) , the analogue of Definition 3.1 in which the ball B_p(x, \varepsilon_{\mathrm{atk}}) is replaced by a discrete set of edits (m appended tokens).
Because the set is discrete, gradient signs are replaced by coordinate-wise searches guided by the gradient (GCG) or by tree searches. Poisoning of the fine-tuning corpus or of the RLHF preferences is the attack of ch. 6–7 applied to texts.
Case study 9.2 — Graphs: Nettack (Zügner et al., 2018) GNNs inherit a relational attack surface: the attacker modifies edges, node features, or other nodes in the same component. Nettack perturbs the structure and features of a citation graph to change the classification of one target node u.
- Surrogate. It attacks a linearized two-layer GCN, the layer of Graph ML, Derivation 5.2 without its nonlinearity, whose logits are \hat A^2 X W with \hat A = \tilde D^{-1/2} \tilde A \tilde D^{-1/2}.
- Search. It greedily applies the edge or feature flip with the best marginal gain on the surrogate margin of u, and repeats until the budget is spent.
- Direct or influencer. A direct attack flips edges and features of u itself; an influencer (indirect) attack only touches a few other nodes, whose messages reach u through the aggregations.
A handful of flips — the paper’s budget is the degree of u plus 2 — changes the prediction while staying invisible at the scale of the graph, and the attack transfers from the surrogate to the trained GCN.
Non-robustness is aggravated by propagation. The dedicated defenses (certification by propagation, robust learning) are covered in Advanced GNN ch. 7, if taken; this chapter lays down what the lab below needs.
# Lab skeleton (Exercise 10): Nettack-style direct structure attack on a linearized GCN
import numpy as np, scipy.sparse as sp
from sklearn.linear_model import LogisticRegression
def gcn_propagator(A): # Â = D̃^-1/2 (A + I) D̃^-1/2 (Graph ML, Derivation 5.2)
At = A + sp.eye(A.shape[0])
d = np.asarray(At.sum(1)).ravel() ** -0.5
return sp.diags(d) @ At @ sp.diags(d)
def fit_surrogate(A, X, y, train): # logits ² X W + b: W fitted by logistic regression
P = gcn_propagator(A)
clf = LogisticRegression(max_iter=2000).fit((P @ (P @ X))[train], y[train])
return X @ clf.coef_.T, clf.intercept_ # XW (one column per class), b
def margin(A, XW, b, u, y_u): # > 0 while u is correctly classified
P = gcn_propagator(A)
z = np.asarray(P[u] @ (P @ XW)).ravel() + b # row u of the logits only
return z[y_u] - np.delete(z, y_u).max()
def flip(A, u, v): # add the edge (u, v) if absent, remove it if present
A = A.tolil(copy=True)
A[u, v] = A[v, u] = 1 - A[u, v]
return A.tocsr()
def direct_attack(A, XW, b, u, y_u, budget, candidates):
for _ in range(budget): # greedy: best marginal gain, then repeat
scores = {v: margin(flip(A, u, v), XW, b, u, y_u) for v in candidates if v != u}
v = min(scores, key=scores.get)
A = flip(A, u, v)
if scores[v] < 0: # the target is misclassified: stop
break
return AAnd tabular models? On GBDTs (piecewise constant), no gradient: threshold attacks (moving x_j just beyond the active splits), differentiable substitutes, or discrete search dominate — and certification is easy there: exact by leaf enumeration for a single tree (ch. 5), sound for an ensemble by adding up each tree’s worst reachable leaf (exact verification of an ensemble is a mixed-integer program, Kantchelian, Tygar & Joseph, 2016). Robustness therefore depends strongly on the model family: the same system can be vulnerable via its scoring network and certifiable via its GBDT — one more argument for fallback architectures (ch. 10).
10. Evaluating and deploying
A robustness number is only meaningful if the attack, the budget and the protocol behind it are known, and a robust model is only one layer of a secure system. This chapter fixes the evaluation protocol and the deployment checklist.
Definition 10.1 — RobustBench (Croce et al., 2021) Standardized protocol: fixed threats per dataset (L_\infty, \varepsilon_{\mathrm{atk}} = 8/255 on CIFAR-10; L_2; self-supervised attacks), evaluation by AutoAttack + adapted attacks, public leaderboard, reproducible models and details. Reporting rules: standard AND robust accuracy, attack budget, number of restarts, training cost. Without these elements, a robustness number is not information.
In-depth deployment (layered defense)
- Reduce the surface: do not expose full scores (ch. 8), query quotas, query monitoring (volumes, distributions);
- Detect: adversarial-example detectors, drift/OOD detection (cf. ML Ops module): rejection is an honest defense;
- Resist: adversarial training (ch. 4) or certification (ch. 5) where the risk justifies it — otherwise: a secondary “hardened” version;
- Limit the damage: fallback models (falling back to a certifiable GBDT or rules), confinement of agent actions (ch. 9), “human in the loop” for sensitive decisions;
- Trace and respond: logs of suspicious adversarial queries, post-mortems, adversarial tests in the CI — treat the attack as a reproducible bug;
- Framework: the AI Act (EU 2024/1689) classifies critical systems as high risk (ch. 10 of the Explainability-Security-Privacy module for the LLM variant); the NIST AI RMF provides the governance vocabulary.
Conclusion of the module The security of learning is not a property one adds at the end: it is an optimization constraint (min-max, ch. 4), a statistical guarantee (certification, ch. 5) and a process (protocols, monitoring, ch. 10) — on a common foundation: make the threat model explicit before anything else (ch. 1). The three “R”s to remember: Realistic (the adaptive attacker), Rigorous (proven attacks and guarantees), Reproducible (standardized evaluations).
Exercises / Labs
★ FGSM/PGD on MNIST (ch. 2-3 — opening lab). Train a small CNN; implement FGSM and PGD (thm. 3.2, def. 3.3); plot accuracy vs \varepsilon_{\mathrm{atk}} for K \in \{1, 7, 20, 50\} steps and 1/5/10 restarts; visualize the examples (MNIST grid at \varepsilon_{\mathrm{atk}} \in \{0.05, 0.1, 0.3\}); measure white→black transfer to a second model (ch. 2).
Proof. Guidance (expected results):
- clean CNN ≈ 99%;
- at \varepsilon_{\mathrm{atk}} = 0.3, FGSM drops accuracy below 10% (each pixel moves by a third of the dynamic range — thm. 3.2 in action);
- K = 1 (one-step PGD, null start) ≈ FGSM;
- the gain saturates quickly in K (7 steps suffice), restarts add only a few tenths of a point at this budget — the real role of restarts appears on defended models (labs 2 and 4);
- transfer degrades but does not disappear (30-60% of the attack carries over to the target model): the “black box by secrecy of the weights” defense is futile. ∎
★ Adversarial training (ch. 4 — central lab). PGD-AT (def. 4.1, 7 steps) on MNIST then CIFAR-10 at \varepsilon_{\mathrm{atk}} = 8/255; plot standard and robust accuracy per epoch on the same figure — highlight the robust overfitting (def. 4.3) and the trade-off of thm. 4.2; compare to TRADES (error decomposition); report the RobustBench grid (standard vs robust).
Proof. Guidance (expected results):
- MNIST — standard accuracy ~98% (the trade-off of thm. 4.2 is small), robust at \varepsilon_{\mathrm{atk}} = 0.3 raised from ~0% to ≈ 90%;
- CIFAR-10 — standard ~95% → ~80% with AT, robust at 8/255 from ~0% to 45-50% (more with the augmentations of Rebuffi et al., 2021);
- robust overfitting is visible on CIFAR: test robustness peaks around the middle of training then decreases by several points while train robustness rises — early stopping and massive augmentation mitigate it (def. 4.3);
- TRADES gains a few robust points at equal standard by reading the boundary error. ∎
★ Extraction (ch. 8).
- Exact extraction of a logistic regression exposed by an API (prop. 8.2): verify the exact reconstruction, then with rounded probabilities (linear programming);
- distillation attack (Jagielski): measure accuracy and fidelity as a function of the query budget;
- discuss the defenses (rounding, top-1, quotas) and circumvent them.
★★ Standardized evaluation (ch. 3, 10). Take the models from lab 2 and evaluate them with the AutoAttack library (APGD-CE, APGD-T, Square); compare to the “home-grown” PGD numbers; discuss the gap — then break a naive defense (e.g. re-training on FGSM adversaries only) with an adaptive attack (Athalye/Tramèr, ch. 4) and write the evaluation report in RobustBench format.
Proof. Guidance (expected results):
- on an adversarially trained model, AutoAttack and the home-grown PGD are close (the model has no masked gradient — a gap on the order of one point);
- on the naive defense (trained against FGSM only), the “home-grown” PGD overestimates robustness by tens of points and AutoAttack reveals the collapse: FGSM training masks the gradient (piecewise degraded, thm. 3.2 trapped) — the adaptive attack (reparameterization, smoothing) restores it;
- the honest report: standard accuracy, robust, budget \varepsilon_{\mathrm{atk}}, attack, restarts, cost — without these elements, no conclusion (def. 10.1). ∎
★★ Certification (ch. 5). Implement randomized smoothing: estimation of g(x) and of the bounds \underline{p_A}, \overline{p_B} (Clopper-Pearson, example 5.3) on MNIST at \sigma \in \{0.25, 0.5, 1.0\}; plot certified accuracy vs radius (thm. 5.2) and overlay it with the empirical accuracy (L_2 attacks); discuss the certification/empirical gap and the \sigma accuracy/radius trade-off.
Proof. Guidance (expected results):
- at \sigma = 0.25, the smoothed classifier keeps a high clean accuracy but the certified radius quickly vanishes (R_max ≈ 0.3-0.4 on MNIST);
- at \sigma = 1.0, the certified radius reaches ~1 but the clean accuracy of the smoothed classifier drops — the certified accuracy vs radius curve is below the empirical curve everywhere, the gap measuring our ignorance (imperfect attacks from below, conservative certification from above);
- with n = 10^4 draws and \alpha = 0.01, Clopper-Pearson costs ~2 points of radius — the draw budget is a hyperparameter of the guarantee (example 5.3). ∎
★★ Backdoor and detection (ch. 6). Insert a BadNets trigger (3×3 patch) on 5% of MNIST; check clean accuracy vs trigger success rate; implement the Neural Cleanse reverse-engineering (def. 6.3: minimize \|\delta_c\|_1 per class, detect the MAD anomaly, reconstruct the trigger); repair by pruning then unlearning and measure the clean/trigger/repair triangle.
Proof. Guidance (expected results):
- with 5% of contaminated data, clean accuracy ≈ unchanged (98-99% — the attack is invisible to standard metrics, def. 6.1) and trigger success rate ≈ 99%;
- Neural Cleanse (def. 6.3) finds \|\delta_t\|_1 abnormally small for the target class only (MAD > 3, the shortcut already exists);
- pruning the hyperactive neurons under the reconstructed trigger drops the trigger success but eats into clean accuracy from ~10% of removed neurons — hence the targeted unlearning (fine-tuning on reconstructed inputs) which restores the clean behavior without resurrecting the trigger;
- conclusion: repair is a trade-off, not a restoration. ∎
★★ Poisoning and influence (ch. 7). Label flipping on a tabular MLP: compare random flips vs “large margin” flips (prop. 7.2) at equal budget; compute the influence functions (Hessian-vector products) and show that the highest-influence flips explain the degradation; test the defenses: filtering by influence, truncated loss, regularization — conclude on the federated setting (referral to Emerging ML module ch. 4).
★★ Membership inference (ch. 8). On a tabular MLP: shadow models + confidence attack (Shokri) then simplified LiRA (Carlini); plot ROC and TPR at FPR ∈ {0.1%, 1%, 10%}; retrain with DP-SGD (Opacus) at \varepsilon \in \{1, 8\} and plot utility vs attack advantage against the bound of Definition 5.4 — the trade-off curve of Privacy and Uncertainty ch. 4, revisited from the attacker’s side.
★★★ Final synthesis (ch. 9-10). Write the complete threat analysis (def. 1.1) of a proposed real system (bank scoring, content filter, internal RAG agent): surface, capabilities, goals, applicable attacks chapter by chapter, defenses in depth (ch. 10) with their costs — a 10-minute defense with demonstrations drawn from the previous labs. The bank-scoring version is the threat model of the trust work package of the end-of-year project Y2.5 (fraud alerts on a transaction graph); Exercise 10 rehearses its graph attack on Cora.
★★★ Graph attack lab (ch. 9). On Cora (Planetoid split, loaded with PyTorch Geometric), fit the linearized surrogate of the ch. 9 skeleton and train a two-layer GCN (Graph ML ch. 5). Follow the Nettack protocol: 40 correctly classified test targets (the 10 with the largest margin, the 10 with the smallest, 20 at random), budget \Delta_u = \deg(u) + 2.
- Run the direct attack and an influencer attack, which may only flip edges of 5 random neighbors of u (all of them if u has fewer), never touching u — the paper’s influencer setting.
- Measure the fraction of targets still correct: on the surrogate, on the clean-trained GCN fed the perturbed graph (evasion), and on a GCN retrained on it (poisoning).
- Open part: a defense that drops edges between nodes with dissimilar features (Jaccard similarity of X below a threshold, Wu et al., 2019), then an adaptive attack that only adds edges between similar nodes. Report both numbers, as in def. 10.1.
Proof. Guidance (expected results):
- the direct attack flips almost every target within its budget, usually with fewer flips than \Delta_u, and the targets with the smallest clean margin need the fewest flips;
- most flips add edges from u to nodes of the class that wins — the attack exploits the low-pass averaging of the GCN (Graph ML ch. 5) rather than deleting edges;
- influencer attacks with the same budget succeed noticeably less often: each flip reaches u only through one more aggregation;
- the attack transfers: the trained GCN misclassifies most of the targets that fool the surrogate, in evasion and in poisoning;
- the Jaccard filter removes many of the added edges and restores part of the accuracy, until the adaptive attack restricted to similar nodes is run — it then needs more flips but typically succeeds again: a defense is worth the adaptive attack it survives (ch. 4). ∎
Projects and assessment
The fiche displays no assessment: the course description is not published, and the S3/S4 tracks of the SynapseS 2026–2027 catalog list no course yet. The subjects, exam and rubric below are therefore proposals of these notes, not official rules. Every subject starts with a threat model in the format of Definition 1.1 — the format of the trust work package of every Year 2 end-of-year project — and reports its numbers in the format of Definition 10.1.
The projects exercise mainly O8 (trustworthy AI: attacks, defenses, guarantees), with O4 (attacks on graph models), O7 (hands-on evaluation and deployment decisions) and O3 (attacks on and through language models). The written exam is a mock for self-assessment.
Solo projects
- [Solo · ≈ 20 h] Paper study: Obfuscated Gradients Give a False Sense of Security (Athalye, Carlini and Wagner, ICML 2018). Does an input-transformation defense survive an attack that knows it?
- Work: a ResNet-18 trained on CIFAR-10, wrapped in the JPEG-compression, bit-depth-reduction and random crop-and-rescale defenses of Guo et al. (2018); attacked with home-grown PGD (Definition 3.3), then AutoAttack, then BPDA — the defense replaced by the identity on the backward pass — with EOT for the random crop.
- Data: CIFAR-10 (Krizhevsky, 2009), 1,000 test images, \varepsilon_{\mathrm{atk}} = 8/255 in L_\infty.
- Success criterion: under BPDA the robust accuracy falls to within a few points of the undefended model’s, as in the paper; the gaps between the three attacks explained by gradient masking (ch. 4).
- Deliverables: code, a 4–6 page report in RobustBench format, a 10-minute talk; chapters 1, 3, 4 and 10, Exercise 4.
- [Solo · ≈ 20 h] Paper study: Certified Adversarial Robustness via Randomized Smoothing (Cohen, Rosenfeld and Kolter, ICML 2019). How far below the attacks does the certificate sit, and what does the sampling budget cost?
- Work: the certification procedure of Example 5.3 with Clopper–Pearson bounds, on the noise-trained models released with the paper at \sigma \in \{0.25, 0.5, 1.0\}; certified accuracy against radius for n \in \{10^3, 10^4, 10^5\}; an L_2 PGD attack on the smoothed classifier with Monte Carlo gradients (Salman et al., 2019) for the empirical curve.
- Data: CIFAR-10, 200 test images, on a free GPU tier.
- Success criterion: certified curves within 5 points of the paper’s at the same \sigma; the radius cap of about 3.8\,\sigma at n = 10^5 and \alpha = 0.001 observed; the certified curve below the empirical one at every radius.
- Deliverables: code, report, talk; chapters 2, 5 and 10, Exercise 5.
- [Solo · ≈ 25 h] Adversarial suffixes on a small open LLM. Does the PGD logic carry over to tokens, and does a perplexity filter stop it?
- Work: GCG (Zou et al., 2023; the ch. 9 recall) on Qwen2.5-0.5B-Instruct with 20 suffix tokens and benign targets only — making the model begin its answer with a fixed canary phrase it never produces otherwise; batches of 128 candidates and at most 200 steps per run, stopping at the first success, keep the 150 runs within a few hours of a free GPU; then the perplexity filter of Jain et al. (2023, “Baseline Defenses for Adversarial Attacks Against Aligned Language Models”) and an adaptive attack that adds a fluency penalty.
- Data: 50 instructions from databricks-dolly-15k (Conover et al., 2023).
- Success criterion: attack success rate against iterations over 3 seeds; the filter’s false-alarm rate on clean prompts; the adaptive attack’s success with the filter on.
- Deliverables: code, report, talk; chapters 1, 3, 9 and 10. It applies LLM 9.4 and prepares Explainability, Security, Privacy of LLMs ch. 5.
Group projects
- [Group of 3 · ≈ 30 h each] Robustness audit of a GNN fraud detector. Which detector survives a budgeted structure attack on a transaction graph, and what can be certified?
- Work: GCN and GAT (Graph ML ch. 5) against a gradient-boosting baseline on the node features, with a strictly temporal split; direct and influencer attacks (the ch. 9 skeleton, or DeepRobust) on illicit targets from a few attacker-controlled transactions (nodes); edge pruning by feature similarity (cosine similarity, because the Elliptic features are continuous; Exercise 10 uses Jaccard on Cora’s binary features) and randomized smoothing on the features; a per-tree leaf-enumeration bound for the boosting fallback (ch. 9 note).
- Data: the Elliptic Data Set (Weber et al., KDD 2019 Workshop on Anomaly Detection in Finance; on Kaggle): 203,769 Bitcoin transactions over 49 time steps, about 2 % labelled illicit, attacked one time step at a time.
- Split: models and temporal protocol; attacks; defenses, certification and the deployment plan (ch. 10).
- Success criterion: recall at a fixed alert budget against the attack budget, over 5 seeds with intervals; a threat model and a fallback decision that a reviewer can check.
- Deliverables: the threat model, code, an 8–10 page joint report, a 20-minute talk; chapters 1, 5, 9 and 10, Exercises 9–10. It is a first version of the trust work package of Y2.5 and extends Advanced GNN ch. 7.
- [Group of 3 · ≈ 30 h each] Backdoors in a fine-tuning supply chain, images and text. How cheap is a backdoor in a fine-tuning pipeline, and which detector catches which?
- Work: the BadNets patch (Gu et al., 2017) and the clean-label feature collision of Poison Frogs (Shafahi et al., 2018) when fine-tuning an ImageNet-pretrained ResNet-18; instruction poisoning of a small LLM fine-tuned with LoRA (Wan et al., ICML 2023, “Poisoning Language Models During Instruction Tuning”); detection by Neural Cleanse (Definition 6.3), spectral signatures and influence scores (Definition 7.3); repair by pruning or unlearning.
- Data: CIFAR-10; databricks-dolly-15k with 1 % of the examples carrying a trigger phrase, on Qwen2.5-0.5B-Instruct.
- Split: image attacks; text attack; detection and repair across both.
- Success criterion: the clean / trigger / repair triangle per modality over 3 seeds; each detector’s detection rate at a fixed false-alarm rate.
- Deliverables: code, joint report, talk; chapters 6 and 7, Exercises 6–7. It connects to Explainability, Security, Privacy of LLMs ch. 5 (LLM backdoors) and MLOps ch. 9 (supply chain).
- [Group of 4 · ≈ 25 h each] Privacy red team of a prediction API. What does a score API leak, and what does each defense cost?
- Work: an MLP served behind a small API; extraction — exact recovery of a logistic model (Proposition 8.2), then a distillation attack scored by accuracy and fidelity against the query budget (Jagielski et al., 2020); membership inference — shadow models, then LiRA with 32 shadow models (Carlini et al., 2022); defenses — rounding, top-1 labels, query quotas, DP-SGD with Opacus at \varepsilon \in \{1, 8\}.
- Data: Purchase-100 (Shokri et al., 2017, built from Kaggle’s Acquire Valued Shoppers data): 600 binary features, 100 classes.
- Split: API and defenses; extraction; membership inference; utility and cost accounting.
- Success criterion: TPR at 0.1 % FPR for each defense, with intervals, set against the bound of Definition 5.4; fidelity against queries; the utility each defense costs.
- Deliverables: a threat analysis with costs in the form of Exercise 9, code, joint report, talk; chapters 1, 5 and 8, Exercises 3 and 8. It connects to Privacy and Uncertainty ch. 4 and Explainability, Security, Privacy of LLMs ch. 8.
Written exam (proposal)
Two hours, one handwritten A4 sheet and a simple calculator allowed; four questions, 20 points. Given: \Phi^{-1}(0.95) = 1.645, \Phi^{-1}(0.98) = 2.054, \Phi^{-1}(0.9931) = 2.46, \ln(0.001) = -6.91.
Question (5 points). A team reports that its defended CIFAR-10 classifier keeps 70 % accuracy under FGSM at \varepsilon_{\mathrm{atk}} = 8/255. (a) Write the threat model that this number assumes. (b) Give two reasons why it does not show robustness, and the evaluation you would require. (c) List what the final report must contain.
- Expected: (a) Definition 1.1 — white-box attacker, inference time (evasion), untargeted error, L_\infty ball of radius 8/255, and implicitly a one-step attacker.
- (b) FGSM maximizes a linearization (Theorem 3.2): it only gives a lower bound on the inner max. A defense can also mask the gradient (Athalye et al., 2018), so the first-order attack fails while the model is not robust. Require PGD with restarts, AutoAttack and an adaptive attack that knows the defense (BPDA, EOT), plus sanity checks: accuracy falls to 0 as the budget grows, and black-box transfer is not stronger than white-box.
- (c) Definition 10.1: standard and robust accuracy, norm and budget, attacks, restarts, training cost.
Question (5 points). A linear classifier predicts the sign of f(x) = w^\top x + b, with w = (3, -1, 2) and b = -1. Take the point x = (0.5, 0.2, 0.1), of label y = +1.
(a) Compute f(x). (b) Give the FGSM perturbation of the logistic loss at \varepsilon_{\mathrm{atk}} = 0.1 in L_\infty, and the new score. (c) Give the smallest L_\infty and L_2 budgets that change the prediction. (d) Give the clean and the robust hinge losses at the same budget.
- Expected: (a) f(x) = 1.5 - 0.2 + 0.2 - 1 = 0.5, so the prediction is correct.
- (b) The gradient of \log(1 + e^{-y f(x)}) in x is -y\,\sigma(-y f(x))\, w, of sign -\mathrm{sign}(w), hence \delta^\star = (-0.1, 0.1, -0.1) and a new score 0.5 - 0.1 \times 6 = -0.1: the prediction flips.
- (c) Proposition 2.3: the score moves by at most \varepsilon_{\mathrm{atk}}\|w\|_1, so the L_\infty threshold is 0.5 / 6 \approx 0.083; in L_2 the closest boundary point is at distance 0.5 / \|w\|_2 = 0.5/\sqrt{14} \approx 0.134.
- (d) Clean hinge 1 - 0.5 = 0.5; the point is inside the original margin, so by Theorem 4.2 the robust hinge is 0.5 + 0.6 = 1.1.
Question (5 points). Randomized smoothing with \sigma = 0.25.
(a) Monte Carlo gives \underline{p_A} = 0.95, and one takes \overline{p_B} = 1 - \underline{p_A}: give the certified radius. (b) Same with a separate bound \overline{p_B} = 0.02.
(c) With n = 1000 noisy copies, all classified c_A, and \alpha = 0.001, what is the largest radius one can certify? (d) Why is a larger \sigma not free?
- Expected: (a) by Example 5.3, R = \sigma\,\Phi^{-1}(0.95), that is 0.25 \times 1.645 \approx 0.41.
- (b) R = \tfrac{0.25}{2}(1.645 + 2.054) \approx 0.46: a tighter bound on the runner-up buys radius.
- (c) The Clopper–Pearson lower bound is \alpha^{1/n} = e^{-6.91/1000} \approx 0.9931, so R \leq 0.25 \times 2.46 \approx 0.62, that is 2.46\,\sigma; certifying 3.8\,\sigma needs about 10^5 copies.
- (d) R grows linearly in \sigma, but the base classifier sees noisier inputs: p_A falls, the smoothed classifier abstains or errs more often, and the certified accuracy at small radii drops.
Question (5 points). A model is trained by an (\varepsilon, \delta)-DP algorithm M.
(a) Prove that every membership test on a fixed record z satisfies \mathrm{TPR} \leq e^{\varepsilon}\,\mathrm{FPR} + \delta . (b) Evaluate the bound at an FPR of 0.1 % for \varepsilon = 1 and for \varepsilon = 8, with \delta = 10^{-5}, and comment.
- Expected: (a) Let D' be the training set without z and D = D' \cup \{z\}: they are neighbors. The test is a function T of the trained model; let S be the set of models on which T answers “member”. Then \mathrm{TPR} = \mathbb{P}(M(D) \in S), \qquad \mathrm{FPR} = \mathbb{P}(M(D') \in S), and Definition 5.4 applied to S gives the inequality — the post-processing argument.
- (b) At \varepsilon = 1 the bound is 2.718 \times 0.001 + 10^{-5}, about 0.27\,\%: a strong guarantee. At \varepsilon = 8: e^8 \approx 2981, so the bound is about 2.98 > 1 and says nothing at this FPR — the low-FPR regime of LiRA (Definition 8.3) is exactly where large budgets give no protection.
Grading rubric (proposal)
| Criterion | Weight | What earns the marks |
|---|---|---|
| Threat model | 15 % | Definition 1.1 written before any experiment: capabilities, timing, goal, budget (\varepsilon_{\mathrm{atk}}, queries or poisoned fraction) and what is out of scope |
| Attack strength and honesty | 25 % | the strongest attacks tried — PGD with restarts, AutoAttack, an adaptive attack that knows the defense; sanity checks such as accuracy falling to 0 as the budget grows |
| Defense, guarantee and cost | 20 % | defenses built from the chapters, with their cost in accuracy, compute and utility; each certificate stated with what it covers (norm, radius, probability 1 - \alpha, privacy budget) |
| Protocol and reproducibility | 20 % | seeds and intervals, fixed budgets, reporting in the format of Definition 10.1, code that reruns from a clean checkout |
| Communication and recommendation | 20 % | a report and a talk that end on a deployment decision (ch. 10) a non-specialist can follow, with the limits of the study stated |
References
- Foundations and the phenomenon. C. Szegedy, W. Zaremba, I. Sutskever, et al., Intriguing Properties of Neural Networks, ICLR 2014; I. Goodfellow, J. Shlens, C. Szegedy, Explaining and Harnessing Adversarial Examples (FGSM), ICLR 2015; A. Kurakin, I. Goodfellow, S. Bengio, Adversarial Examples in the Physical World, ICLR 2017 (workshop); A. Ilyas, S. Santurkar, D. Tsipras, et al., Adversarial Examples Are Not Bugs, They Are Features, NeurIPS 2019; B. Biggio & F. Roli, Wild Patterns: Ten Years After the Rise of Adversarial Machine Learning, Pattern Recognition 2018.
- Attacks and evaluation. N. Carlini & D. Wagner, Towards Evaluating the Robustness of Neural Networks (CW), IEEE S&P 2017; F. Croce & M. Hein, Reliable Evaluation of Adversarial Robustness with an Ensemble of Diverse Parameter-Free Attacks (AutoAttack), ICML 2020; F. Croce, M. Andriushchenko, V. Sehwag, et al., RobustBench: A Standardized Adversarial Robustness Benchmark, NeurIPS 2021 (Datasets and Benchmarks); F. Tramèr, N. Carlini, W. Brendel, A. Kurakin, On Adaptive Attacks to Adversarial Example Defenses, NeurIPS 2020.
- Defenses. A. Madry, A. Makelov, L. Schmidt, et al., Towards Deep Learning Models Resistant to Adversarial Attacks (PGD-AT), ICLR 2018; H. Zhang, Y. Yu, J. Yi, et al., Theoretically Principled Trade-off between Robustness and Accuracy (TRADES), ICML 2019; L. Rice, E. Wong, J. Zico Kolter, Overfitting in Adversarially Robust Deep Learning, ICML 2020; L. Schmidt, S. Santurkar, D. Tsipras, et al., Adversarially Robust Generalization Requires More Data, NeurIPS 2019; A. Athalye, N. Carlini, D. Wagner, Obfuscated Gradients Give a False Sense of Security, ICML 2018; C. Guo, M. Rana, M. Cissé, L. van der Maaten, Countering Adversarial Images Using Input Transformations, ICLR 2018; S.-A. Rebuffi, S. Gowal, D. A. Calian, et al., Fixing Data Augmentation to Improve Adversarial Robustness, NeurIPS 2021.
- Certification. J. Cohen, E. Rosenfeld, J. Zico Kolter, Certified Adversarial Robustness via Randomized Smoothing, ICML 2019; M. Lecuyer, V. Atlidakis, R. Geambasu, et al., Certified Robustness to Adversarial Examples with Differential Privacy (PixelDP), IEEE S&P 2019; G. Katz, C. Barrett, D. Dill, et al., Reluplex: An Efficient SMT Solver for Verifying Deep Neural Networks, CAV 2017; A. Kantchelian, J. D. Tygar, A. D. Joseph, Evasion and Hardening of Tree Ensemble Classifiers, ICML 2016; H. Salman, G. Yang, J. Li, et al., Provably Robust Deep Learning via Adversarially Trained Smoothed Classifiers, NeurIPS 2019.
- Backdoors and poisoning. T. Gu, B. Dolan-Gavitt, S. Garg, BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chain, 2017; B. Wang, Y. Yao, S. Shan, et al., Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural Networks, IEEE S&P 2019; B. Tran, J. Li, A. Madry, Spectral Signatures in Backdoor Attacks, NeurIPS 2018; A. Shafahi, W. Ronny Huang, M. Najibi, et al., Poison Frogs! Targeted Clean-Label Poisoning Attacks on Neural Networks, NeurIPS 2018; B. Biggio, B. Nelson, P. Laskov, Poisoning Attacks against Support Vector Machines, ICML 2012; P. Koh & P. Liang, Understanding Black-box Predictions via Influence Functions, ICML 2017; A. Wan, E. Wallace, S. Shen, D. Klein, Poisoning Language Models During Instruction Tuning, ICML 2023.
- Extraction and privacy. F. Tramèr, F. Zhang, A. Juels, et al., Stealing Machine Learning Models via Prediction APIs, USENIX Security 2016; M. Jagielski, N. Carlini, D. Berthelot, et al., High Accuracy and High Fidelity Extraction of Neural Networks, USENIX Security 2020; R. Shokri, M. Stronati, C. Song, V. Shmatikov, Membership Inference Attacks Against Machine Learning Models, IEEE S&P 2017; N. Carlini, S. Chien, M. Nasr, et al., Membership Inference Attacks From First Principles (LiRA), IEEE S&P 2022; C. Dwork & A. Roth, The Algorithmic Foundations of Differential Privacy, FnT-TCS 2014 (recap from the Emerging ML module ch. 5).
- LLMs and graphs. A. Zou, Z. Wang, N. Carlini, et al., Universal and Transferable Adversarial Attacks on Aligned Language Models (GCG), 2023; N. Jain, A. Schwarzschild, Y. Wen, et al., Baseline Defenses for Adversarial Attacks Against Aligned Language Models, 2023; D. Zügner, A. Akbarnejad, S. Günnemann, Adversarial Attacks on Neural Networks for Graph Data (Nettack), KDD 2018; H. Wu, C. Wang, Y. Tyshetskiy, et al., Adversarial Examples for Graph Data: Deep Insights into Attack and Defense (Jaccard defense, Exercise 10), IJCAI 2019; M. Weber, G. Domeniconi, J. Chen, et al., Anti-Money Laundering in Bitcoin: Experimenting with Graph Convolutional Networks for Financial Forensics (Elliptic Data Set), KDD 2019 Workshop on Anomaly Detection in Finance; for the extension: M2 module Explainability, Security and Privacy of LLMs (jailbreaks, injections, watermarking) and M2 module Advanced GNN ch. 7 (robustness and privacy on graphs).
- Framework and tools. Regulation (EU) 2024/1689 — AI Act; NIST AI Risk Management Framework 1.0, 2023; AutoAttack (code); RobustBench (leaderboard); randomized smoothing (code); IBM Adversarial Robustness Toolbox; Opacus (DP-SGD).