Adversarial Robustness and Red-Teaming
Adversarial robustness asks how a deployed system behaves when someone deliberately searches for a failure. A jailbreak attempts to elicit policy-violating model output. Prompt injection attempts to make untrusted text control an application. A harmful side effect additionally requires the application to authorize and execute the model's proposal. These failures are related, but they are not interchangeable.
This is the task of red-teaming. Red teaming searches for them under a stated threat model. It does not certify their absence. The result is evidence about one system revision, policy, attacker, budget, and evaluator, not a timeless property of a model family. adversarial robustness therefore belongs to the whole deployed system: the model, prompts, tools, guards, authorization rules, and release process all affect the outcome.
Begin with the failure, not the prompt
A refusal string is observable, but it is not the safety objective. An answer can avoid the word “no” and still provide no harmful help. It can also begin with a warning and then provide prohibited operational detail. For an agent, unsafe text is still different from an external effect. The system may generate a bad proposal that a deterministic gate rejects before anything changes.
| Outcome | What must be shown | What does not prove it |
|---|---|---|
| Jailbreak success | The response supplies policy-prohibited, useful content | Absence of a refusal phrase |
| Prompt-injection success | Attacker-controlled text changes control-relevant behavior | The model merely quotes the injected text |
| Unauthorized effect | The proposal crosses authorization and the effect occurs | A tool call appears in model output |
| Secret disclosure | Protected information reaches an unauthorized destination | The model mentions a public or synthetic value |
This separation determines where a defense belongs. Chapter 22 changes the model's default behavior. Chapter 57 detects and gates request-time events. Chapter 56 decides which effects are permitted. A model-level evaluation can measure the first outcome, but it cannot establish the last three without running the relevant application path.
Write the threat model before running attacks
An attack success rate is uninterpretable until the evaluator fixes the attacker's powers (Carlini et al. 2019). JailbreakBench makes this explicit by versioning behaviors, prompts, chat templates, scoring functions, and the threat model (Chao et al. 2024). A useful evaluation record answers each of these questions:
| Threat-model field | Question to answer |
|---|---|
| Target system | Which model, system prompt, tools, guards, and deployment configuration are under test? |
| Policy revision | Which written rule defines prohibited behavior? |
| Attacker's goal | Is success harmful text, instruction takeover, data disclosure, or an external effect? |
| Attacker knowledge | Is the system white-box, gray-box, or black-box to the attacker? |
| Attacker access | Can the attacker send one prompt, hold a conversation, plant retrieved content, or observe tool results? |
| Attack budget | How many queries, tokens, restarts, accounts, and how much wall-clock time are allowed? |
| Allowed transformations | May the attack use encodings, images, long context, external tools, or model-generated variants? |
| Success criterion | Which policy-aware judge and human-review rule decide success? |
| Defender knowledge | Was the defense tuned on this prompt, method, behavior, or attack family? |
| Adaptation | Is the attacker static, or adaptive to the disclosed defense and previous responses? |
Comparisons require the same contract. Results from different policies, budgets, sampling settings, or judges should not be placed in one ranking without qualification. Even within one contract, a vendor API may change underneath an evaluation; record the observed model revision and date rather than relying on a product name alone.
Attack methods expose different surfaces
The modern literature made attack discovery reproducible rather than eliminating the role of human testing. Perez et al. used one language model to generate test cases for another in 2022 (Perez et al. 2022). Zou et al. introduced Greedy Coordinate Gradient (GCG) in 2023, showing that optimized adversarial suffixes could transfer from open-weight models to several black-box systems evaluated at the time (Zou et al. 2023). Greshake et al. separately showed that instructions planted in retrieved data could influence LLM-integrated applications (Greshake et al. 2023). These works address different goals and access models.
The following mechanisms are useful axes, not an exhaustive taxonomy. They include jailbreak attacks, prompts designed to bypass refusal or other learned policy behavior, as well as prompt injections. An attacker can combine them in one campaign.
Manual and semantic attacks use role-play, reframing, translation, indirection, or other meaning-preserving changes. They can be found by people or generated by another model. The important variable is not whether a prompt looks clever; it is whether the method produces policy-violating, useful output within the stated budget.
Optimization-based attacks search for tokens that raise the likelihood of a target continuation. GCG uses gradients from a white-box source model to propose suffix-token changes (Zou et al. 2023). Its reported transfer to named black-box models established that some optimized prompts cross model boundaries, not that every suffix transfers to every model. Black-box methods instead use target queries, response scores, or a separate attack model; their query budget is part of the result.
Many-shot attacks fill a long context with fabricated demonstrations in which the assistant complies, then append the behavior under test. Anthropic reported that attack effectiveness increased approximately as a power law with the number of demonstrations in the evaluated models and tasks (Anil et al. 2024). That empirical shape is not a universal law, but it shows why a longer context window changes the attack budget.
Multi-turn attacks use conversation state. Crescendo begins with a benign topic and incrementally moves toward a prohibited request while reusing the model's earlier answers (Russinovich et al. 2025). The paper reports success against its evaluated systems. The general lesson is narrower: a guard that assesses only the latest message can miss intent that becomes clear across the trajectory.
Indirect prompt injection places instructions in a web page, document, email, or tool result that an application later treats as data (Greshake et al. 2023). It is not merely another way to obtain a harmful completion. Its goal is to redirect an application's control flow, data flow, or tool use. A behavioral defense may reduce measured injection success, but only an external enforcement point can decide whether the resulting effect is authorized.
Measure attempts, not anecdotes
Attack success rate (ASR) is a useful summary if its unit of analysis is explicit. Let be a behavior under test, an attack procedure, a generation seed or trial index, and the target system's response. Let be the policy-aware judge at revision . Define the binary outcome
where means that response satisfies the documented success criterion for behavior ; otherwise . The indicator maps a true statement to one and a false statement to zero.
For an evaluation set of behavior, attack, and trial triples, define and
Here is the observed attack success rate, is the number of evaluated triples, and the sum counts successful attempts. This point estimate is not a probability that the system is safe. It describes the sampled behaviors, attacks, seeds, judge, and system revision.
Report the aggregation rule. “Per-attempt ASR” gives every trial equal weight. “Any-success ASR” marks a behavior as broken if any restart succeeds. These answer different questions and diverge as the restart budget grows. Also report results per risk category, along with the severity and actionability of successful outputs; one average can hide a rare but consequential failure.
Validate the judge
Bypassing a refusal is not sufficient. StrongREJECT found that common evaluators could overstate jailbreak effectiveness when a model stopped refusing but produced an empty or incoherent answer (Souly et al. 2024). A useful judge scores harmful usefulness: did the answer actually provide the prohibited capability with enough specificity to matter?
Automated judging makes large sweeps affordable, but Chapter 50 still applies. Draw a stratified human-review sample from successes, failures, high-severity categories, and borderline scores. Report judge agreement and estimate the false positive and false negative rates against policy-trained reviewers. Keep the judge revision fixed within a comparison. If the judge changes, rescore both candidates or treat the runs as different experiments.
Report uncertainty and dependence
Stochastic decoding means the same behavior and attack can yield different answers, so run repeated samples when deployment uses sampling. Publish the sample size and a confidence interval, not only a percentage. Multiple attacks and restarts against one behavior are not independent evidence. When estimating uncertainty over behavior coverage, resample by behavior rather than treating every correlated retry as a new independent case.
The interval method should match the design: a binomial interval may fit one independent outcome per behavior, while a cluster bootstrap can preserve repeated attempts within each behavior. State the method and grouping. Zero observed successes does not prove zero risk; it only places a sample-dependent upper bound under the evaluation assumptions.
Preserve utility and cost
A lower attack success rate is not enough if the defense refuses most benign requests, damages ordinary task quality, or makes the service impractical. Pair harmful behaviors with benign contrasts that share vocabulary and context. XSTest is one such contrast set for exaggerated safety behavior (Röttger et al. 2024). Report benign refusal, ordinary task quality, and safe-completion usefulness alongside ASR.
Attack cost also changes the meaning of a result. Record queries, tokens, wall-clock time, restarts, and any external compute used by the attacker. Record defense overhead in latency, token use, accelerator time, and monetary cost. A defense that converts a one-query attack into a thousand-query attack may be useful even if it does not make ASR exactly zero, but that claim requires a rate-limit and identity model that makes the budget real.
Build a red-team program, not one benchmark run
HarmBench standardizes behaviors, attacks, target models, and an automated classifier so methods can be compared on common ground (Mazeika et al. 2024). JailbreakBench adds an artifact repository and explicit threat-model components (Chao et al. 2024). These benchmarks make results more reproducible; neither covers every deployment policy, language, modality, tool, or attacker.
A durable program separates four sources of evidence:
- A development suite gives engineers rapid feedback on known failures.
- A held-out suite contains unseen prompts and an attack-family holdout. Do not tune on the release suite.
- An adaptive suite gives a defense-aware attacker the deployed prompt, guard behavior, or enough queries to infer them. Simple adaptive changes have broken defenses that looked strong under static evaluation (Andriushchenko et al. 2025).
- A human red team explores product-specific workflows, social context, novel combinations, and harms not represented by the automated generators.
Keep part of the held-out suite private and rotate it to reduce direct overfitting. Track lineage so training data, attack-generator prompts, benchmark items, and release cases do not silently overlap. Contamination does not make a case useless as a regression, but it does weaken a claim about generalization. Replay every confirmed failure in the development suite, and reserve new behaviors or whole mechanisms for later held-out runs.
NIST's Generative AI Profile recommends adversarial role-playing, GAI red-teaming, or chaos testing to identify unforeseen failure modes (Autio et al. 2024). In practice, that means running this loop before release, after changes to the model or surrounding system, and after incidents reveal a new path:
Match the defense to the failure stage
No single defense covers every row in the opening table. Separate learned model defenses, learned runtime detectors, and deterministic effect controls. For each intervention, state both the measured improvement and the stronger claim that the evidence does not establish.
Safety tuning and adversarial training add known failure cases and policy contrasts to post-training. They can improve both direct refusal and safe completion, but their generalization depends on the training distribution, policy, model, and attack budget. An adaptive attacker should be evaluated after the weights and defense are fixed.
Instruction hierarchy trains the model to prioritize privileged instructions and treat lower-authority or untrusted content appropriately. It is a learned defense, as are prompt transformations that mark data provenance. Both can lower measured prompt-injection success, but neither is an authorization decision. The training objectives and empirical limits are developed in Chapter 22.
Input and output classifiers can catch failures that the target model misses. A separate service is operationally distinct, not automatically statistically independent: the target and guard may share training data, policy ambiguities, architecture, or blind spots. Measure their residual-error correlation. Input filters can block or transform a request; output filters can gate release or tool proposals, but cannot undo text already streamed or a side effect already committed (Chapter 57).
Representation rerouting, presented as circuit breakers, trains internal representations associated with harmful continuations away from their normal trajectory. Zou et al. reported lower ASR across the attacks and model types they evaluated while largely preserving measured utility (Zou et al. 2024). That is empirical generalization to a reported suite, not proof of a unique harmful circuit or a guarantee against an adaptive attacker. Defense-aware evaluations have subsequently shown why the threat model must be restated for every robustness claim (Andriushchenko et al. 2025).
Deterministic effect controls enforce typed tool schemas, authorization, recipient and destination rules, least privilege, approval binding, secret custody, and sandbox or egress constraints. These controls do not make model output safe. They create a security boundary for the narrow properties that trusted code checks, so a successful jailbreak or injection does not automatically become an external compromise (Chapter 56).
Turn results into a release rule
A release gate should be written before the run. For each risk category , one possible rule is
where is the attack success rate for category , is its upper confidence bound at confidence level , is the chosen error probability, and is the documented release threshold for that category. A severe category may receive a tighter threshold and a larger sample than a lower-impact one.
Safety alone is not the whole gate. Require
where is the chosen benign-utility measure, is its lower confidence bound, and is the benign-utility floor. Thus a lower ASR obtained by refusing everything still fails the release gate. Thresholds are product and risk decisions, not constants supplied by the benchmark.
If evidence misses a threshold, fix the system, narrow its deployment, add an independent control, or document an authorized exception with an owner and expiry. Do not discard unfavorable runs or change the judge after seeing the result. Chapter 53 explains how to keep release evidence separate from development feedback.
Keep a reproducible evaluation record
Store one record that connects the system, threat model, attempts, judgments, utility results, and release decision:
evaluation_id
system_revision
policy_revision
defense_revision
behavior_set_revision
attack_revision
threat_model_and_budget
generation_parameters_and_seeds
judge_revision
human_validation_sample
per_behavior_outcomes
benign_utility_outcomes
query_token_latency_costs
confidence_interval_method
release_decision_and_exception
regression_case_ids
Retain attack artifacts under access controls appropriate to their misuse risk. A summary can publish methods and aggregate results without publishing every high-risk prompt. The internal record still needs enough detail for an authorized evaluator to reproduce the claim.
Regression coverage should include more than the latest successful string:
| Scenario | Required evidence |
|---|---|
| Refusal-string trap | A non-refusal but empty answer is not counted as success |
| Held-out attack family | A mechanism absent from development still receives a result |
| Multi-turn carryover | The complete trajectory, not only the last turn, reaches the guard and judge |
| Indirect injection | Untrusted retrieved text cannot silently authorize a privileged effect |
| Adaptive re-attack | A defense-aware method runs after the mitigation is fixed |
| Benign contrast | Similar permitted requests expose over-refusal |
| Judge disagreement | Borderline and severe cases reach human review |
| Model revision | The full release suite reruns after weights or serving behavior change |
| Policy revision | Old and new judgments are not mixed under one metric |
| Defense timeout | The documented failure mode is exercised rather than assumed |
- Can jailbreak robustness ever be complete? Finite testing can show failures and place conditional bounds on a measured rate. It cannot enumerate natural language or prove that no allowed input succeeds. Whether stronger training can make residual risk operationally negligible remains an empirical question.
- How much should benchmarks standardize? A common behavior set and judge improve comparability, but they also concentrate optimization on one definition of harm. A product-specific suite is more relevant and less comparable. Mature programs need both.
- Do representation-level defenses generalize better than surface defenses? Published results show gains on evaluated unseen attacks (Zou et al. 2024), while adaptive results show that a changed threat model can reverse the conclusion (Andriushchenko et al. 2025). The answer must name the attack family and budget.
- How much attack detail should be disclosed? Reproducibility favors artifacts; misuse risk favors controlled access. The right disclosure level depends on capability, availability, and whether defenders already have practical mitigations.
Model behavior constrains what red teams must search, but infrastructure constrains what a successful attack can do. Prompt defenses, classifiers, and representation interventions can reduce measured success. They do not replace authority scoping, secret isolation, typed tool gates, recipient checks, sandboxing, or egress policy. For consequential actions, the model may propose; trusted code must decide and enforce.
Adversarial robustness is not one score attached to one model. It is a repeatable process: define the failure, state the attacker's powers, run representative and adaptive attacks, validate the judge, quantify uncertainty and utility, enforce a release rule, and preserve every confirmed failure as regression evidence. The result is not a certificate. It is a versioned, auditable claim about how one deployed system resisted one documented adversary.
Further reading
- Zou et al., “Universal and Transferable Adversarial Attacks on Aligned Language Models” (GCG and the AdvBench harmful-behaviors set), 2023. arXiv:2307.15043GCG introduces an automated greedy coordinate gradient method to find adversarial suffixes that jailbreak aligned LLMs, transferring to black-box models including ChatGPT, Bard, and Claude.
- Greshake et al., “Not What You've Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection,” 2023. arXiv:2302.12173This paper introduces indirect prompt injection, an attack where adversaries plant malicious instructions in data retrieved by LLM-integrated applications to remotely hijack the LLM without direct user access.
- Anil et al., “Many-shot Jailbreaking” (long-context attack scaling), 2024. papers.nips.ccMany-shot jailbreaking places many fabricated harmful demonstrations in one prompt and reports approximately power-law attack scaling across the evaluated models and tasks.
- Russinovich et al., “Great, Now Write an Article About That: The Crescendo Multi-Turn LLM Jailbreak Attack,” 2025. usenix.orgCrescendo is a multi-turn LLM jailbreak that escalates from benign prompts using the model's own prior outputs, bypassing safety alignment on GPT-4, Gemini-Pro, and other models with high attack success rates.
- Perez et al., “Red Teaming Language Models with Language Models” (automated attack generation), 2022. arXiv:2202.03286This paper introduces LM-based red-teaming, using one language model to automatically generate test cases that elicit harmful outputs from a target LM, uncovering tens of thousands of failures in a 280B-parameter chatbot.
- Mazeika et al., “HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusal,” 2024. arXiv:2402.04249HarmBench is a standardized benchmark with 510 harmful behaviors and an evaluation pipeline that compares 18 automated red-teaming methods across 33 LLMs to enable rigorous, reproducible attack-defense co-development.
- Zou et al., “Improving Alignment and Robustness with Circuit Breakers” (representation-level defense), 2024. arXiv:2406.04313Circuit breakers use representation rerouting to move harmful internal representations away from their original trajectory and report lower attack success on the evaluated unseen attacks with limited measured utility loss.
- Souly et al., “A StrongREJECT for Empty Jailbreaks” (judge harmful usefulness rather than refusal wording), 2024. arXiv:2402.10260StrongREJECT evaluates whether a jailbreak response supplies useful prohibited information and shows that common evaluators can overstate attack success.
- Röttger et al., “XSTest: A Test Suite for Identifying Exaggerated Safety Behaviours in Large Language Models” (benign and unsafe contrast cases for exaggerated refusal), 2024. aclanthology.orgXSTEST is a 250-prompt test suite that identifies exaggerated safety behaviors in LLMs, where models refuse safe prompts due to lexical overlap with unsafe ones.
- Chao et al., “JailbreakBench: An Open Robustness Benchmark for Jailbreaking Large Language Models” (versioned artifacts, threat models, and scoring), 2024. arXiv:2404.01318JailbreakBench provides a versioned behavior set, adversarial-prompt repository, threat models, chat templates, and scoring functions for reproducible jailbreak evaluation.
- Autio et al., “Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile” (official guidance on adversarial testing and generative-AI risk management), 2024. doi.orgNIST organizes generative-AI risk management around documented governance, measurement, monitoring, incident handling, and layered mitigations.
- Andriushchenko et al., “Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks” (defense-aware evaluation under an adaptive threat model), 2025. proceedings.iclr.ccSimple defense-aware changes substantially increased attack success against models and defenses that appeared robust under their earlier static evaluations.
- Carlini et al., “On Evaluating Adversarial Robustness” (threat-model and adaptive-evaluation guidance), 2019. arXiv:1902.06705This evaluation guide argues that robustness claims require explicit threat models, strong attacks, adaptive testing, and reproducible reporting.
Comments
Log in to comment