Skip to main content
QUICK REVIEW

[Paper Review] Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks

Andy Zhou, Bo Li|arXiv (Cornell University)|Jan 30, 2024
Adversarial Robustness in Machine LearningComputer Science5 citations
TL;DR

This paper formalizes a minimax defense objective and introduces Robust Prompt Optimization (RPO), a gradient-based token-suffix method that defends LMs against jailbreaking with a universal, transferable suffix achieving state-of-the-art robustness.

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

Motivation & Objective

  • Formalize a realistic adversarial threat model for LM jailbreaking.
  • Propose a minimax defense objective specific to prompt-level defenses.
  • Introduce Robust Prompt Optimization (RPO) to optimize defensive suffix tokens.
  • Demonstrate universal, transferable robustness with minimal impact on benign use.

Proposed method

  • Formulate a worst-case adversarial objective for jailbreaking with gradient-access and black-box prompts.
  • Develop RPO, which alternates between a jailbreak selection step and a discrete token-suffix optimization step.
  • Use a greedy coordinate descent with first-order gradients to identify top-k defensive tokens.
  • Apply a suffix optimization that minimizes the safe loss under worst-case adversarial prompts.
  • Demonstrate transferability of RPOsuffix to black-box models and other LMs.
  • Evaluate against multiple known and unknown jailbreaks, including adaptive attacks.
Figure 1: RPO optimizes a set of trigger tokens that enforces safe outputs even under jailbreaks and adversarial attacks. RPO suffixes are universal and transfer to many LMs and jailbreaks.
Figure 1: RPO optimizes a set of trigger tokens that enforces safe outputs even under jailbreaks and adversarial attacks. RPO suffixes are universal and transfer to many LMs and jailbreaks.

Experimental results

Research questions

  • RQ1Can a defensively optimized suffix generalize to unseen jailbreaks and adaptive attacks?
  • RQ2Does RPO transfer across models, including black-box settings like GPT-4?
  • RQ3What are the practical costs (inference impact) of applying RPO suffixes?
  • RQ4How does RPO perform relative to prior defenses across manual and gradient-based jailbreaks?

Key findings

  • RPO reduces Starling-7B attack success from 84% to 8.66% on 20 jailbreaks (unknown/offline tests).
  • RPO suffix transfers to GPT-4, lowering GUARD attack success from 92% to 6%.
  • RPO suffix incurs negligible inference cost and has only minor impact on benign prompts.
  • RPO outperforms strong baselines (perplexity filter, goal prioritization) on unseen jailbreaks and adaptive attacks.
  • RPO demonstrates transferability to Llama-2 and Vicuna family models, with notable gains on open-source LMs.
Figure 2: Overall performance on RPO and SOTA universal defense (Zhang et al., 2023 ) on a variety of strong, unseen jailbreaks. Base model is Starling-7B (Zhu et al., 2023a ) . We evaluate a single RPO suffix on the top 10 strongest jailbreaks from jailbreakchat.com and (Wei et al., 2023 ) for a to
Figure 2: Overall performance on RPO and SOTA universal defense (Zhang et al., 2023 ) on a variety of strong, unseen jailbreaks. Base model is Starling-7B (Zhu et al., 2023a ) . We evaluate a single RPO suffix on the top 10 strongest jailbreaks from jailbreakchat.com and (Wei et al., 2023 ) for a to

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.