Abstract
Traditional adversarial attacks on Large Language Models (LLMs) typically rely on rigid, human-engineered targets, such as forcing the model to begin a response with the phrase "Sure, here is...". This paper introduces a novel approach that replaces these brittle objectives with a flexible reinforcement learning framework. By optimizing for the semantic harmfulness of a response rather than a specific string, the proposed REINFORCE-based attack significantly improves success rates. Our method doubles the Attack Success Rate (ASR) on Llama 3 8B and effectively bypasses state-of-the-art "circuit breaker" defenses, demonstrating that current safety evaluations may significantly overestimate model robustness.
Introduction
As Large Language Models (LLMs) are increasingly integrated into critical infrastructure, ensuring their safety against adversarial prompts is paramount. Most existing white-box attacks, such as Greedy Coordinate Gradient (GCG), utilize a "fixed affirmative response" objective. These attacks attempt to find a prompt suffix that maximizes the likelihood of a specific prefix (e.g., "Sure, here is how to build a..."). However, this approach is increasingly ineffective against modern, well-aligned models.
This research identifies a critical flaw in fixed-target attacks: they are syntactically rigid and fail to account for the model's internal distribution. We propose a distributional and semantic objective rooted in reinforcement learning (RL), treating the adversarial attack as a policy optimization problem where the goal is to maximize the expected harmfulness of the model's output.
The Limitations of Fixed-Target Attacks
Modern alignment techniques have taught models to recognize and circumvent simple prefix-based attacks. A model might be forced to start with "Sure, here is..." but then immediately pivot to a refusal: "Sure, here is... why I cannot fulfill that request." This "stuttering" behavior allows the model to satisfy the mathematical objective of the attack without actually providing harmful content.
Furthermore, fixed targets do not adapt to the specific "personality" or linguistic preferences of the target model. If an attack fails to find the exact "Sure" prefix, it may incorrectly conclude the model is robust, even if the model would be willing to provide harmful information if prompted differently. This leads to a false sense of security and an overestimation of model safety.
Methodology: A Semantic RL Objective
To overcome these limitations, we shift the focus from syntax to semantics. We treat the LLM as a probabilistic policy and the adversarial prompt as the parameter to be optimized.
REINFORCE Framework
The core of our approach is the REINFORCE algorithm. Instead of forcing a specific string, we optimize the prompt to maximize the expected reward across the entire distribution of possible model responses. The reward signal is provided by an "LLM-as-a-Judge" (specifically Llama 2 13B), which evaluates the log-odds of a response being harmful.
Efficient Sampling and Optimization
To manage the computational cost of gradient estimation, we employ a strategic sampling approach. For each optimization step, we sample four types of responses:
- The Seed: An affirmative response prefix.
- Greedy Generation: The most likely path from the model.
- Random Sample: To encourage exploration of the model's response space.
- Best-so-far: The most harmful response discovered during the current optimization run.
To stabilize the optimization and reduce the high variance typical of policy gradient methods, we utilize the REINFORCE Leave-One-Out (RLOO) estimator. This objective was integrated into two prominent attack algorithms: GCG and Projected Gradient Descent (PGD).
Experimental Evaluation
We evaluated the REINFORCE-based attacks using HarmBench, a standardized benchmark for automated red teaming, focusing on 200 standard harmful behaviors. We tested the method against several state-of-the-art models, including Llama 3 8B and Gemma 1.1 7B, as well as models protected by "circuit breaker" defenses.
Key Results
The transition to a semantic objective yielded substantial improvements in Attack Success Rate (ASR):
- Llama 3 8B: ASR increased from 35% (standard GCG) to 73% (REINFORCE-GCG).
- Gemma 1.1 7B: ASR rose from 63% to 87%.
- Circuit Breaker Defenses: These defenses, specifically tuned to resist prefix-based attacks, proved highly vulnerable. On a Llama 3 model defended with circuit breakers, standard attacks achieved only a 2% success rate, while the REINFORCE attack reached 50%.
Discussion and Insights
The primary insight of this work is that the traditional "affirmative response" objective is essentially a biased, non-adaptive version of a reinforcement learning problem. By moving to a semantic reward, the attack can discover "backdoors" into harmful behavior that human engineers would not think to hard-code.
The failure of circuit breaker defenses is particularly noteworthy. These defenses appear to "overfit" to common attack styles (like the "Sure" prefix), leaving other harmful pathways open. Our results suggest that for a defense to be truly robust, it must be evaluated against adaptive, semantic objectives rather than fixed syntactic targets.
Limitations and Future Work
While effective, the REINFORCE attack has several limitations:
- Judge Dependency: The attack's efficacy is capped by the quality of the judge LLM. If the judge fails to recognize certain types of harm, the attack will be less effective.
- Computational Cost: Sampling multiple generations per optimization step is more resource-intensive than traditional cross-entropy attacks.
- White-Box Access: The current method requires access to model gradients. Future research should explore adapting this semantic objective to black-box (API-only) settings.
In conclusion, by optimizing for the distribution of harmful responses rather than a single fixed string, we provide a more accurate and rigorous assessment of LLM safety, revealing significant vulnerabilities in even the most advanced defended models.
Summary updated