TL;DR
Most white-box adversarial attacks on large language models (LLMs) force the model to output a specific predefined prefix (like "Sure, here is..."), which severely bottlenecks the optimization process. This paper introduces the Untargeted Jailbreak Attack (UJA), a method that abandons predefined targets in favor of maximizing an open-ended "unsafety probability" scored by a judge model. By decomposing this non-differentiable objective into two differentiable stages, UJA achieves over 80% attack success rates against modern aligned models in just 100 iterations.
What Problem Does This Paper Address?
Automated white-box jailbreaking techniques—such as Greedy Coordinate Gradient (GCG) or COLD-Attack—typically work by optimizing adversarial prompt suffixes to maximize the likelihood of a rigid target string (e.g., forcing the model to start its reply with an affirmative prefix).
The authors identify two fundamental flaws in this paradigm:
- Search Space Restriction: Forcing a specific prefix artificially narrows the search space. An aligned model might readily produce unsafe responses starting with other phrasing (e.g., Llama-3 tends to begin responses with "Here" rather than "Sure"), meaning the optimizer spends unnecessary compute trying to force an unnatural token sequence.
- Low Efficiency: Bridging the gap between an aligned model’s refusal distribution and an arbitrary, fixed affirmative string often demands thousands of optimization steps, leading to slow convergence and poor sample efficiency.
Methods
To remove the fixed-target constraint, UJA directly aims to maximize the unsafety probability of the output $\mathcal{P}(L(p))$ evaluated by a safety judge model $\mathcal{J}$. Because text decoding is discrete and non-differentiable, the authors decompose the global objective into two differentiable sub-problems:
-
Stage 1: Adversarial Response Optimization
Starting from the target LLM’s initial refusal response, UJA optimizes a continuous response representation $r^*$ in the embedding space of the judge model. It minimizes cross-entropy with the "Unsafe" class label while enforcing a cosine-similarity semantic consistency loss ($\mathcal{L}_{\text{semantic}}$) to ensure the generated text remains linguistically coherent and realizable within the target model's output distribution. -
Stage 2: Adversarial Prompt Optimization via Gradient Projection
Once an unsafe response target $r^*$ is identified, UJA searches for an input prompt $p^*$ that elicits it by minimizing the Mean Squared Error (MSE) between their logit representations. To bridge vocabulary and tokenizer differences between the judge model and the target LLM, UJA introduces a Gradient Projection Matrix ($W$) that maps gradients from the judge's token space into the target LLM's token space. -
Decoding: UJA leverages LLM-guided decoding (adapted from COLD-Attack) to convert continuous prompt logits back into fluent discrete tokens.
Datasets
The authors evaluate UJA using two standard adversarial benchmarks:
- AdvBench: A benchmark containing harmful queries across various misuse categories (100 prompts sampled).
- HarmBench: A standardized evaluation benchmark focused on functional red-teaming across illicit behaviors (100 prompts sampled).
- (In supplementary evaluation) StrongReject: Used to assess robustness via policy-based scoring and lightweight refusal classifiers.
Key Insights and Ideas
- Untargeted Optimization Expands Vulnerability Coverage: By optimizing for any unsafe response rather than a fixed phrase, the attack explores diverse semantic pathways. t-SNE visualizations of generated responses reveal that while fixed-target baselines form tight, repetitive clusters, UJA spans a wide variety of response formats.
- Cross-Tokenizer Gradient Transfer Works: Aligning vocabularies between a small judge model (like GPTFuzzer or RoBERTa) and a larger target LLM via a binary re-tokenization mapping matrix allows effective end-to-end gradient guidance across disparate model architectures.
- Alignment Often Dictates Phrasing, Not Just Safety: The difficulty in optimizing targeted attacks frequently stems from fighting the model's stylistic priors rather than its safety boundaries. Working with the target model's natural phrasing reduces the required optimization steps by orders of magnitude.
Key Results
- Attack Success Rate (ASR): Within a strict budget of only 100 iterations, UJA achieves an average ASR of 71.9% on AdvBench, outperforming the strongest baseline (COLD-Attack) by 23.5%. On Llama-3, UJA reaches 89.0% ASR-G (evaluated by GPTFuzzer) compared to 52.0% for COLD-Attack and 50.0% for GCG.
- Rapid Convergence & Low Cost: UJA reaches 64.0% ASR-G after just 25 iterations. Its computational cost per success (CS) is $0.033, matching COLD-Attack's cost while achieving significantly higher success rates (83.0% vs. 52.0% average ASR on Llama-3.1).
- Transferability: Prompts optimized on white-box models transfer effectively to advanced frontier models, achieving a 35.0% ASR on Llama-3-70B and 21.0% on DeepSeek-R1 within 100 iterations on AdvBench.
- Robustness to Defenses: Against standard defenses on Llama-3, UJA retains 97.0% ASR under Perplexity filtering, 60.0% under SmoothLLM, and 46.0% under Paraphrase filtering, outperforming all tested baselines.
Limitations and Future Work
- White-Box Access Requirement: Stage 2 requires access to the target LLM’s gradients and logits, limiting its direct execution against proprietary closed-source APIs (though transferability partially mitigates this).
- Dependence on Judge Quality: The effectiveness of Stage 1 relies on the surrogate judge model; an inaccurate or heavily biased judge could steer response optimization toward false positives.
- Future Work: The authors propose developing adaptive strategies to further bypass input preprocessing defenses (e.g., dynamic paraphrasing defenses) and exploring broader application to multimodal foundation models.
Summary updated