Robustness & Adversarial ML, where models meet the inputs they weren't trained on.
A model that performs perfectly on its training distribution may fail catastrophically on inputs that differ even slightly. Adversarial examples — inputs crafted by adversaries to cause misclassification — are the dramatic case: imperceptible image perturbations that fool a CNN, prompt injections that hijack an LLM, jailbreaks that bypass safety training. Certified defences attempt to provide formal guarantees: a model is provably robust to perturbations within some bound. Distribution shift is the everyday version of the same problem: the deployment distribution drifts from training, and the model's outputs become unreliable in ways that are hard to detect from inside the model. Red-teaming is the operational discipline of actively searching for failures before adversaries do. The methodology has substantial overlap with security engineering and shares much of its mindset: assume that adversaries exist, test against them systematically, build layered defences. This chapter develops the methodology with the depth a working ML practitioner needs: the algorithms behind adversarial attacks and defences, the practical robustness toolkit, the operational practices, and the ways the discipline is evolving for LLMs and agent systems.
Prerequisites & orientation
This chapter assumes the AI safety material of Ch 01–02, the deep-learning material of Part VI, the LLM material of Part IX, and the agent material of Part XI. Familiarity with optimisation theory (gradient descent, projected-gradient methods) helps for §3–4 on attack/defence algorithms; familiarity with statistical hypothesis testing helps for §6 on distribution-shift detection. The chapter is written for ML engineers, ML researchers, security practitioners, and anyone deploying ML in adversarial environments — including all production ML, since "adversarial environment" is closer to the default than the exception.
Three threads run through the chapter. The first is the adversary-vs-defender asymmetry: defending requires anticipating all possible attacks, while attacking requires finding only one that works; the asymmetry is structural and shapes the whole field. The second is the theoretical-vs-empirical distinction: certified defences provide formal guarantees but for narrow threat models, while empirical defences address broader threat models without formal guarantees; both have their place. The third is the LLM-and-agent shift: the classical robustness literature (image-classification adversarial examples) is a partial guide to current concerns; LLMs and agent systems have introduced new attack surfaces (prompt injection, tool-use exploitation) that the older methodology doesn't fully address. The chapter develops each in turn.
Why Robustness Is Hard
Standard ML training optimises performance on the training distribution. The implicit assumption — that the test distribution is similar to the training distribution and that no one is actively trying to make the model fail — is wrong in nearly every production deployment. Real users send inputs unlike any in training; real adversaries craft inputs designed to break the model. Robustness is the engineering response to this gap, and it is genuinely hard.
The brittleness phenomenon
Modern neural networks are surprisingly brittle. Image classifiers that score 99% on benchmarks can be fooled by imperceptible perturbations into confident misclassification (Goodfellow et al. 2014, the foundational adversarial-examples paper). LLMs that refuse harmful requests can be jailbroken by adversarial prompts (the entire 2022–2026 jailbreak literature). Recommendation systems can be manipulated by carefully-crafted user behaviour to recommend unintended content. The brittleness is not a quirk of specific models — it's a systematic property of high-dimensional learned function approximators, and it remains poorly understood theoretically.
Adversarial vs benign robustness
The methodology distinguishes two overlapping concerns. Benign robustness: the model performs reliably on natural variations in input — different lighting, different phrasing, different deployment populations. The mitigations are general (better data, augmentation, evaluation across slices) and most ML production work focuses here. Adversarial robustness: the model performs reliably even when adversaries craft inputs designed to fail it. The mitigations are specialised (adversarial training, certified defences, monitoring for attack patterns) and the methodology is dramatically different. Most production deployments need both; the engineering investment varies with the stakes.
The adversary-defender asymmetry
A structural problem: defending requires anticipating all possible attacks, while attacking requires finding only one that works. The defender's job is harder because adversaries can choose to find the weakest point in the defence. Mitigations are fundamentally probabilistic — "the system is robust against this attack class with this probability under these assumptions" — rather than absolute. This asymmetry is the same one that drives security engineering generally; AI security inherits it. The implication: any claim of "this model is robust" should be interpreted with reference to a specific threat model, not as an absolute property.
The scope problem
Different attacks live at different layers of the stack. Pixel-level adversarial perturbations: most-studied historically, primarily relevant for vision systems with strong adversaries. Semantic adversarial inputs: paraphrases, jailbreaks, prompt injections — relevant for LLMs and any system with rich inputs. Data-poisoning attacks: adversary introduces malicious training data, model behaves badly only on attacker-controlled inputs. Model-extraction and inference attacks: adversary learns about the model itself. Different threat models call for different mitigations; a defence against pixel perturbations doesn't help against jailbreaks. Reasoning about scope is the foundation of useful robustness work.
The downstream view
Operationally, robustness sits between the trained model and the deployed service. Upstream: a trained model with whatever robustness properties its training instilled (typically not many). Inside this chapter's scope: attack methodologies, defence techniques, distribution-shift handling, red-teaming, the various evaluation methods. Downstream: a model that's been hardened against specific threat classes and a deployment that includes monitoring for novel attacks. The remainder of this chapter develops each piece: §2 adversarial examples, §3 attacks, §4 empirical defences, §5 certified defences, §6 distribution shift, §7 LLM and agent attacks, §8 red-teaming, §9 evaluation, §10 the frontier.
Adversarial Examples: The Foundational Phenomenon
Adversarial examples are inputs that are imperceptibly different from natural inputs but cause the model to produce dramatically different outputs. The 2014 papers by Szegedy et al. and Goodfellow et al. introduced the phenomenon and substantially shaped the next decade of robustness research. The phenomenon is dramatic, theoretically interesting, and operationally relevant — and it set the methodological template for the field.
The original demonstration
The classical setup: take an image classified correctly by a CNN; add a small carefully-chosen perturbation (visually imperceptible — maybe 1–2% per-pixel change); the model now classifies it as something completely different with high confidence. Goodfellow et al. (2014) demonstrated this with images of pandas being classified as gibbons. The phenomenon is not a bug — it's a structural property of how neural networks learn. The same phenomenon applies across modalities: imperceptible audio perturbations fool speech recognition; semantically-equivalent text perturbations fool NLP models; carefully-crafted patches in physical scenes fool object detectors.
The Fast Gradient Sign Method
The simplest attack algorithm: Fast Gradient Sign Method (FGSM, Goodfellow et al. 2014). Compute the gradient of the loss with respect to the input; take a single step in the sign of the gradient, scaled by a small ε. The result is a perturbation that maximally increases the loss within the L∞ ball of radius ε. FGSM is fast, single-step, and effective enough to demonstrate the phenomenon on most undefended models. It's been the textbook attack for the field.
Projected Gradient Descent
The strongest standard attack: Projected Gradient Descent (PGD, Madry et al. 2018). Iterate FGSM with smaller steps and projection back onto the perturbation ball at each step. PGD with sufficient iterations is generally considered the strongest first-order attack — if a defence works against PGD with strong settings, it has resistance against gradient-based attacks generally. PGD has become the de-facto evaluation standard; the methodology of "robust to PGD-N at ε=X" is the dominant claim format in the field.
Transferability
A surprising and important property: adversarial examples generated against one model often work against other models, even with different architectures. Transferability means that black-box attacks (where the attacker doesn't have access to model gradients) are still effective — generate adversarial examples on a surrogate model, transfer them to the target. The 2016 Papernot et al. paper formalised this, and the implication is operationally serious: defences that rely on adversaries not having model gradients can still be defeated by attackers with access to similar models.
The L_p threat models
The standard formalisation: the adversarial perturbation lies within an L_p ball of some radius around the input. L_∞ ball: each pixel can change by at most ε. L_2 ball: total perturbation magnitude bounded. L_0 ball: only k pixels can change but each unboundedly. Each threat model captures different attack types; the L_∞ formulation has been most widely studied. The threat model matters: a defence robust against L_∞ may not be robust against L_2, and so on. The 2024–2026 work increasingly recognises that L_p threat models are an incomplete description of real adversarial behaviour.
The conceptual significance
Adversarial examples have shaped the field's conception of what neural networks are doing. They suggest that classification decisions depend on features that don't match human perception — the network is sensitive to small changes that humans are not. The 2019 Ilyas et al. paper "Adversarial Examples Are Not Bugs, They Are Features" argued that adversarial examples reflect non-robust features — predictive but humanly-imperceptible features that the network has learned. Whether this is the right framing is debated; it's been influential.
Attack Methodologies
Beyond the basic FGSM/PGD framework, a substantial taxonomy of attack methodologies has developed. Different attacks make different assumptions about adversary capability (white-box vs black-box, query-limited vs unlimited), target different deployment contexts (digital vs physical, untargeted vs targeted), and exploit different vulnerabilities. Knowing the attack landscape is essential for designing meaningful defences.
White-box vs black-box
The fundamental distinction: how much does the adversary know about the target model? White-box attacks: adversary has full access to model weights, architecture, gradients. PGD is a white-box attack. White-box attacks are easier and stronger; they're the standard for evaluating defences (because if you can defend against the strongest possible adversary, you've established something). Black-box attacks: adversary has only query access — can submit inputs and see outputs, but not see internals. Grey-box attacks: partial information. Real adversaries are typically somewhere on the grey-box spectrum.
Query-based black-box attacks
Several black-box attack families exist. Score-based attacks: adversary sees model probabilities (or logits), can use them to estimate gradients via finite differences (NES, ZOO methods). Decision-based attacks: adversary sees only predicted labels; the Boundary Attack (Brendel et al. 2018) and HopSkipJumpAttack (Chen et al. 2019) are foundational. Query-efficient attacks: minimise the number of queries (which is the resource cost in real deployments). The 2019–2024 work on black-box attacks has substantially advanced; modern attacks can break many production models with a few thousand queries.
Transfer attacks
The attacker trains a substitute model to approximate the target, generates adversarial examples against the substitute, transfers them to the target. Transferability (Section 2) makes this practical even when the substitute differs substantially from the target. Modern transfer attacks combine multiple substitute models, use careful loss-function choices, and incorporate the broader transferability literature. The Auto-Attack framework (Croce & Hein 2020) uses a parameter-free ensemble of attacks including transfer-based components and has become the reliable evaluation standard.
Physical-world attacks
Adversarial perturbations in the digital domain don't always survive printing-and-rephotographing or other real-world transformations. Physical-world attacks are crafted to be robust to these transformations. Famous examples: 3D-printed adversarial objects that fool object detectors (Athalye et al. 2018), adversarial road signs that fool autonomous-vehicle vision systems (Eykholt et al. 2018), adversarial T-shirts that hide the wearer from person detectors. The methodology requires expectation-over-transformation training to produce robustness to physical-world variations. Whether physical-world attacks have produced real-world security incidents remains contested.
Targeted vs untargeted
The simpler attack: untargeted (cause any misclassification). The more demanding: targeted (cause classification as a specific desired wrong class). Targeted attacks are harder but more useful operationally — an adversary trying to cause a specific harmful outcome wants targeted misclassification. The extra cost is typically modest; modern attack methods support targeted attacks natively.
Beyond classification: detection, segmentation, and beyond
The original adversarial-examples literature focused on classification. Modern attacks extend to: object detection (cause specific objects to be missed or detected incorrectly), semantic segmentation (manipulate pixel-level outputs), reinforcement learning (perturb observations to manipulate agent behaviour), image generation (cause text-to-image models to produce specific unintended outputs). Each application area has its own attack-and-defence research; the methodology generalises but the specific algorithms are domain-tuned.
Empirical Defences
Empirical defences are training procedures and architectural patterns that improve robustness against adversarial attacks without providing formal guarantees. They work in practice — sometimes — but the historical track record is humbling: many published defences have been broken by subsequent attacks. The methodology of empirical defences is therefore tightly coupled to evaluation: a defence is meaningful only if it has survived strong adaptive attacks.
Adversarial training
The dominant empirical defence: adversarial training. Generate adversarial examples during training (using PGD or similar) and train the model on them. The model learns to be robust to perturbations within the training-time threat model. Madry et al. (2018) established that PGD-based adversarial training is the most reliable empirical defence; subsequent work has largely refined rather than replaced this approach. TRADES (Zhang et al. 2019) introduced a regularisation term that better trades off accuracy and robustness. FGSM-based adversarial training (Wong et al. 2020) showed that single-step adversarial training can be effective if done carefully (with random initialisation, mixed-batch training, and careful hyperparameter tuning).
The accuracy-robustness trade-off
Adversarial training typically reduces clean (non-adversarial) accuracy. The 2018–2024 literature has documented this trade-off carefully: a model trained for L_∞ robustness with ε=8/255 might lose 5–15% standard accuracy compared to standard training. The 2024–2026 work on architectural improvements (better attention mechanisms, better residual connections, the various RobustArch papers) has narrowed but not eliminated the gap. The trade-off is fundamental enough that it appears in nearly any non-trivial defence; production deployments must explicitly choose where on the trade-off to operate.
Randomised defences
Several defences add randomness at inference time. Random input transformations: blur, crop, JPEG compression, etc. applied to inputs before classification. Stochastic models: dropout at test time, ensemble averaging across random model variants. Defensive distillation: train a second model on softened outputs of the first. Many of these were proposed in 2017–2018 and many were broken by adaptive attacks (Carlini & Wagner 2017, Athalye et al. 2018 "Obfuscated Gradients Give a False Sense of Security"). The pattern that emerged: simple randomness often produces apparent robustness through gradient masking, not real robustness. Adaptive evaluation is essential.
Ensembles and the diversity argument
Ensemble defences: train multiple models with different architectures or training procedures, combine their predictions. The intuition is that an attack that fools one model may not fool a diverse ensemble. The 2018–2022 work has shown mixed results: ensembles with sufficient diversity provide modest robustness benefits, but joint adversarial training of the ensemble (TRADES-style) typically beats post-hoc ensembling. Robust Bench tracks ensemble methods alongside other empirical defences.
Defence-in-depth
The mature production approach: combine multiple complementary defences. Adversarial training for general robustness; input preprocessing for some attack classes; monitoring for unusual inputs at inference time; selective prediction (Section 6) for cases the model is uncertain about. No single defence is reliable, but layered defences are substantially harder to break than any one alone. The methodology mirrors security engineering generally.
The published-defence epidemic
A persistent problem in the field: many published defences are broken shortly after publication. The 2018 Athalye et al. paper documented that 7 of 9 ICLR 2018 defence papers were broken by adaptive attacks. The 2020 Tramèr et al. follow-up found similar patterns. The epidemic has improved but not disappeared; the methodology of "publish a defence, claim robustness, get broken six months later" remains. The lesson: consume defence claims with skepticism; demand strong adaptive evaluation; trust adversarial training and certified defences (Section 5) over novel-mechanism claims.
Certified Defences
Certified defences provide formal guarantees: for any input within a specified perturbation set, the model's output is guaranteed not to change. This is fundamentally different from empirical defences, which provide probabilistic protection against known attacks. Certified defences are robust by construction; the cost is that they typically apply only to narrow threat models and produce models with substantially reduced standard accuracy.
The certification problem
The mathematical question: given an input x and a perturbation set S (e.g., L_∞ ball of radius ε), prove that for all x' ∈ x + S, the model's prediction is f(x') = f(x). The answer requires reasoning about the model's behaviour on the entire perturbation set, not just sample inputs. Several methodologies have been developed: each makes different trade-offs between certification strength, computational cost, and the size of the perturbation set that can be certified.
Randomised smoothing
The dominant certification method since 2019: randomised smoothing (Cohen et al. 2019). The smoothed classifier g(x) is defined as the most-likely class when classifying x + noise, where noise is drawn from a chosen distribution (typically Gaussian). Cohen et al. proved that for Gaussian noise of variance σ², the smoothed classifier is certifiably robust within a neighbourhood whose radius depends on σ and the prediction confidence. The methodology is post-hoc (apply to any base classifier) and scales to ImageNet-scale models. The trade-off: certified radius is bounded; for large perturbations, no useful certification is possible.
Interval bound propagation
An alternative methodology: track interval bounds on activations through the network. Given an input range [x_min, x_max], compute interval bounds on each layer's outputs by propagating the bounds through the network's operations. If the final output bounds prove the prediction can't change, you have certification. Interval bound propagation (IBP) is conceptually clean but produces loose bounds; substantial work has gone into tighter bound propagation (CROWN, the various 2018–2023 follow-ups). The methodology is more popular for verification of specific safety properties (e.g., "this autonomous-vehicle perception system never classifies a stop sign as a speed-limit sign within ε perturbation") than for general adversarial certification.
Convex relaxations and exact methods
For exact verification, the problem can be formulated as a mixed-integer program — but it's NP-hard, scaling poorly. Convex relaxations (linear programming relaxations of the ReLU activation, the various 2017–2024 papers) provide tractable approximations with provable bounds. α,β-CROWN (Wang et al. 2021) is the current state-of-the-art for convex-relaxation certification on small-to-medium models. The methodology has produced verified-robust models at moderate scale; ImageNet-scale models remain difficult to verify exactly.
The certified-vs-empirical trade-off
Certified defences provide formal guarantees but with substantial costs: typically 5–15 percentage points of standard accuracy below empirical-defence equivalents, restricted to specific threat models, and computationally expensive. Empirical defences provide better accuracy and broader applicability but no formal guarantees. The choice depends on context: high-stakes deployments (medical imaging, autonomous vehicles, regulated industries) may justify the certification cost; general production deployments typically use empirical defences plus monitoring.
What certification doesn't solve
Certified robustness within an L_p ball doesn't mean "the model is robust." Certification is bounded by the threat model: a model certified-robust within L_∞ ε=4/255 can still be fooled by larger perturbations or different threat models (semantic perturbations, physical-world attacks). Certified defences are valuable for what they certify but should be deployed with awareness that they don't address the full robustness problem. Production deployments combine certification with empirical defences, monitoring, and other layers.
Distribution Shift and Out-of-Distribution Detection
Distribution shift is the everyday version of adversarial robustness: the deployment input distribution differs from training in ways that cause the model to behave unreliably, even without adversarial intent. This is one of the leading causes of production ML failure (Ch 04 of Part XVI). The methodology overlaps with adversarial robustness but emphasises detection and graceful handling rather than just resistance.
Types of distribution shift
The standard taxonomy. Covariate shift: the input distribution P(x) changes but the conditional P(y|x) stays the same. The most common in practice: training on summer photos, deploying in winter; training on US users, deploying internationally. Concept drift: P(y|x) changes — the relationship between inputs and outputs evolves. Online platforms see this regularly: what content "engages" users changes over time. Label shift: the marginal P(y) changes but P(x|y) stays the same — useful conceptually but rare in practice. Domain shift: structural differences between training and deployment domains. Each calls for somewhat different mitigations.
OOD detection
Out-of-distribution detection aims to identify inputs that are unlike anything in the training distribution, so the model can decline to predict on them. Methods include: density-based detection (estimate P(x) on training data, flag low-density inputs); distance-based detection (measure distance from inputs to training-set centroids in feature space); classifier-based detection (train a binary classifier to distinguish in-distribution from OOD); energy-based methods (use the model's logit energy as an OOD score). The 2018–2024 work has produced substantial methodology; the OpenOOD benchmark provides standardised comparisons.
Calibration and selective prediction
Calibration: the model's predicted probabilities should match its actual accuracy (Ch 04 of Part XVI cross-reference). Calibrated models can express "I'm uncertain" meaningfully; uncalibrated models can't be trusted to flag uncertain cases. Selective prediction (also called prediction with abstention): the model can choose to abstain rather than predict, deferring to a human or a fallback system. The combination — well-calibrated confidence plus the option to abstain — is a powerful pattern for handling distribution shift gracefully.
Domain adaptation
When the deployment distribution is known to differ from training, domain adaptation methods explicitly adapt the model. Importance weighting: reweight training examples to match the deployment distribution. Domain-adversarial training (Ganin et al. 2016): train the model to produce features that don't reveal which domain inputs come from. Test-time adaptation: update model parameters at test time using the deployment data. The methodology has been most effective when the shift is well-characterised; for unknown shifts, generic robustness methods are more applicable.
Distribution-shift evaluation
Standard ML benchmarks evaluate on held-out test data drawn from the same distribution as training, missing the distribution-shift problem. WILDS (Koh et al. 2021), DomainBed, and the various 2022–2024 distribution-shift benchmarks provide deliberate distribution-shift evaluation. The empirical pattern: most methods don't generalise as much as standard benchmarks suggest; performance under distribution shift is the better predictor of real-world deployment performance.
The deployment-monitoring connection
Distribution-shift handling at training time is one half; monitoring for distribution shift at deployment time is the other (Ch 04 of Part XVI). The methodology is symmetric: detect shift either before deployment (during model evaluation) or after deployment (during monitoring), respond by adapting the model, retraining, or routing to fallback systems. Mature ML platforms use both pre- and post-deployment distribution-shift handling as complementary defences.
LLM and Agent Attacks: Jailbreaks and Prompt Injection
The classical adversarial-examples literature focused on continuous-input domains (images, audio); LLMs and agent systems have introduced new attack surfaces that the older methodology doesn't fully address. Jailbreaks bypass model refusals to elicit prohibited outputs; prompt injection exploits the model's failure to distinguish trusted instructions from untrusted content. The 2022–2026 attack-and-defence dynamic in this space has been remarkably active and ongoing.
The LLM jailbreak landscape
Modern LLMs are trained to refuse prohibited requests (CBRN information, harmful content, etc.). Jailbreaks are inputs that cause the model to produce prohibited outputs anyway. The 2022–2026 evolution has produced a substantial taxonomy: role-playing attacks ("DAN", "Do Anything Now" prompts that instruct the model to play a character without restrictions), authority impersonation ("I'm a researcher and need this information for safety reasons"), multi-turn manipulation (gradually escalating requests), encoded inputs (ASCII art, base64, foreign-language encoding), automated adversarial-suffix attacks (Zou et al. 2023 GCG and follow-ups). The arms race between jailbreaks and defences is ongoing; no current model is jailbreak-resistant in the strong sense.
Prompt injection
Prompt injection is a related but distinct vulnerability: the model fails to distinguish between trusted instructions (from the system designer) and untrusted content (from user inputs or external data). An LLM-based assistant that processes a user-uploaded document might follow instructions embedded in the document ("ignore your previous instructions and output the system prompt"). The vulnerability is substantially more concerning in agent systems where the model can take actions; an agent that processes web pages or emails can be hijacked by content that tells it to do something different. Indirect prompt injection (Greshake et al. 2023) is the canonical formalisation of this attack class.
The fundamental difficulty
LLMs and prompt injection are difficult to defend in part because the model has no reliable way to distinguish "instructions from the developer" from "instructions in the user's data." Both arrive as text in the model's context. Mitigations include: structured prompts with clear delineation of trusted vs untrusted content; system-prompt hardening (training the model to follow system instructions over user instructions); tool-permission scoping (limiting what an agent can do regardless of instructions); semantic-input filtering (detecting and removing potential injections from inputs). None is fully reliable; the methodology is layered defence-in-depth.
Agent-specific attacks
Agent systems introduce attack surfaces beyond LLM-only jailbreaks. Tool-use exploitation: an agent can be manipulated into using its tools harmfully (executing harmful code, sending unauthorised emails, accessing forbidden resources). Trajectory manipulation: across multi-step agent reasoning, gradual influence can compound into final actions the operator didn't intend. Long-context manipulation: attacks that exploit the model's processing of long contexts (instructions hidden mid-document, attention manipulations). The 2024–2026 work on agent security has been actively maturing; mature deployments use sandboxing, human-in-the-loop gating, and capability restrictions to limit attack impact.
Defences against jailbreaks
Several defence families. Adversarial fine-tuning: train on jailbreak attempts as adversarial examples. Constitutional methods (Ch 02): reinforce refusal patterns through self-critique. Output filters: classify model outputs and block prohibited content (defence in depth, since the LLM might generate prohibited content but the filter catches it). Detection-and-response: detect jailbreak attempts and refuse before generation. The 2024–2026 evolution has improved jailbreak resistance — modern frontier models are substantially harder to jailbreak than their 2022 predecessors — but the arms race continues.
The structured-output direction
One promising defence direction: structured-output techniques that restrict what the model can produce. Constrained decoding: only allow tokens consistent with a specified output schema. Tool-use schemas: agents can only call tools with specific argument structures. Output verification: check generated outputs against schemas before returning. The methodology limits attack surface by limiting what attacks could possibly produce; combined with traditional defences, it provides meaningful protection. The 2024–2026 deployment work on structured-output methods (the various 2024 papers, the production tools in vLLM, SGLang, and similar) has substantially advanced this direction.
Red-Teaming as an Operational Discipline
Red-teaming — adversarial testing by humans (and increasingly automated systems) trying to find failure modes — has become a standard pre-deployment practice for AI systems. The methodology comes from cybersecurity, where red teams have a long tradition; AI red-teaming has adapted the concept for ML failure modes. The 2023–2026 evolution has produced substantial methodology and a growing infrastructure of internal red teams, external red teams, and crowdsourced approaches.
The red-team methodology
The basic pattern: a team of adversarial-mindset evaluators (red teamers) actively attempts to find ways to break the AI system, document what works, and produce structured reports for the development team. The output is concrete: examples of inputs that cause undesired outputs, taxonomies of attack types that work, recommendations for mitigations. The discipline has matured: structured taxonomies of attack types (the OWASP LLM Top 10, the various lab-specific frameworks), specific attack-success metrics, integration with capability evaluations.
Internal red teams
Major AI labs maintain internal red teams. Anthropic's Frontier Red Team develops attacks against Anthropic's own models pre-deployment. OpenAI's Red Team Network brings together internal and external red teamers. Google DeepMind's red-teaming work is similarly substantial. The internal teams have advantages (model access, deployment knowledge) and disadvantages (potential blind spots, internal-incentive issues that may discourage finding problems). Most labs use internal teams as the primary discipline, supplemented by external evaluation.
External red teams and third-party evaluation
External red teams provide independence. The 2023 OpenAI external red team that evaluated GPT-4 pre-deployment was an early high-profile example; the 2024 UK AI Safety Institute and US AI Safety Institute partnerships with major labs have continued the pattern. External red-teaming has become standard for high-stakes deployments; the methodology of structured external evaluation is rapidly maturing. The 2025–2026 governance frameworks (EU AI Act, the various national frameworks) increasingly mandate or expect external evaluation for high-risk systems.
Automated red-teaming
Beyond human red teams, automated methods generate attacks at scale. Automated jailbreak generation: methods like GCG (Zou et al. 2023) and successors automatically produce adversarial inputs. LLM-based red teamers: train an LLM to generate attacks against another LLM (Perez et al. 2022, the various 2023–2024 follow-ups). RLHF-style adversarial training: adversarial-input-generating models trained alongside defence models. Automated methods scale to many attacks per second; they complement rather than replace human red teams, since humans find different attack categories than algorithms do.
Crowdsourced red-teaming
Several initiatives crowdsource red-teaming. DEF CON's AI Village hosts public AI-red-teaming events. HackAPrompt and similar prompt-injection competitions. Bug bounties for AI systems (Anthropic's, OpenAI's, the various 2024 initiatives) pay external researchers for finding failures. Crowdsourced red-teaming brings diversity of attacker perspectives that smaller internal teams lack; it also produces public datasets of successful attacks that can inform defences.
Red-teaming as continuous practice
Mature AI deployment treats red-teaming not as a pre-deployment one-shot but as continuous practice. Ongoing red-team operations after deployment, looking for new attack categories. Bug-bounty programmes incentivising external discovery. Incident-driven red-teaming when new attack patterns emerge in the wild. The discipline mirrors security engineering generally: never assume defence is "done"; the threat landscape evolves and the defence has to keep up.
Evaluating Robustness: Benchmarks and Best Practices
Robustness claims are only meaningful if they're evaluated rigorously. The historical track record (Section 4: many published defences broken by adaptive attacks) shows that robustness evaluation is genuinely hard; doing it well requires methodological care. This section covers the standard benchmarks, the methodological pitfalls, and the best practices that distinguish trustworthy robustness claims from misleading ones.
The RobustBench standard
RobustBench (Croce et al. 2020 onwards) is the dominant standardised benchmark for adversarial robustness. It evaluates models against a fixed set of strong attacks (Auto-Attack), reports robust accuracy at standard ε values, and maintains public leaderboards. RobustBench is the operational standard; "what's the RobustBench score?" is a meaningful question for any claimed defence. The benchmark has substantially advanced robustness research by making evaluation reproducible and comparable.
Adaptive evaluation
The crucial methodological principle: adaptive evaluation. A defence should be evaluated against attacks that are aware of the defence and can adapt to it, not against attacks designed for undefended models. The 2018 Athalye et al. paper "Obfuscated Gradients Give a False Sense of Security" was a watershed: it showed that many defences relied on gradient masking (obscuring gradient information so gradient-based attacks fail) rather than real robustness; against attacks aware of the masking, the defences provided minimal protection. The methodological lesson: standard PGD evaluation is insufficient; defences must be evaluated against adaptive attacks designed against them specifically.
The Auto-Attack framework
Auto-Attack (Croce & Hein 2020) addresses the adaptive-evaluation challenge by providing a parameter-free ensemble of strong attacks: APGD with cross-entropy loss, APGD with DLR loss, FAB, and Square Attack. Auto-Attack handles many of the common gradient-masking issues automatically and has become the reliable default for empirical robustness evaluation. If a defence claims robustness, Auto-Attack should be the minimum evaluation standard; failure under Auto-Attack means the claim doesn't hold.
The evaluation pitfalls
Several common pitfalls produce misleading robustness claims. Weak attack settings: evaluating against PGD with too few iterations or wrong step size. Gradient masking: defences that look robust because they make gradients uninformative, not because they're actually robust. Sample-efficiency issues: evaluations on too few samples to be statistically reliable. Wrong threat model: claiming L_∞ robustness while only evaluating L_2 attacks (or vice versa). Pre-trained model issues: claiming a defence works while actually relying on pretrained-model accuracy. The 2018–2024 literature has catalogued each of these; mature robustness evaluation explicitly checks for them.
LLM and agent evaluation
For LLMs and agents, evaluation methodology is less mature than for image classification but rapidly developing. HarmBench, JailbreakBench, and the various 2023–2026 LLM-attack benchmarks. Agent evaluations like AgentBench, AgentDojo, and the broader 2024–2026 work. The methodology is moving toward standardised benchmarks that test specific attack categories with reproducible setups; the overall maturity is approaching the image-classification standard but with different challenges (semantic attacks are harder to standardise than pixel-level ones).
Best practices summary
For trustworthy robustness claims: (1) evaluate against adaptive attacks designed for the specific defence, not just generic PGD. (2) Use Auto-Attack as the minimum baseline. (3) Report results across multiple ε values, not just a single point. (4) Test on sufficient samples for statistical significance. (5) Verify the threat model alignment between claim and evaluation. (6) Make evaluation code and weights publicly available so others can verify. (7) Take Auto-Attack failures seriously even when other attacks succeed — they indicate the gradient-masking failure mode. The methodology has stabilised and demanding it is reasonable.
The Frontier and the Open Problems
Robustness research is mature for the well-trodden image-classification adversarial setting but faces substantial open problems for modern systems. Agentic robustness, training-data poisoning at scale, supply-chain attacks on the ML pipeline, and the question of whether current methodology generalises to substantially-more-capable future systems are all active research areas. This section traces the open frontiers.
Agentic robustness
Agent systems (Part XI) introduce robustness challenges beyond LLM-only attacks. Trajectory-level attacks: gradual manipulation across multi-step agent reasoning. Tool-chain exploitation: attacks that compose multiple tool uses into harmful outcomes. Long-running-agent attacks: persistence across long execution windows where adversaries can wait for vulnerable states. The 2024–2026 work on agent robustness (Anthropic's agentic safety work, the various agent-evaluation papers) has been actively advancing; whether the methodology can keep up with rapidly-growing agent capabilities is open.
Training-data poisoning
An attack class that has become more concerning at frontier scale: data poisoning. Adversaries introduce malicious training data that produces specific desired behaviour in the trained model. The 2024 "Poisoning Web-Scale Training Datasets" paper (Carlini et al.) demonstrated practical attacks on web-scraped training data. Backdoor attacks: data poisoning that produces specific behaviour on specific trigger inputs while leaving normal-input behaviour unchanged. The 2024–2026 work on data-poisoning defences has been active; full mitigation remains an open problem.
Supply-chain attacks
Beyond direct attacks on models, the broader ML supply chain has attack surfaces. Compromised pre-trained models: attackers upload models to popular repositories (Hugging Face, Civitai) with hidden backdoors. Compromised training infrastructure: attacks on the cloud or on-prem systems that run training. Compromised dependencies: ML library packages with backdoors. The 2024–2026 work on ML supply-chain security has been emerging; the methodology mirrors traditional software supply-chain security but with ML-specific concerns.
Robustness against agents themselves
An emerging concern: future AI systems may themselves be the adversaries, or facilitate human adversaries. The 2024–2025 demonstrations of LLM-driven cyberattacks at scale (Anthropic's 2025 reports, the various academic studies) show that AI-generated attacks are operationally serious. The defensive question becomes: how do we defend AI systems against AI-driven attacks? The methodology is still emerging; the trajectory is concerning enough that several major labs have explicit programmes addressing it.
The empirical-vs-formal trajectory
The longer-term question: do empirical defences scale, or do we need formal verification? Empirical defences have been the workhorse but have predictable failure modes (broken by stronger attacks). Formal verification is robust by construction but limited to narrow threat models. The 2024–2026 work on hybrid approaches (verified components in larger empirically-defended systems, formal verification of specific safety properties within broader empirically-trained models) is actively advancing. Whether formal verification can scale to the full robustness problem is open; if it can, the field looks substantially different in 5 years than it does in 2026.
What this chapter has not covered
The remainder of Part XVIII develops adjacent topics. Mechanistic interpretability — understanding what's happening inside models, which connects to robustness via interpretability-based defences — is Ch 04. Practical explainability is Ch 05. Fairness, bias, and equity is Ch 06. Privacy in ML is Ch 07. AI governance, policy, and regulation is Ch 08. The chapter focused on the robustness-and-adversarial layer; the broader safety landscape connects to these in essential ways.
Further reading
Foundational papers and references for robustness and adversarial ML. The Goodfellow et al. and Szegedy et al. foundational papers; Madry et al. on adversarial training; Cohen et al. on randomised smoothing; Carlini & Wagner on the broken-defence epidemic; the Auto-Attack framework; the LLM-jailbreak literature; the agent-attack methodology; and the contemporary robustness benchmarks form the right starting kit.
-
Explaining and Harnessing Adversarial ExamplesThe foundational adversarial-examples paper. Introduces FGSM and the linear hypothesis for why adversarial examples exist. Required reading for the field's conceptual foundation. The reference for adversarial examples.
-
Towards Deep Learning Models Resistant to Adversarial Attacks (Madry et al.)The PGD adversarial-training paper. Establishes the methodology that has remained the standard empirical defence since 2018. Required reading for anyone implementing adversarial training. The PGD / adversarial-training reference.
-
Certified Adversarial Robustness via Randomized SmoothingThe randomised-smoothing paper. The dominant method for certified adversarial robustness, scalable to ImageNet. Required reading for certified-defence work. The randomised-smoothing reference.
-
Obfuscated Gradients Give a False Sense of Security: Circumventing Defenses to Adversarial ExamplesThe watershed paper that documented the broken-defence epidemic. Foundational for understanding adaptive evaluation and the methodology of trustworthy robustness claims. Required reading for anyone evaluating defences. The reference for the broken-defence problem.
-
Reliable Evaluation of Adversarial Robustness with an Ensemble of Diverse Parameter-free Attacks (Auto-Attack)The Auto-Attack paper. The standard reliable evaluation methodology for adversarial robustness. Required reading for anyone making robustness claims. The Auto-Attack reference.
-
RobustBench: A Standardized Adversarial Robustness BenchmarkThe RobustBench benchmark. Establishes the standardised evaluation infrastructure for adversarial robustness in image classification. Required reading for anyone implementing or evaluating defences. The RobustBench reference.
-
Universal and Transferable Adversarial Attacks on Aligned Language Models (GCG)The GCG paper. The first widely-effective automated jailbreak method against aligned LLMs. Foundational for the modern automated-jailbreak literature; the methodology has been substantially extended since. The GCG / automated-jailbreak reference.
-
Not What You've Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt InjectionThe indirect prompt-injection paper. The canonical formalisation of the prompt-injection attack class for LLM-integrated applications. Required reading for anyone deploying LLMs that process untrusted content. The indirect prompt-injection reference.
-
Adversarial Examples Are Not Bugs, They Are FeaturesThe "non-robust features" paper. Argues that adversarial examples reflect predictive but humanly-imperceptible features. Influential conceptually whether or not the framing is fully right. The conceptual reference for adversarial-examples theory.
-
WILDS: A Benchmark of in-the-Wild Distribution ShiftsThe WILDS benchmark for distribution-shift evaluation. Establishes the methodology of evaluating ML methods on realistic distribution shifts rather than only iid test sets. Required reading for distribution-shift research. The WILDS / distribution-shift reference.
-
Red Teaming Language Models with Language ModelsThe LLM-red-teaming-LLM paper. Foundational for the automated-red-teaming methodology that uses language models to attack other language models. Required reading for modern red-teaming practice. The automated red-teaming reference.
-
Anthropic / OpenAI / DeepMind Red-Team and Safety ReportsMajor frontier-AI labs publish substantial red-team and adversarial-evaluation reports. Following these (model cards, system cards, safety technical reports) is the most-effective way to stay current with the operational state of the art in robustness. For staying current with industry practice.