Skip to content

AutoJailbreak: Exploring LLM jailbreak attacks and defenses from a dependency perspectiveAutoJailbreak: Exploring Jailbreak Attacks and Defenses through a Dependency Lens

arXiv· arXiv:2406.03805· Lin Lu, Hai Yan, Zenghui Yuan, Jiawen Shi, Wenqi Wei, Pin-Yu Chen, Pan ZhouHuazhong University of Science and Technology; Computer and Information Sciences Department Fordham University; IBM ResearchIndexed by this site · 27 days ago· Originally publishedAttacks

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose AutoJailbreak, which uses a DAG to analyze black-box jailbreak attack-defense dependencies and integrates Ensemble Attack and Ensemble Defense, and claim it outperforms baselines on 8 LLMs.

Threat modelblack-box threat model: the attacker A can only query the victim model MV through the API by constructing a jailbreak prompt PJ = PI ⊕ T, and has no prior knowledge of MV (including the next-token probability distribution and sampling hyperparameters). The defender can only modify PJ or the response R, does not know the model parameters, and must defend against both malicious semantics and adversarial suffix attacks.

Questions
Existing black-box jailbreak attacks and defenses mostly perform local optimization within general frameworks: attacks optimize only a single subcomponent, defenses target only specific prompt types, and evaluation often treats hallucinated responses that do not answer the question as successful alignment.
Methods
Use causal analysis to build a DAG that sorts out the dependencies of the optimization schemes for attacks and defenses, and integrate two attacks, Ensemble Attack-GA/Gen, an Ensemble Defense based on mixture-of-defenders, and propose a two-stage AutoEvaluation that distinguishes jailbreak, hallucination, and alignment.
Experiments and results
On 8 LLMs, Ensemble Attack-GA reaches a JR of 99.0% on Vicuna, Qwen, and Mistral; AutoDefense suppresses the JR against Ensemble Attack-Gen to 0 on GPT-4, Vicuna, LLaMa-2, Qwen, and Mistral, and against the GCG white-box attack the JR on LLaMa-2 is 0.0%.
Limitations and future work
The paper does not specifically discuss limitations. The experiments cover 8 LLMs and 96 malicious behaviors; it does not report the number of repetitions, the query budget, the specific model used for judging, or consistency values with human evaluation; long-tail encoding and transfer-based attacks were excluded from evaluation.
Experimental setupGPT-3.5-turbo、GPT-4 et al. · 自建 96 条恶意行为数据集(附录 C) · JR、HR et al.
Evaluated models
GPT-3.5-turboGPT-4LLaMa-2LLaMa-3MistralQwenVicunaClaudeRoberta
Benchmarks
自建 96 条恶意行为数据集(附录 C)
Metrics
JRHRARTPRFPR
AI summaryThe researchers propose AutoJailbreak, which uses directed acyclic graphs to systematically analyze the dependencies among large language model jailbreak attack and defense techniques, generalizes them to all possible attack surfaces, and presents three automated frameworks. Among them, AutoAttack analyzes the dependencies of two classes of jailbreak optimization strategies, genetic-algorithm-based and adversarial-generation-based, and accordingly constructs an ensemble jailbreak attack; AutoDefense leverages the dependencies between pre-generation and post-generation defense strategies to propose a mixture-of-defenders defense method; AutoEvaluation proposes an evaluation method that distinguishes the often-overlooked hallucination from jailbreak attack-defense responses. Experiments in the paper show that the proposed ensemble attack and defense frameworks significantly outperform existing research.

