Skip to content

TAO-Attack: Advanced Optimization-based Jailbreak Attack for Large Language ModelsTAO-Attack: Toward Advanced Optimization-Based Jailbreak Attacks for Large Language Models

arXiv· arXiv:2603.03081· ICLR 2026· Zhi Xu, Jiaqi Li, Xiaotong Zhang, Hong Yu, Han Liu·Indexed by this site · 2026-10-12· Originally publishedAttacks

Quick read

Attacks

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

TAO-Attack optimizes jailbreak suffixes with a two-stage loss and DPTO; under fixed initialization, the ASR on Llama-2-7B-Chat is 92%.

Threat modelThe attacker appends an adversarial suffix after a harmful query and minimizes the loss using the target model's gradients or logits, to elicit a response judged as harmful. Section 4.2 is white-box optimization; Section 4.3 applies a universal suffix obtained on Vicuna-7B-1.5 directly to closed-source models. Success requires passing template refusal filtering, the GPT-4 Turbo harmfulness check, and manual review.

Questions
Optimization-based jailbreaks often still refuse after forcing a harmful prefix, or only generate pseudo-harmful continuations that fail harmfulness checks; selecting tokens by dot product also conflates direction and step size.
Methods
TAO-Attack first uses a refusal-aware loss to suppress refusal continuations; after Rouge-L reaches the threshold, it uses an effectiveness-aware loss to penalize the current pseudo-harmful continuation. DPTO first keeps candidates by cosine similarity with the negative gradient, then does temperature sampling by projected step size.
Experiments and results
Under fixed initialization, TAO ASR on Llama-2-7B-Chat is 92% with an average of 305 steps (Table 2). Transferred to GPT-3.5 Turbo it is 82%, and to GPT-4 Turbo 8% (Table 3). Under the standard setting it matches I-GCG at 100%.
Limitations and future work
Conclusion plans to extend to multi-turn and multimodal, and study how to guide defenses; the paper does not separately list method limitations. Experiments include open-source white-box, four types of closed-source transfer, and PAT, RPO, CAA, SCANS. The number of AdvBench subset items and human agreement are not reported.
Experimental setupLlama-2-7B-Chat、Vicuna-7B-v1.5 et al. · AdvBench、HarmBench et al. · ASR、Iterations
Evaluated models
Llama-2-7B-ChatVicuna-7B-v1.5Mistral-7B-Instruct-0.2Qwen2.5-7B-InstructQwen2.5-VL-7B-InstructLlama-2-13B-ChatVicuna-13BQwen3-8BGPT-3.5 TurboGPT-4 TurboGemini 1.5 (Flash)Gemini 2 (Flash)
Benchmarks
AdvBenchHarmBenchMM-SafetyBench自建 information extraction 查询自建 influence operations 查询
Metrics
ASRIterations
AI summaryThe researchers propose TAO-Attack, an optimization-based jailbreak attack method, and the paper reports higher attack success rates than existing methods on multiple large language models, reaching 100% in some scenarios. The method uses a two-stage loss function: the first stage suppresses refusal and makes the model continue the harmful prefix, while the second stage penalizes pseudo-harmful outputs and guides the model to generate more harmful continuations. The authors also design a direction-prioritized token optimization (DPTO) strategy that aligns candidates with gradient direction before considering update magnitude, to improve optimization efficiency. The paper states that existing optimization-based attacks often suffer from frequent refusals, pseudo-harmful outputs, and inefficient token-level updates.

