Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks

Andy Zhou, Bo Li, Haohan Wang
2/3/2026

No official code found. Best implementation: lapisrocks/rpo (62 stars, last commit 2024-08-08).

Abstract

Despite advances in AI alignment, large language models (LLMs) remain vulnerable to adversarial attacks or jailbreaking, in which adversaries can modify prompts to induce unwanted behavior. While some defenses have been proposed, they have not been adapted to newly proposed attacks and more challenging threat models. To address this, we propose an optimization-based objective for defending LLMs against jailbreaking attacks and an algorithm, Robust Prompt Optimization (RPO) to create robust system-level defenses. Our approach directly incorporates the adversary into the defensive objective and optimizes a lightweight and transferable suffix, enabling RPO to adapt to worst-case adaptive attacks. Our theoretical and experimental results show improved robustness to both jailbreaks seen during optimization and unknown jailbreaks, reducing the attack success rate (ASR) on GPT-4 to 6% and Llama-2 to 0% on JailbreakBench, setting the state-of-the-art. Code can be found at https://github.com/lapisrocks/rpo

View on arXivView PDF

Code Implementations(1)

lapisrocks/rpoCommunity100%

Official repository for "Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks"

627Shell, PythonJan 29, 20242 years ago

Similar Papers

Cite this paper

@article{zhou2026robust,
  title  = {Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks},
  author = {Andy Zhou and Bo Li and Haohan Wang},
  year   = {2026},
  eprint = {2401.17263},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2401.17263},
  url    = {https://arxiv.org/abs/2401.17263},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2401.17263.svg)](https://codeofpaper.com/paper/2401.17263)

Discussion