The researchers propose AutoJailbreak, which uses directed acyclic graphs to systematically analyze the dependencies among large language model jailbreak attack and defense techniques, generalizes them to all possible attack surfaces, and presents three automated frameworks. Among them, AutoAttack analyzes the dependencies of two classes of jailbreak optimization strategies, genetic-algorithm-based and adversarial-generation-based, and accordingly constructs an ensemble jailbreak attack; AutoDefense leverages the dependencies between pre-generation and post-generation defense strategies to propose a mixture-of-defenders defense method; AutoEvaluation proposes an evaluation method that distinguishes the often-overlooked hallucination from jailbreak attack-defense responses. Experiments in the paper show that the proposed ensemble attack and defense frameworks significantly outperform existing research.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors believe black-box jailbreak attack and defense fall into local optimization, and propose AutoJailbreak, which uses a DAG to analyze dependencies and integrates attack, defense, and evaluation.

    Core problem: existing black-box jailbreak attacks and defenses are trapped in local optimization within general frameworks—attacks tune only a single subcomponent, defenses target only specific prompt types, and evaluation ignores hallucinated responses.

    • Problem setting and importance: Jailbreak attacks use malicious prompts to induce LLMs to generate content that violates ethical and legal norms; API queries have become the primary way LLMs are used, and the authors state that jailbreak attack and defense in the query-based black-box setting is a focus of the community.
    • Shortcomings of existing methods (per the authors): On the attack side, most optimize one subcomponent within general frameworks such as GA while ignoring other subcomponents; on the defense side, they target only specific types of jailbreak prompts (e.g., adversarial suffixes) and have limited effectiveness against broader attacks, forming a cat-and-mouse local optimization.
    • Core observation: The authors believe a directed acyclic graph (DAG) can characterize the dependencies among attack/defense optimization schemes and combine the strengths of schemes within the same framework; they also point out a commonly ignored issue in evaluation—a model's hallucinated response that does not answer the question does not mean value alignment succeeded.
    • What the paper proposes: The AutoJailbreak framework, comprising AutoAttack (Ensemble Attack-GA and Ensemble Attack-Gen), AutoDefense (Ensemble Defense based on mixture-of-defenders), and AutoEvaluation (a two-stage evaluation distinguishing jailbreak/hallucination/alignment). The authors state they surveyed more than 28 jailbreak attacks and 12 defenses (Appendix A Table 6).
    • Threat model (Section 2.3):
      • Attacker goal: make the victim LLM generate harmful content via jailbreak prompts.
      • Knowledge: black-box, with no prior knowledge of the victim model MV, including next-token probability distributions and sampling hyperparameters.
      • Capability: can only construct PJ = PI ⊕ T (malicious behavior PI embedded in a template or system prompt T) and obtain responses via API queries.
      • Defense setting: the defender can only modify PJ or the response R and does not know the model parameters; must defend against both malicious-semantic and adversarial-suffix attacks.
  2. What related research exists?

    Related work is divided into four types of black-box attacks, two types of defenses, and four groups of evaluation methods and benchmarks; the authors say existing benchmarks do not use the strongest ensemble attacks.

    Black-box jailbreak attacks (Section 2.1)

    • Static manual design: Shen et al. (2023), Liu et al. (2023b), Yu et al. (2024)—manually construct malicious templates and system prompts, and replacing keywords can induce harmful content; the authors say such methods are easily mitigated by alignment fine-tuning.
    • Dynamic optimization: GA-type (Yu et al. 2023's GPTFuzzer, Li et al. 2024b's SMJ, Liu et al. 2023a's AutoDAN) mutate the prompts closest to the target; adversarial generation-type (Chao et al. 2023's PAIR, Mehrotra et al. 2023's TAP, Takemoto 2024's SBJ) use an LLM as a red-team assistant to refine prompts round by round.
    • Long-tail encoding and transfer attacks: Yong et al. (2023) use low-resource languages, Jiang et al. (2024b) use artistic fonts; Sitawarin et al. (2024), Hayase et al. (2024) construct with open-source white-box models and then transfer. The authors say that to ensure fairness they excluded these two types from evaluation: not all LLMs can parse low-resource data, and transfer reduces the success rate.

    Jailbreak defenses (Section 2.2)

    • Pre-generation defenses: Ji et al. (2024), Robey et al. (2023), Cao et al. (2023), Hu et al. (2024)—rewrite prompts through smoothing or malicious intent analysis. The authors point out that they often target specific attack methods and generalize poorly.
    • Post-generation defenses: Pisano et al. (2023), Helbling et al. (2023), Zeng et al. (2024), Xiong et al. (2024)—filter harmful content in model outputs. The authors point out that they cannot guarantee response quality.

    Jailbreak evaluation

    • Three types of methods: keyword matching (Zou et al. 2023), classifiers (Huang et al. 2023, Yu et al. 2023), LLM-as-a-Judge; AttackEval (Jin et al. 2024) proposes coarse-grained and fine-grained evaluation frameworks. The authors point out two problems in this system: responses first refuse and then still contain harmful information; outputs do not answer the question, and these problems (previously noted by Cai et al. 2024) have not been systematically examined.

    Jailbreak benchmarks

    • Chu et al. (2024), Chao et al. (2024)'s JailbreakBench, Qiu et al. (2023); JailbreakV-28K (Luo et al. 2024) extends to multimodality; EasyJailbreak (Zhou et al. 2024) introduces 12 attacks within a GA-like framework. The authors point out that these benchmarks rely on existing attack methods, and using these methods alone is not the strongest attack form and cannot accurately evaluate the jailbreak robustness of target models.

    Baselines and benchmarks: attack baselines are PAIR, TAP (adversarial generation framework) and AutoDAN-GA, GPTFuzzer (GA framework); defense baselines are Spell-check, Monto-Carlo Sampling, Intention Analysis, Summarize; the white-box attack uses GCG (Zou et al. 2023). The dataset is the authors' self-built dataset of 96 malicious behaviors (Appendix C).

    Positioning: the authors state that this paper does not claim AutoJailbreak is the ultimate attack and defense, but that it should become the minimal test for any new attack and defense.

  3. How does the paper address this problem?

    Use causal analysis to build an attack-defense dependency DAG, and integrate the best sub-schemes within each framework to obtain two ensemble attacks, one ensemble defense, and a two-stage evaluation.

    Overall approach: use causal analysis to organize the optimization schemes of black-box automated jailbreak attacks and defenses into a DAG (nodes are specific optimization schemes, directed edges indicate that the destination scheme improves on the starting point), then combine the strengths of each scheme within each framework to obtain the three components of AutoJailbreak.

    Dependency analysis framework (Section 3)

    • DAG construction: nodes represent optimization schemes, edges indicate that the destination scheme strengthens or weakens the starting scheme in jailbreak effectiveness; red circles indicate the final goals of attack and defense. Standard causal analysis requires all factors other than the main variable to be held constant, and on this basis the authors excluded minor variants that differ only in hyperparameters.
    • Attack formalization: the jailbreak prompt is written as PJ = PI ⊕ T, i.e., the malicious behavior PI is substituted into the malicious template placeholder or appended to the end of the system prompt, and the attacker obtains the response R through API queries.

    AutoAttack: two ensemble attacks (Section 3.1)

    • Framework division: dynamic black-box attacks are divided into the GA framework (four steps: seed initialization, seed selection, mutation, execution) and the adversarial generation framework (another LLM acts as a red-team assistant and constructs prompts round by round based on the victim model's output).
    • Ensemble Attack-GA: based on AutoDAN-GA. Initialization uses the GPTFuzzer approach (randomly selecting malicious system prompts to refine PI), and uses SMJ's strategy to expand the seed search space; the selection stage introduces a language assistant to score the semantic similarity between the response and the target output on a 1–10 scale (replacing the all-mpnet-base-v2 used by OpenSesame, which the authors say has a performance bottleneck under long system prompts); the mutation stage uses GPTFuzzer's five mutation prompts.
    • Ensemble Attack-Gen: based on Tastle. The red-team assistant design draws on PAIR's interpretability and chain-of-thought; the search space optimization draws on TAP, adding an evaluator to discard off-topic prompts early; the attack model follows SBJ's practice of using the same model as the victim model. The authors say that because Tastle-style long initial prompts would confuse the red-team assistant, they iterate starting from the original malicious behavior.

    AutoDefense: mixture-of-defenders (Section 3.2)

    • Overall flow: first, a language assistant judges whether the user query is benign or malicious; malicious prompts are then classified into two types, adversarial suffix or malicious semantics, and handed to the corresponding defense expert; each expert generates two rewritten prompts, the victim LLM produces two responses, and after post-generation filtering another LLM votes to select the better answer.
    • DE-adv (adversarial suffix expert): Spell-check corrects grammatical and spelling errors; Monto-Carlo sampling performs adversarial suffix removal to prevent the adversarial string from appearing in the middle of the sentence.
    • DE-sem (malicious semantics expert): Summarize condenses lengthy prompts to strip the original malicious intent from complex templates; Intention Analysis identifies the intent based on single-turn intent analysis and rewrites.
    • Design rationale: let each defense expert specialize in one type of prompt; benign prompts are sent directly to the LLM to avoid rewriting harming the generation quality for benign queries.

    AutoEvaluation: two-stage evaluation (Section 3.3)

    • Comparison of evaluation methods: compares three methods—keyword matching, a binary classifier (Roberta, fine-tuned on five datasets ParaDetox, Toxic-Conversations-50k, ToxicChat, WikiToxic, and Real Toxicity Prompts with 1,000 pairs randomly sampled from each, 5 epochs, batch size 16), and LLM-as-a-Judge—with TPR and FPR as metrics.
    • Two-stage judgment: the first round judges whether the response contains harmful information (whether the jailbreak succeeded); clean responses are then judged for whether they actually answer the user query. Finally samples are divided into three categories: jailbreak, hallucination, alignment. The prompt used by LLM-as-a-Judge is in Appendix B.
  4. What experiments did the paper conduct?

    Evaluated on 8 LLMs and 96 malicious behaviors: Ensemble Attack-GA reaches a JR of 99.0% on three models, and AutoDefense mostly reduces JR to single digits or 0.

    Experimental setup

    • Models tested: GPT-3.5-turbo, GPT-4, LLaMa-2, LLaMa-3, Mistral, Qwen, Vicuna, Claude, 8 in total, accessed through a unified API platform (together.ai); temperature and top-p are set to 0.7, top-k 50.
    • Dataset: a self-built set of 96 malicious behaviors (Appendix C), divided into general (14 subcategories) and target (10 subcategories), 4 entries per subcategory, with cross-duplication avoided during construction.
    • Baselines: on the attack side, PAIR, TAP (adversarial generation) and AutoDAN-GA, GPTFuzzer (GA); on the defense side, Spell-check, Monto-Carlo Sampling, Intention Analysis, Summarize; the white-box attack uses GCG.
    • Metrics: JR (proportion of responses containing harmful information), HR (proportion of hallucinated responses among failed samples), AR (proportion of aligned refusals among failed samples).
    • Judging method: LLM-as-a-Judge (prompt in Appendix B); Table 1 shows that on TAP attack evaluation it achieves a TPR of 65.22% and an FPR of 8.22%, outperforming the classifier (8.70/5.48) and keyword matching (34.78/21.92), so it is chosen as the main evaluation method. The paper does not state which model is used for judging.
    • Attack configuration: Ensemble Attack-Gen uses the same model as the target as the attack model, but LLaMa-2, LLaMa-3, and Claude refuse to act as red-team assistants, so GPT-4 is used instead; the baselines PAIR/TAP use GPT-3.5 as the red-team assistant; the maximum number of iterations for PAIR is raised to 10 to align with TAP. AutoDAN-GA generates prompts with LLaMa-2 as the victim model and then transfers them to attack other models (i.e., the target model in that row differs from the model used for generation). The paper does not report the number of repetitions.

    Main results

    Table 2: JR (%) / HR (%) / AR (%) of the two ensemble attacks and baselines, listed by target model (only JR is listed; see the original for the full three metrics):

    Swipe horizontally to read the table

    Target modelPAIRTAPEnsemble Attack-GenAutoDAN-GAGPTFuzzerEnsemble Attack-GA
    GPT-3.518.814.614.677.154.291.7
    GPT-428.130.280.251.077.165.6
    Vicuna28.126.021.977.164.699.0
    LLaMa-25.23.116.713.510.463.5
    LLaMa-340.639.652.11.07.340.0
    Qwen20.836.445.888.580.299.0
    Mistral50.363.543.888.581.299.0
    Claude3.13.139.64.211.55.2

    (According to Table 2; the prompts in the AutoDAN-GA column are generated on LLaMa-2 and then transferred to each target model)

    • The authors say Ensemble Attack-Gen achieves the best JR within that framework on 5 models, leading the baselines by at least 10%; on GPT-4 and Claude it exceeds the baselines by 50% and 36.5% respectively; on GPT-3.5, Vicuna, and Mistral it is not the best, trailing by 4.2% and 6.2% (original wording).
    • The authors say Ensemble Attack-GA exceeds a JR of 90% on 4 LLMs, with Vicuna, Qwen, and Mistral reaching 99%; and its HR is slightly lower than the baselines, which the authors believe reflects the effect of introducing semantic features in the seed selection and mutation stages.
    • Exceptions: Ensemble Attack-Gen's JR on GPT-3.5 ties with TAP (14.6), and on Vicuna (21.9) and Mistral (43.8) it is lower than TAP; Ensemble Attack-GA is only 5.2 on Claude.

    AutoDefense's defense against ensemble attacks (Table 3)

    • Against Ensemble Attack-Gen (Table 3a): AutoDefense suppresses the JR to 0–3.1%, with 0 on GPT-4, Vicuna, LLaMa-2, Qwen, and Mistral; AR is mostly above 90% (Qwen 100.0%).
    • Against Ensemble Attack-GA (Table 3b): AutoDefense's JR is 0–12.6%, the highest being Qwen at 12.6%; the authors acknowledge that under the GA framework it is sometimes slightly inferior to baseline defenses on models such as Qwen and Mistral, but say it almost always limits JR to single digits (of Qwen 12.6% and Mistral 7.0%, the former is the exception).
    • The authors say AutoDefense can reduce HR, and believe the reason is that post-generation defenses directly refuse rather than indirectly answer.

    AutoDefense against static attacks and white-box attacks (Table 4, Table 5)

    • Static attack setup: 6 system prompts (three types: Reject Suppression, DAN, Developer Mode) and 5 malicious templates (including multi-turn dialogue methods such as DrAttack, Indirect Jailbreak, Contextual Interaction Attack, and special formats such as Python and LaTeX).
    • Results (Table 4): the authors say the JR of most static attacks is suppressed below 1% with low HR; Summarize and Intention Analysis also have defensive power against malicious-semantics static attacks, and the authors' possible explanation is that they strip irrelevant information from the templates; Spell-check and Monto-Carlo Sampling, which target adversarial suffixes, are almost ineffective against malicious-semantics static attacks, which the authors say confirms that some defenses target only specific attack forms.
    • White-box attack (Table 5): GCG attacks LLaMa-2, with a JR of 100.0% without defense; AutoDefense gives 0.0 / 10.7 / 89.3 (JR/HR/AR). Summarize also has a JR of 0.0 but an HR of 39.3, nearly 30 percentage points higher than AutoDefense, which the authors attribute to Summarize deleting part of the user's original query when removing the suffix.

    Other ablations and analyses

    • Comparison of evaluation methods (Table 1): on TAP attack evaluation, LLM-as-a-Judge has a TPR/FPR of 65.22/8.22, the classifier 8.70/5.48, and keyword matching 34.78/21.92; on this basis the authors adopt LLM-as-a-Judge.
    • Hallucination phenomenon: in Table 2, LLaMa-2 has an HR of 56.2% under Ensemble Attack-Gen, and in Table 3, Summarize defense is often accompanied by high HR (e.g., 78.1% HR against Ensemble Attack-Gen on GPT-3.5); the authors incorporate hallucination into the evaluation system to re-examine attack and defense effectiveness.
    • The paper does not report statistics on the number of sample repetitions, the number of queries, or the iteration budget for each experiment.
  5. What are some points that can be further explored?

    The paper does not specifically discuss limitations; the experiments cover 8 models and 96 behaviors, and the number of repetitions and inter-rater agreement are not reported.

    Limitations and future directions noted by the authors

    • The paper does not specifically discuss limitations; there is no Limitations or Future Work section.
    • In the Conclusion, the authors state that they hope the research can inspire the community to extend and improve existing attack and defense methods, and that AutoJailbreak should become the minimal test for any new attack and defense, rather than the ultimate solution (Introduction and Conclusion).

    Scope of experiments

    • Models tested: GPT-3.5-turbo, GPT-4, LLaMa-2, LLaMa-3, Mistral, Qwen, Vicuna, Claude, 8 in total (Section 4.1).
    • Attack coverage: dynamic attacks (the GA and adversarial generation frameworks), static attacks (6 system prompts + 5 malicious templates), white-box attacks (GCG, LLaMa-2 only); long-tail encoding and transfer-based attacks were excluded from evaluation, which the authors say is because not all LLMs can parse low-resource data and transfer reduces the success rate (Section 2.1).
    • Dataset: a self-built set of 96 malicious behaviors, with 14 subcategories in general and 10 subcategories in target, 4 entries per subcategory (Section 4.1, Appendix C).
    • Judging and consistency: LLM-as-a-Judge is used; the paper does not state the specific model used for judging; Section 3.3 mentions analyzing the consistency of three evaluation methods with human evaluation, but the main text does not report consistency values.
    • Experimental statistics: the paper does not report the number of repetitions, the number of attack queries, or the iteration budget (it only states that the maximum number of iterations for PAIR is set to 10), nor does it report the latency or overhead introduced by defenses.
  6. Summarize the main content of the paper

    AutoJailbreak integrates black-box jailbreak attack, defense, and evaluation via DAG dependency analysis; the authors state that it outperforms existing methods on 8 LLMs.

    AutoJailbreak is a black-box jailbreak attack-defense analysis framework, addressing what the authors call the problem that existing attacks and defenses fall into local optimization within general frameworks.

    • Problem: attack methods optimize only a single subcomponent within frameworks such as GA, defenses target only specific types of prompts, and evaluation often treats hallucinated responses that do not answer the question as successful alignment.
    • Method: use causal analysis to build a DAG that sorts out the dependencies of attack and defense optimization schemes, and integrate two attacks, Ensemble Attack-GA and Ensemble Attack-Gen, an Ensemble Defense based on mixture-of-defenders (two experts, DE-adv and DE-sem, plus post-generation filtering and voting), and a two-stage AutoEvaluation (LLM-as-a-Judge) that distinguishes jailbreak/hallucination/alignment.
    • Attack results: on 8 LLMs and 96 malicious behaviors, Ensemble Attack-GA reaches a JR of 99.0% on Vicuna, Qwen, and Mistral; Ensemble Attack-Gen achieves a JR of 80.2% on GPT-4 and 39.6% on Claude, which the authors say exceed the baselines by 50% and 36.5% respectively (Table 2).
    • Defense results: AutoDefense suppresses the JR against Ensemble Attack-Gen to 0 on 5 models (Table 3a); against static attacks it mostly suppresses it below 1% (Table 4); against the GCG white-box attack on LLaMa-2 the JR drops from 100.0% to 0.0% (Table 5).
    • Evaluation results: LLM-as-a-Judge achieves a TPR of 65.22% and an FPR of 8.22% on TAP attack evaluation, outperforming the classifier and keyword matching (Table 1).
    • Authors' conclusion: ensemble attacks can improve the capability of existing black-box automated jailbreak attacks, and ensemble defenses can enhance robustness in fully black-box scenarios rather than only defending against specific attacks; the authors do not claim it is the ultimate solution, but that it should become the minimal test for new attack and defense methods.
Read originalarxiv.org