TASO : Jailbreak LLMs via Alternative Template and Suffix Optimization

Yanting Wang, Runpeng Geng, Jinghui Chen, Minhao Cheng, Jinyuan Jia · 2025

Read TASO : Jailbreak LLMs via Alternative Template and Suffix Optimization by Yanting Wang, Runpeng Geng, Jinghui Chen, Minhao Cheng, Jinyuan Jia (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2511-18581.txt.

Introduction

Yanting Wang, Runpeng Geng, Jinghui Chen, Minhao Cheng, and Jinyuan Jia present TASO, a jailbreak method that tunes two parts of an attack prompt in turns. Jailbreaks prod a language model to answer a harmful ask it should refuse. Past methods tune a sense carrying template or a suffix that forces a set opening, but each alone has a blind spot.

A suffix can steer the first few output words yet not the whole reply's quality. A template guides the full reply yet cannot lock the start. TASO swaps between the two, so each fix feeds the next round. The pair, the team argue, is stronger than either part alone. The study adds to the case for robust refusal tests.

Catalog record

CREATORYanting Wang, Runpeng Geng, Jinghui Chen, Minhao Cheng, Jinyuan Jia
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE78 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2511-18581

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

TASO : Jailbreak LLMs via Alternative Template and Suffix Optimization Yanting Wang, Runpeng Geng, Jinghui Chen, Minhao Cheng, Jinyuan Jia Abstract Many recent studies showed that LLMs are vulnerable to jailbreak attacks, where an attacker can perturb the input of an LLM to induce it to generate an output for a harmful question. In general, existing jailbreak techniques either optimize a semantic template intended to induce the LLM to produce harmful outputs or optimize a suffix that leads the LLM to initiate its response with specific tokens (e.g., “Sure”). In this work, we introduce TASO ( Template and Suffix Optimization ), a novel jailbreak method that optimizes both a template and a suffix in an alternating manner. Our insight is that suffix optimization and template optimization are complementary to each other: suffix optimization can effectively control the first few output tokens but cannot control the overall quality of the output, while template optimization provides guidance for the entire output but cannot effectively control the initial tokens, which significantly impact subsequent responses. Thus, they can be combined to improve the attack’s effectiveness. We evaluate the effectiveness of TASO on benchmark datasets (including HarmBench and AdvBench) on 24 leading LLMs (including models from the Llama family, OpenAI, and DeepSeek). The results demonstrate that TASO can effectively jailbreak existing LLMs. We hope our work can inspire future studies in exploring this direction. WARNING: This paper may contain offensive or harmful content. Figure 1 : Example of a jailbreak attack. The LLM initially refuses to respond when directly prompted with the harmful query. However, it provides a harmful answer when the user uses an optimized jailbreak prompt instead. 1 Introduction Large language models (LLMs) such as GPT-4 achiam2023gpt4 , Llama-3 touvron2023llama , and DeepSeek-V3 liu2024deepseek are widely deployed in the real world. However, many studies mazeika2024harmbench ; shen2024do_anything_now ; early1 ; early2 ; early3 ; chao2023pair ; zou2023gcg showed that they are vulnerable to jailbreak attacks. In particular, an attacker can craft or optimize an input prompt to induce an LLM to generate an output for a harmful query that it would otherwise refuse to answer, as illustrated in Figure 1 . Over the past few years, various jailbreak methods andriushchenko2024adaptive ; liu2023autodan ; liu2024autodan_turbo ; shen2024do_anything_now ; chao2023pair ; mehrotra2025tap ; zou2023gcg have been proposed. These techniques function as crucial red-teaming tools, proactively evaluating whether LLMs can operate safely in adversarial conditions. Early jailbreak methods shen2024do_anything_now ; wei2023how_fail ; early1 ; early2 ; early3 such as DAN (short for “doing anything now”) shen2024do_anything_now rely on manually crafted templates to jailbreak LLMs. However, these methods rely on human ingenuity and are not scalable in practice. In response, many automatic jailbreak methods zou2023gcg ; liao2024amplegcg ; nanogcg ; andriushchenko2024adaptive ; lapid2023open_seasame ; wen2023pez ; wallace2019uat ; guo2021gbda ; shin2020autoprompt ; sitawarin2024pal ; geisler2024pgd ; mangaokar2024prp ; acg ; jia2024i_gcg ; zhao2025probe ; li2024faster_gcg ; chao2023pair ; liu2023autodan ; liu2024autodan_turbo ; mehrotra2025tap ; yu2023gptfuzzer ; zeng2024pap ; perez2022redteaming ; wei2023ica ; allin ; wolf ; yao2024fuzzllm ; li2023deepinception ; disguise ; goal ; tian2023evil ; jin2024guard ; shah2023persona_modulation were proposed in past years. Existing automated jailbreak methods can be divided into two categories. The first category of methods zou2023gcg ; liao2024amplegcg ; nanogcg ; andriushchenko2024adaptive ; lapid2023open_seasame ; wen2023pez ; wallace2019uat ; guo2021gbda ; shin2020autoprompt ; sitawarin2024pal ; geisler2024pgd ; mangaokar2024prp ; acg ; jia2024i_gcg ; zhao2025probe ; li2024faster_gcg such as GCG zou2023gcg optimizes a suffix that is appended to the harmful query to make an LLM begin its response with particular tokens (e.g., “Sure, here’s”). The second category of methods chao2023pair ; liu2023autodan ; liu2024autodan_turbo ; mehrotra2025tap ; yu2023gptfuzzer ; zeng2024pap ; perez2022redteaming ; wei2023ica ; allin ; wolf ; yao2024fuzzllm ; li2023deepinception ; disguise ; goal ; tian2023evil ; jin2024guard ; shah2023persona_modulation optimizes a semantically meaningful template (or a jailbreak prompt) to induce an LLM to generate an output to a harmful query. For example, PAIR chao2023pair is an algorithm that uses an attacker LLM to automatically generate jailbreak templates with semantic meanings for a target LLM. It iteratively refines jailbreak prompts by having a judge LLM score the target’s responses, feeding the scores back to the attacker LLM to improve the jailbreak prompts. Limitation of existing suffix optimization methods: The first category of methods (which only optimize suffix) zou2023gcg ; liao2024amplegcg ; nanogcg ; andriushchenko2024adaptive ; lapid2023open_seasame ; wen2023pez ; wallace2019uat ; guo2021gbda ; shin2020autoprompt ; sitawarin2024pal ; geisler2024pgd ; mangaokar2024prp ; acg ; jia2024i_gcg ; zhao2025probe ; li2024faster_gcg suffers from the problem of target string overfitting . Specifically, suffix optimization methods (e.g., GCG zou2023gcg ) repeatedly update tokens in the suffix to minimize a loss function (e.g., the probability of outputting “Sure”). However, extensive optimization of the suffix in a large search space (exponential to the suffix length) using this loss function can lead to overfitting, which means that the LLM’s output can start with the target string (e.g., “Sure”) with high probability, but the overall quality of the output is low. Examples are shown in Figure 4 , where the LLM’s output could start with “Sure”, but then shift to texts irrelevant to the harmful query. As a result, although these methods can achieve high attack success rates (ASRs) for certain LLMs, they can be less effective for LLMs with strong safety alignment such as Llama-2 models, where ASRs of many GCG-based suffix optimization methods are lower than 50% on Llama-2 models on HarmBench dataset mazeika2024harmbench . Figure 2 : Example jailbreak prompt generated by template optimization and suffix optimization. Limitation of existing template optimization methods: Template optimization methods chao2023pair ; mehrotra2025tap ; yu2023gptfuzzer ; liu2023autodan ; liu2024autodan_turbo ; wei2023ica ; zeng2024pap ; allin ; wolf ; yao2024fuzzllm ; li2023deepinception ; disguise ; goal ; tian2023evil ; jin2024guard ; shah2023persona_modulation ; yong2023low_recourse aim to construct semantically meaningful text derived from the original query, with the goal of guiding the LLM into responding to harmful queries. Unlike suffix optimization methods, which primarily focus on initial tokens of the output, many template optimization methods are designed to improve the overall quality of the output, often evaluated by a judge LLM yu2023gptfuzzer ; chao2023pair ; mehrotra2025tap . Consequently, template optimization is more likely to generate self-consistent and high-quality outputs once the initial tokens successfully bypass the alignment constraints. However, due to the lack of gradient guidance mehrotra2025tap ; liu2023autodan ; liu2024autodan_turbo ; chao2023pair ; yu2023gptfuzzer ; wei2023ica ; zeng2024pap ; allin ; wolf ; yao2024fuzzllm ; li2023deepinception ; disguise ; goal ; tian2023evil ; jin2024guard ; shah2023persona_modulation ; yong2023low_recourse , the absence of an end-to-end loss function mehrotra2025tap ; liu2024autodan_turbo ; chao2023pair ; wei2023ica ; zeng2024pap ; wolf ; yao2024fuzzllm ; li2023deepinception ; disguise ; goal ; tian2023evil ; jin2024guard ; shah2023persona_modulation ; yong2023low_recourse , or the limited search space liu2023autodan ; yu2023gptfuzzer , these methods struggle to effectively control the generation of the initial tokens. As a result, the LLM is more likely to reject the query outright from the initial tokens. Our work: In this work, we propose TASO , a new jailbreak attack framework that performs template optimization and suffix optimization in an alternating manner. Suppose we have a target LLM f , a harmful query (e.g., “ How to use

Read the complete text