When LLM Meets DRL: Advancing Jailbreaking Efficiency via DRL-guided Search

Xuan Chen, Yuzhou Nie, Wenbo Guo, Xiangyu Zhang · DOI

Introduction

The rapid integration of Large Language Models (LLMs) into various sectors has heightened concerns regarding their safety and alignment. "Jailbreaking"—the process of crafting adversarial prompts to bypass safety filters—remains a significant vulnerability. Existing automated jailbreaking techniques generally rely on either In-Context Learning (ICL) or Genetic Algorithms (GA). However, these methods often suffer from inefficiency: ICL lacks long-term strategic planning, and GAs rely on stochastic mutations that lack a directional understanding of the search space.

To address these limitations, this research introduces RLbreaker, a framework that treats jailbreaking as a guided search problem powered by Deep Reinforcement Learning (DRL). By training an agent to strategically select prompt mutations, RLbreaker achieves superior efficiency and success rates compared to current state-of-the-art (SOTA) methods.

The RLbreaker Framework

RLbreaker models the jailbreaking process as a Markov Decision Process (MDP), allowing an agent to learn an optimal policy for prompt refinement through sequential interaction.

1. Action Space and Mutators

Unlike token-level attacks that face an exponentially large search space, RLbreaker operates on a discrete action space of high-level mutators. The agent selects from five strategies: rephrase, crossover, generate_similar, shorten, and expand. These commands are executed by a "helper LLM" (such as GPT-3.5) to transform the current prompt into a new candidate.

2. State Representation

The state is represented by a low-dimensional embedding of the current prompt, generated using a pre-trained XLM-RoBERTa encoder. This allows the agent to perceive the semantic structure of the prompt before deciding which mutation strategy is most likely to succeed.

3. Dense Reward Function

A critical innovation in RLbreaker is its reward mechanism. Traditional jailbreak evaluators provide binary feedback (Success/Failure), which offers a sparse signal for learning. RLbreaker introduces a "dense" reward by comparing the target LLM’s response to a "reference" harmful answer generated by an unaligned (uncensored) model. By calculating the cosine similarity between these responses, the agent receives a "warmer/colder" signal at every step, facilitating faster convergence even before a complete jailbreak is achieved.

Experimental Evaluation

The framework was evaluated using AdvBench (520 harmful questions) and Max50 (a subset of the 50 most challenging questions). The agent was tested against various models, including Llama-2, Vicuna, and Mixtral-8x7B.

Effectiveness and Efficiency

RLbreaker consistently outperformed baselines such as PAIR, GCG, and GPTFUZZER. Notably, on Mixtral-8x7B-Instruct, RLbreaker achieved a 100% Attack Success Rate (ASR) according to GPT-Judge, significantly higher than the 72% achieved by AutoDAN.

In terms of efficiency, RLbreaker demonstrated a drastic reduction in time-to-success. On Llama2-70b, RLbreaker generated successful prompts in an average of 17.7 seconds, whereas AutoDAN required over 1,000 seconds. This efficiency stems from the agent's ability to avoid the "random walk" characteristic of genetic algorithms, utilizing a guided search that requires significantly fewer iterations to find a target.

Transferability and Resilience

The study found that an RLbreaker agent trained on one model (e.g., Llama-2) maintains high effectiveness when transferred to other models like Vicuna or Mixtral. This suggests that safety alignment across different LLMs may share common structural weaknesses. Furthermore, RLbreaker prompts proved resilient against common defenses like RAIN (decoding-time defense) and Perplexity filters, as the mutations result in more natural-looking text compared to the "gibberish" often produced by gradient-based attacks like GCG.

Discussion and Future Work

While RLbreaker represents a significant step forward, it has limitations. The reward function's reliance on a single reference answer can lead to false negatives if the target model provides a semantically distinct but equally harmful response. Future work could involve expanding the action space to include more diverse mutation strategies—such as character-level perturbations—and extending the framework to multi-modal models, such as Vision-Language Models (VLMs) and video generation models.

Conclusion

By shifting from stochastic search to DRL-guided strategic refinement, RLbreaker demonstrates that jailbreaking can be made significantly more efficient and effective. This research underscores the need for more robust safety alignment techniques that can withstand strategically optimized adversarial attacks.

Summary updated

BibTeX
@inproceedings{chen2024when,
  author = {Xuan Chen and Yuzhou Nie and Wenbo Guo and Xiangyu Zhang},
  title = {{When LLM Meets DRL: Advancing Jailbreaking Efficiency via DRL-guided Search}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=FfFcDNDNol},
}
Figure