Abstract
Traditional automated red teaming for Large Language Models (LLMs) often relies on "one-shot" jailbreaking attempts, which fail to capture the interactive and strategic nature of human adversarial behavior. This paper introduces a novel framework that formalizes red teaming as a strategic, multi-turn dialogue optimized through Hierarchical Reinforcement Learning (HRL). By decomposing the attack into a high-level strategic policy and a low-level generation policy, the system effectively navigates the vast search space of natural language to uncover deep-seated vulnerabilities. Our approach achieves state-of-the-art results across major safety benchmarks, demonstrating significant robustness even against "context-aware" defenders that maintain conversation history. Notably, an agent trained on smaller models successfully transfers its strategic capabilities to attack closed-source models like GPT-4o with high success rates.
Introduction
As Large Language Models (LLMs) become increasingly integrated into critical infrastructure, ensuring their safety and robustness against adversarial attacks is paramount. Most current automated red teaming methods are "myopic," focusing on finding a single, static prompt to trigger a harmful response. However, real-world attackers are rarely so limited; they engage in multi-turn interactions, probing for weaknesses and strategically escalating the conversation to bypass safety filters.
Existing tools often struggle with this complexity, particularly when the target LLM is "context-aware"—meaning it remembers previous turns in the conversation. Many evaluation frameworks artificially simplify the problem by clearing the target's history between turns, leading to an overestimation of safety. This research addresses these gaps by treating red teaming as a long-term trajectory rather than a single-turn event.
Methodology: Hierarchical Reinforcement Learning for Red Teaming
The core of our approach is the formalization of the red teaming process as a Markov Decision Process (MDP). To solve this MDP, we employ a Hierarchical Reinforcement Learning (HRL) architecture. This hierarchy is designed to overcome the "sparse reward" problem inherent in long dialogues, where success is only determined at the end of the interaction.
The Hierarchical Architecture
The attacker agent is split into two distinct levels:
- High-Level Policy ($\pi_1$): Acting as the strategist, this policy analyzes the conversation history and selects a "strategic guide" or persona (e.g., "roleplay as a skeptical journalist"). This guide provides a high-level direction for the next turn.
- Low-Level Policy ($\pi_2$): This policy acts as the writer. Conditioned on the high-level guide, it generates the actual utterance token-by-token.
Token-Level Credit Assignment
A significant challenge in applying RL to text generation is identifying which specific tokens contribute most to a successful jailbreak. We introduce a token-level marginal contribution reward. By masking subsets of tokens and measuring the resulting change in the "harm score" (as determined by a guard model like LlamaGuard), the system can precisely assign credit to the most effective parts of an utterance.
Training and Optimization
The system is trained using Proximal Policy Optimization (PPO). The high-level policy learns to maximize long-term toxicity in the target's responses, while the low-level policy is optimized to produce harmful content that remains semantically aligned with the chosen strategic guide. This alignment prevents "mode collapse," a common issue where RL-tuned models produce gibberish to maximize rewards.
Experimental Setup
We evaluated the HRL framework against three major safety benchmarks:
- HarmBench: Measures functional capabilities in red teaming.
- WildBench: Contains prompts derived from real-world user interactions.
- JailbreakBench: Specifically designed to test adversarial robustness.
The attacker was tested against several target models, including Llama-3.1 (8B and 70B), Mistral-8x22B, and the closed-source GPT-4o.
Results and Discussion
Our HRL-based approach significantly outperformed existing state-of-the-art (SOTA) baselines across all metrics.
Attack Success Rates
On the HarmBench benchmark in a context-aware setting, our method achieved a 97.0% Attack Success Rate (ASR@30). In contrast, previous SOTA methods like Rainbow Teaming saw their performance drop to just 11.0% when the target model maintained conversation history. Even with a limited number of attempts (ASR@5), our method achieved a 75.2% success rate on myopic targets, nearly doubling the performance of the next best method, PAIR.
Strategic Transferability
One of the most striking findings is the transferability of the learned strategies. An agent trained against a relatively small 8B model was able to successfully "zero-shot" attack much larger and more sophisticated models. For instance, the agent achieved a 55.0% ASR against GPT-4o, highlighting that strategic vulnerabilities are often shared across different model families and scales.
Robustness to Context-Awareness
The results underscore a massive performance gap in existing tools when faced with context-aware defenders. By modeling red teaming as a trajectory, our HRL approach remains robust where others fail, as it learns to "set the stage" in early turns to facilitate a successful jailbreak later in the conversation.
Conclusion
This work demonstrates that strategic, multi-turn interactions are a critical frontier in LLM safety. By leveraging Hierarchical Reinforcement Learning, we can automate the discovery of complex vulnerabilities that single-turn methods miss. While the current method relies on a scalar reward function from a guard model, future work will explore multi-faceted definitions of harm and extend this framework to multi-modal red teaming and more general agentic tasks.
Summary updated