Abstract: Ensuring the safety alignment of Large Language Models (LLMs) is critical for generating responses consistent with human values. However, LLMs remain vulnerable to jailbreaking attacks, where carefully crafted prompts manipulate them into producing toxic content. One category of such attacks reformulates the task as an optimization problem, aiming to elicit affirmative responses from the LLM. However, these methods heavily rely on predefined objectionable behaviors, limiting their effectiveness and adaptability to diverse harmful queries. In this study, we first identify why the vanilla target loss is suboptimal and then propose enhancements to the loss objective. We introduce DSN (Don’t Say No) attack, which combines a cosine decay schedule method with refusal suppression to achieve higher success rates. Extensive experiments demonstrate that DSN outperforms baseline attacks and achieves state-of-the-art attack success rates (ASR). DSN also shows strong universality and transferability to unseen datasets and black-box models.
Introduction
Safety alignment in Large Language Models (LLMs) aims to prevent the generation of harmful content. However, "jailbreaking"—the process of crafting prompts to bypass these safeguards—remains a persistent threat. Existing learning-based attacks, such as the popular Greedy Coordinate Gradient (GCG), typically optimize an adversarial suffix to maximize the probability of an affirmative prefix (e.g., "Sure, here is how to...").
A significant limitation of these methods is the Loss-ASR Mismatch. In many instances, a suffix might achieve a low loss during training but fail in practice because the LLM pivots to a refusal mid-sentence (e.g., "Sure, I can help... but actually, hacking is illegal"). This suggests that the standard loss objective is suboptimal because it averages importance across all tokens and ignores the predictable, constrained nature of refusal language.
The DSN Attack Methodology
We propose the DSN (Don’t Say No) attack, which shifts the focus from merely eliciting affirmative responses to actively suppressing refusal behaviors. DSN optimizes an adversarial suffix using a dual-objective loss function:
- Cosine Decay Weighting ($L_{affirmative}$): Instead of treating every token in the target response equally, DSN applies a cosine decay schedule. This places significantly higher weight on the initial tokens of the response. The intuition is that forcing the model into a strong affirmative "trajectory" at the very start makes the next-word prediction mechanism more likely to follow through with harmful content.
- Refusal Suppression ($L_{refusal}$): This core innovation utilizes an Unlikelihood Loss to explicitly minimize the probability of the model generating tokens from a predefined Refusal Keyword List (RKL), such as "I cannot," "sorry," or "unethical."
These two losses are combined ($L_{DSN} = L_{affirmative} + \alpha \cdot L_{refusal}$) and optimized using the GCG search algorithm to find a universal adversarial suffix.
Experimental Evaluation
We evaluated DSN across a diverse range of safety benchmarks, including AdvBench (AB), JailbreakBench (JB), Malicious Instruct (MI), CLAS 2024, and Forbidden Question (FQ). These datasets cover a wide spectrum of harmful intentions and violation categories.
Key Results and Insights
DSN demonstrates significant performance gains over existing baselines:
- Superior ASR: On Llama-2-7b-chat, DSN achieved success rates of nearly 100% on several benchmarks, significantly outperforming vanilla GCG.
- Universal & Transferable: Suffixes optimized on open-source models (like Llama-3) successfully transferred to proprietary black-box models. In multi-trial settings (ASR@10), DSN achieved success rates of 36% on GPT-4 and 22% on Claude.
- Resolving the Loss-ASR Mismatch: DSN effectively aligns the optimization objective with actual attack success. Suffixes with the lowest DSN loss consistently correspond to the highest actual attack success rates.
Discussion
Our findings highlight that refusal is predictable. Because LLMs tend to refuse using a small set of common phrases, it is mathematically more effective to steer the model away from these refusal clusters than to steer it toward a specific harmful output. Furthermore, the success of a jailbreak is disproportionately determined by the first few tokens; by forcing an affirmative mode early, safety filters are bypassed before they trigger.
While DSN requires white-box access for the initial optimization phase, its high transferability poses a serious challenge for closed-source model safety. Future work should explore more robust safety alignment that moves beyond keyword-based refusal to understand the underlying intent of queries.
Summary updated