The researchers propose TAO-Attack, an optimization-based jailbreak attack method, and the paper reports higher attack success rates than existing methods on multiple large language models, reaching 100% in some scenarios. The method uses a two-stage loss function: the first stage suppresses refusal and makes the model continue the harmful prefix, while the second stage penalizes pseudo-harmful outputs and guides the model to generate more harmful continuations. The authors also design a direction-prioritized token optimization (DPTO) strategy that aligns candidates with gradient direction before considering update magnitude, to improve optimization efficiency. The paper states that existing optimization-based attacks often suffer from frequent refusals, pseudo-harmful outputs, and inefficient token-level updates.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Optimization-based jailbreaks often leave behind refusals or pseudo-harmful outputs; TAO-Attack improves suffix optimization with a two-stage loss and DPTO.

    Optimization-based jailbreaks often stop at refusal residue or pseudo-harmful outputs, and selecting tokens by dot product easily deviates from the gradient direction.

    • Scenario: The authors state that models such as Llama, Mistral, and Vicuna progress quickly but can still be jailbroken: appending a prefix or suffix after a harmful query bypasses safety alignment and elicits unsafe responses. The authors believe understanding such attacks helps analyze vulnerabilities and improve alignment.
    • Existing shortcomings: Manual prompts rely on experts and are hard to scale; generating prompts with attack models depends on the attack model's capability. Optimization-based methods use gradients or logits to automatically search suffixes; the authors state success rates are usually higher, but they still frequently refuse, produce pseudo-harmful outputs, and token-level updates are suboptimal.
    • Specific gaps: In Figure 1, GCG and MAC may still refuse after optimizing a fixed harmful prefix; I-GCG reduces refusals, but the authors state the outputs are often pseudo-harmful text that fails the evaluation LLM. The authors also believe that directly inducing the model to admit harm conflicts with the safety alignment objective; all three rank tokens only by the dot product of gradient and embedding, and high-scoring tokens may still deviate from the negative gradient direction.
    • Approach: Propose TAO-Attack. A two-stage loss first suppresses refusals, then penalizes pseudo-harmful continuations; direction-prioritized token optimization (DPTO) first aligns with the gradient direction, then considers update magnitude.
    • Threat model:
      • Goal: For a malicious query xQ, optimize a suffix xS so that the model generates the target harmful prefix xT and continues to write content judged as truly harmful, not pseudo-harmful.
      • Knowledge: The main experiments use the target model's gradients or logits; Section 4.2 is titled white-box. Closed-source experiments do not continue optimizing on the target model; they only test the obtained suffix.
      • Capability: Automatically update suffix tokens without manually crafting prompts. The standard setting uses easy-to-hard initialization; strict comparison uses a fixed symbol string.
      • Victim system: Aligned open-source chat models; the transfer setting also includes closed-source GPT and Gemini series models.
  2. What related research exists?

    Related work is divided into three categories: manual, attack-model generation, and optimization; the authors place the gap in refusal residue and token selection.

    Manually designed jailbreaks

    • Liu et al. (2023c): Handcrafted jailbreak prompts can bypass ChatGPT in various scenarios, and the prompts are increasingly complex.
    • Shen et al. (2024): Collected over 1,400 in-the-wild jailbreak prompts. The paper claims this is the first large-scale study of such prompts and states that defenses at the time were ineffective against many of these examples.
    • Paper's criticism: These methods require significant human effort and domain knowledge, are hard to scale, and are not well suited for systematic red teaming. The introduction also categorizes Kang et al. (2024) into this group, but the main text does not elaborate on their approach.

    Generating prompts with attack models

    • Perez et al. (2022): Attack LLMs to generate harmful tests, with classifiers evaluating target responses.
    • PAIR and TAP: PAIR (Chao et al., 2025) repeatedly queries and rewrites candidates; TAP (Mehrotra et al., 2024) organizes candidates into a tree and prunes unlikely branches to reduce queries.
    • AdvPrompter and AmpleGCG: AdvPrompter (Paulus et al., 2024) trains an attack model to generate natural adversarial suffixes that preserve query meaning; AmpleGCG (Liao & Sun, 2024) learns the distribution of successful suffixes to quickly generate transferable prompts. The paper says these methods reduce human effort but rely on the capability and diversity of the attack model. The introduction also names Takemoto (2024), Deng et al. (2023), and Lee et al. (2023), without elaborating on their approaches.

    Optimization-based jailbreaks

    • GCG (Zou et al., 2023): Greedy and gradient-based search, maximizing the likelihood of a harmful prefix; suffixes transfer to open-source and closed-source models.
    • AutoDAN (Liu et al., 2024a): Hierarchical genetic algorithm that gradually evolves prompts, making jailbreaks semantically readable, stealthy, and cross-model transferable.
    • MAC and I-GCG: MAC (Zhang & Wei, 2025) adds momentum to gradient search to stabilize optimization and speed up token selection. I-GCG (Jia et al., 2025) uses diverse harmful target templates and adaptive multi-coordinate updates. The paper says optimization methods reduce manual effort and have higher success rates than the previous two categories, but still face issues such as efficiency, refusals due to safety alignment, and inefficient token selection.

    Baselines and benchmarks

    • Baselines: GCG, MAC, AutoDAN, Probe-Sampling (Zhao et al., 2024), AmpleGCG, AdvPrompter, PAIR, TAP, I-GCG. Main results use harmful behaviors from AdvBench, and follow I-GCG's deduplicated subset. The appendix also uses HarmBench, MM-SafetyBench, and self-constructed information extraction and influence operation queries.

    The authors place this paper in the optimization category: using a two-stage loss to handle refusals and pseudo-harmful outputs, and using DPTO to separate direction alignment from step size. The introduction also states the method is inspired by black-box text adversarial attacks (Ye et al., 2022; Liu et al., 2023a;b), but no experimental comparison with them is made.

  3. How does the paper address this problem?

    TAO-Attack first suppresses refusals, then penalizes pseudo-harmful continuations; DPTO first aligns with the negative gradient, then samples by projected step size.

    TAO-Attack formulates jailbreaking as discrete optimization over a suffix: a suffix is appended after a malicious query, a two-stage loss is used alternately, and DPTO selects the tokens to update.

    Problem Setting

    • Each token of the sequence x1:n belongs to a vocabulary of size V. The probability of a response of length G is the product of per-token conditional probabilities.
    • The malicious query is xQ, the adversarial suffix is xS, and the prompt is their concatenation. The standard loss is the negative log conditional probability of the target harmful prefix xT. Generating a suffix is equivalent to minimizing this loss over a suffix of length m.
    • GCG selects, at each step, the candidate with the largest dot product between the gradient and the embedding difference. The authors argue this has two shortcomings: the fixed template xT often leaves refusals or pseudo-harmful outputs; the dot product conflates direction alignment with step size.

    Two-Stage Loss

    • Stage One, refusal-aware: Query the model with xQ plus a random suffix, collect a set of refusals R, K entries in total. Instead of optimizing all refusals at once, optimize the current rj one at a time until the convergence criterion in Appendix A.1, then move to the next. The loss is

    L1(j)(xQ ⊕ xS)=−log p(xT|xQ ⊕ xS)+α·log p(rj|xQ ⊕ xS ⊕ xT) α>0; the first term raises the probability of the harmful prefix, the second lowers the probability of that refusal appearing after the prefix.

    • Stage Two, effectiveness-aware: The authors state that the attacker does not know the true harmful answer in advance and cannot directly maximize a particular annotated continuation. The model may still repeat the prefix but fail an LLM-based harmfulness check. The output is split into x'1_T, of the same length as xT, and the remaining continuation xO. When Rouge-L(x'1_T, xT)≥τ, use

    L2(xQ ⊕ xS)=−log p(xT|xQ ⊕ xS)+β·log p(xO|xQ ⊕ xS ⊕ x′T) β>0. Penalize the currently observed undesirable continuation xO, pushing the optimization away from that trajectory.

    • Switching: Start with L1; after Rouge-L reaches τ, switch to L2; if refusal-like content appears for N consecutive steps under L2, return to L1. Convergence compares the average loss of two adjacent windows, window w=5, absolute difference below μ=1.5×10^{-3} (Appendix A.1). Algorithm 1 gives the procedure of selecting the loss, computing the gradient, sampling, and taking the candidate with the lowest loss each round.

    DPTO

    • For suffix position i, gi is the loss gradient on the current token embedding, and the displacement for candidate v is the embedding difference. First compute the cosine similarity between the displacement and the negative gradient, mask the current token and special symbols, and keep the top-k with the highest similarity.
    • Figure 2 is labeled with loss contours 0.8, 0.5, 0.2. The caption states that GCG may select ej, which deviates from the negative gradient due to a larger step size, whereas this paper selects el, which is both aligned with the negative gradient and has sufficient step size.
    • On the filtered set, compute the projected step size along the negative gradient, then sample via softmax with temperature γ. Each round, a candidate changes only one position; the suffix with the lowest loss is taken from the pool into the next step. Appendix A.2 discusses the expected decrease under an embedding smoothness assumption, and the trade-off among temperature, number of candidates, and alignment lower bound.

    Implementation and Success Determination

    • Suffix length 20 tokens, batch size 256, top-k 256. Each refusal is at most 20 words, and the continuation xO is at most 50 words. K=3, τ=1.0, N=3, α=0.2, β=0.2, γ=0.5.
    • Follow easy-to-hard: first optimize 1,000 steps on one simple harmful query to obtain an initial suffix, then use it for the remaining prompts, 500 steps each. Strict comparison does not use this initialization.
    • Determination has three steps (Appendix A.4): template matching for refusals; GPT-4 Turbo harmfulness check per Figure 4; then manual review of samples that pass that check. Figure 4 requires the instance to be explicit and non-minimal, and the generation itself to be harmful or unsuitable as public-facing output; when code is involved, it must contain a code artifact, not only comments or explanations.
  4. What experiments did the paper conduct?

    Under fixed initialization, TAO-Attack achieves an ASR of 92% on Llama-2-7B-Chat with an average of 305 iterations (Table 2).

    Experimental Setup

    • Tested models: White-box includes Llama-2-7B-Chat, Vicuna-7B-v1.5, Mistral-7B-Instruct-0.2, Qwen2.5-7B-Instruct, Qwen2.5-VL-7B-Instruct, Llama-2-13B-Chat, Vicuna-13B, Qwen3-8B. Transfer targets are GPT-3.5 Turbo, GPT-4 Turbo, Gemini 1.5 (Flash), Gemini 2 (Flash). GPT-4 Turbo is also used for harmfulness checking.
    • Data: I-GCG subset of AdvBench harmful behaviors; the paper does not give the number of examples. Ablations use the first 20 AdvBench items outside that subset. Transfer uses the last 25 items of the subset to optimize a universal suffix, then tests on the full set. Also HarmBench behaviors first 20 items, five categories from MM-SafetyBench, and self-built information extraction and influence operation queries of 20 each; 13B experiments use the first 15 AdvBench items.
    • Baselines: GCG, MAC, AutoDAN, Probe-Sampling, AmpleGCG, AdvPrompter, PAIR, TAP, I-GCG, implemented with their recommended hyperparameters. In Table 1, AdvPrompter numbers marked with * are taken from the original paper.
    • Metrics: ASR. Iterations is the average optimization steps to complete the attack across all samples (including failures).
    • Review: Template filtering, GPT-4 Turbo check, human review. Section 4.1 states this pipeline reduces false positives; Appendix A.4 states human review is to avoid possible false negatives. The paper does not report human sample size, agreement, or repetitions.
    • Budget and hardware: Suffix 20 tokens, batch and top-k both 256. Standard setting 500 steps per sample; fixed initialization comparison up to 1,000 steps per sample. Single NVIDIA A800 (80GB).

    Main Results

    Table 2: Same fixed suffix initialization, up to 1,000 steps per sample, compared with I-GCG.

    Swipe horizontally to read the table

    ModelTAO ASRTAO IterationsI-GCG ASRI-GCG Iterations
    Llama-2-7B-Chat92%30568%604
    Mistral-7B-Instruct-0.2100%8680%406
    Qwen2.5-7B-Instruct100%21100%66
    • The authors state that this setting removes easy-to-hard, and the advantage comes from the optimization itself. The authors state that iteration cost is halved on Llama-2-7B-Chat; the table corresponds to 604 and 305.
    • Table 1 standard setting: TAO-Attack and I-GCG both achieve 100% ASR on Vicuna-7B-1.5, Llama-2-7B-chat, and Mistral-7B-Instruct-0.2. The authors state that I-GCG is saturated, so this table cannot sufficiently distinguish the two.
    • Other baselines in the same table on Llama-2-7B-chat: TAP 4%, PAIR 10%, AdvPrompter 24%, AutoDAN 26%, AmpleGCG 28%, GCG 54%, MAC and Probe-Sampling 56%. On Mistral, AmpleGCG is not reported, AdvPrompter is 74%.

    Closed-source Transfer

    • On Vicuna-7B-1.5, optimize a universal suffix with the last 25 items, 500 steps, then attack the full set. Decoding temperature 0, max tokens 256.
    • Table 3: TAO-Attack ASR on GPT-3.5 Turbo is 82% (GCG and I-GCG both 30%); GPT-4 Turbo 8% (both 0%); Gemini 1.5 6% (GCG 4%, I-GCG 0%); Gemini 2 4% (GCG 0%, I-GCG 4%).
    • The authors state that suffixes transfer better to unseen models, but absolute values remain low except for GPT-3.5 Turbo. On Gemini 2, TAO-Attack and I-GCG are both 4%. Figure 5 gives examples on OpenRouter, not reproduced here.

    Component Ablations

    • Section 4.4, Table 4: First 20 AdvBench items outside I-GCG set, fixed exclamation suffix, Llama-2-7B-Chat, 1,000 steps per sample.
    • GCG with harmful guidance is 55%, 702 steps; GCG (Softmax) is 55%, 687 steps. The authors state the benefit is not from softmax. DPTO with harmful guidance is 65%, 620 steps. Removing harmful guidance, Stage One plus DPTO is 100%, 261 steps; adding Stage Two gives 100%, 243 steps. Figure 3 compares average loss and standard deviation over the first 500 steps for samples where both succeed; the authors state DPTO decreases faster with lower variance; the text does not give curve endpoints.
    • Appendix A.13, Table 16, same setting: adding the harmful guidance prefix back to TAO-Attack gives 65%, 716 steps; adding multi-coordinate updates gives 85%, 325 steps. The authors believe the former conflicts with safety alignment objectives, and the latter easily deviates from the trajectory during two-stage switching. Appendix A.11, Table 14: DPTO applied to GCG, ASR from 55% to 65%, iterations from 702 to 620; applied to I-GCG, from 65%, 582 to 75%, 496.

    Defenses, Generalization, and Overhead

    • Appendix A.6, Table 8: Against PAT, I-GCG is 60%, 257 steps, TAO-Attack is 80%, 138 steps; against RPO, I-GCG is 86%, 133 steps, TAO-Attack is 92%, 71 steps. The paper does not specify the target models for these two.
    • Table 9 uses the universal suffix from Section 4.3 to attack Llama-2-7B-Chat. CAA reports the probability of choosing safe option B; the authors state lower is stronger attack: Original 99%, I-GCG 90%, TAO-Attack 41%. SCANS reports refusal rate; the authors state lower indicates more effective jailbreak: Original 94%, I-GCG 4%, TAO-Attack 0%.
    • Table 6: On first 20 HarmBench items, Llama-2-7B-Chat TAO-Attack is 90%, 357 steps, I-GCG is 45%, 792 steps; Qwen2.5-7B-Instruct both 100% ASR, iterations 11 vs 26. On MM-SafetyBench, Qwen2.5-VL-7B-Instruct is 95%, 132 steps, I-GCG is 90%, 248 steps. The authors state generalization on both text and multimodal data. Table 7: Same query, 20 steps, batch 256, peak memory I-GCG 32.99 GB, Stage One 34.80 GB, Stage Two 35.99 GB, per-step times 5.7, 6.1, 7.1 seconds. The authors state per-step overhead increases slightly, but total computation is lower due to fewer iterations.

    Other Ablations and Analyses

    • Table 5, Llama-2-7B-Chat: threshold 1.0, Rouge-L is 100%, 243 steps, Qwen3-Embedding-0.6B is 100%, 263 steps; threshold 0.8, embedding similarity is 95%, 325 steps, Rouge-L is 100%, 262 steps.
    • Table 10, same 20 items: τ and β sweep ASR is 100%; α=0.1 or 0.3, γ=0.4 or 0.6 gives ASR 95%. Default α=0.2, γ=0.5 is 100%, 243 steps.
    • Table 12, three symbolic suffixes: TAO-Attack ASR 95%, 90%, 100%, I-GCG 65%, 60%, 65%; on hash suffix, TAO-Attack is 90%, 326 steps.
    • Table 13: K=1, Llama-2-7B-Chat is 95%, 242 steps; K=3 is 100%, 243 steps; K=7 is 90%, 360 steps. Vicuna-7B-v1.5 is 100% for K=1 to 7. The authors state K=1 coverage is insufficient, K=3 or 5 is more stable, and further increases are not necessarily better.
    • Table 15, first 15 AdvBench items, up to 1,000 steps: Llama-2-13B-Chat TAO-Attack is 67%, 569 steps, I-GCG is 53%, 704 steps; Vicuna-13B TAO-Attack is 100%, 82 steps, I-GCG is 73%, 600 steps.
    • Table 17, Qwen3-8B, HarmBench: non-reasoning mode both 100% ASR, iterations 39 vs 49; reasoning mode both 90%, iterations 79 vs 92. Table 11, Qwen2.5-7B-Instruct on information extraction and influence operations both 100% ASR, TAO-Attack iterations 29 and 9.
  5. What are some points that can be further explored?

    The authors do not separately list method limitations; the Conclusion plans to extend to multi-turn and multimodal, and to study defenses accordingly.

    Limitations and Future Directions Noted by the Authors

    • The paper has no dedicated Limitations section, and does not frame any experimental result as a method limitation in the Discussion, Conclusion, or appendix.
    • The Conclusion states future work will explore the multi-turn setting.
    • The Conclusion states future work will explore the multimodal setting.
    • The Conclusion states future work will study how this paper's analysis can guide defense design.

    Experimental Coverage

    • White-box ASR is reported for Llama-2-7B-Chat, Vicuna-7B-v1.5, and Mistral-7B-Instruct-0.2 (Table 1), and under fixed initialization also Qwen2.5-7B-Instruct (Table 2); the appendix also includes Llama-2-13B-Chat, Vicuna-13B, Qwen3-8B, and Qwen2.5-VL-7B-Instruct.
    • Transfer suffixes are optimized on Vicuna-7B-1.5 with 25 prompts and 500 steps, and tested on GPT-3.5 Turbo, GPT-4 Turbo, Gemini 1.5 (Flash), and Gemini 2 (Flash) (Section 4.3, Table 3).
    • Defense results include PAT, RPO (Table 8, the paper does not state the target model) and CAA, SCANS on Llama-2-7B-Chat (Table 9).
    • Data includes the I-GCG subset of AdvBench, the first 20 HarmBench behaviors, five categories of MM-SafetyBench, and 20 prompts each for information extraction and influence operations. The paper does not report the number of prompts in that AdvBench subset, nor the manual review sample size, agreement, or number of experimental repetitions.
    • Section 4.1 states the suffix is 20 tokens, top-k and batch are both 256, the standard setting is 500 steps per prompt, and the fixed-initialization comparison is at most 1,000 steps. The AdvPrompter numbers in Table 1 are taken from the original paper, and AmpleGCG on Mistral is unreported.
  6. Summarize the main content of the paper

    TAO-Attack uses a two-stage loss and DPTO for suffix optimization, outperforming I-GCG on Table 2, but the absolute values for closed-source transfer remain low.

    TAO-Attack is a jailbreak method that optimizes adversarial suffixes, targeting refusal residue, pseudo-harmful continuations, and the entanglement of direction and step size when selecting tokens by dot product in gradient-guided attacks.

    • White-box experiments minimize the loss directly on the target model; closed-source experiments only test the universal suffix optimized on Vicuna-7B-1.5. Success requires template refusal filtering, GPT-4 Turbo harmfulness checking, and manual review.
    • Stage one raises the probability of the harmful prefix and lowers the probability of collected refusals; after Rouge-L reaches the threshold, stage two penalizes the current undesirable continuation. DPTO first keeps candidates by cosine similarity with the negative gradient, then does temperature sampling by projected step size.
    • Under the standard AdvBench setting, it achieves 100% ASR with I-GCG on three open-source models (Table 1). Without easy-to-hard, with at most 1,000 steps per prompt, Llama-2-7B-Chat is 92% in 305 steps, Mistral-7B-Instruct-0.2 is 100% in 86 steps, and Qwen2.5-7B-Instruct is 100% in 21 steps (Table 2).
    • The same class of suffixes transfers to GPT-3.5 Turbo at 82%, GPT-4 Turbo at 8%, Gemini 1.5 at 6%, and Gemini 2 at 4%; on Gemini 2 it matches I-GCG (Table 3).
    • The authors state the method improves attack success rate, reduces optimization steps, transfers better, and still produces stronger attacks against PAT, RPO, CAA, and SCANS; they also believe current alignment remains vulnerable to optimization-based jailbreaks and needs more principled defenses. Future work in the Conclusion is multi-turn, multimodal, and using this paper's analysis to guide defenses.

Related papers

Show 3 more papers
Read originalICLR 2026