[Paper Review] Defending Large Language Models Against Jailbreaking Attacks Through Goal Prioritization
This paper proposes defending large language models (LLMs) against jailbreaking attacks by explicitly prioritizing safety over helpfulness through goal prioritization at both inference and training stages. It reduces attack success rates (ASR) from 66.4% to 2.0% for ChatGPT and from 68.2% to 19.4% for Vicuna-33B during inference, and achieves an ASR of just 6.6% for Llama2-13B when trained with goal prioritization, even without jailbreak data in training.
While significant attention has been dedicated to exploiting weaknesses in LLMs through jailbreaking attacks, there remains a paucity of effort in defending against these attacks. We point out a pivotal factor contributing to the success of jailbreaks: the intrinsic conflict between the goals of being helpful and ensuring safety. Accordingly, we propose to integrate goal prioritization at both training and inference stages to counteract. Implementing goal prioritization during inference substantially diminishes the Attack Success Rate (ASR) of jailbreaking from 66.4% to 3.6% for ChatGPT. And integrating goal prioritization into model training reduces the ASR from 71.0% to 6.6% for Llama2-13B. Remarkably, even in scenarios where no jailbreaking samples are included during training, our approach slashes the ASR by half. Additionally, our findings reveal that while stronger LLMs face greater safety risks, they also possess a greater capacity to be steered towards defending against such attacks, both because of their stronger ability in instruction following. Our work thus contributes to the comprehension of jailbreaking attacks and defenses, and sheds light on the relationship between LLMs' capability and safety. Our code is available at \url{https://github.com/thu-coai/JailbreakDefense_GoalPriority}.
Motivation & Objective
- To identify the root cause of jailbreaking attack success, which stems from the unresolved conflict between helpfulness and safety goals in LLMs.
- To address the lack of effective defenses against jailbreaking attacks despite advances in alignment techniques like SFT and RLHF.
- To develop a defense mechanism that explicitly prioritizes safety over helpfulness during both inference and training phases.
- To evaluate the generalization capability of the defense method on out-of-distribution (OOD) jailbreaking attacks, especially when no jailbreak prompts are used in training.
- To explore the relationship between LLM capability and safety, particularly whether more powerful models are more vulnerable or more defendable.
Proposed method
- A plug-and-play prompting strategy is designed to inject goal prioritization at inference time by pairing user queries with distinct goal instructions that emphasize safety over helpfulness.
- The method uses a two-stage prompting framework where the model is prompted to first identify the goal priority (safety > helpfulness) before generating a response.
- For training, the approach integrates goal prioritization by fine-tuning models on a mix of benign and harmful instructions, with explicit supervision to learn that safety takes precedence.
- The training data includes a controlled ratio of harmful queries (1%, 3%, 5%) to assess data efficiency and the impact of data diversity on defense performance.
- The defense mechanism is evaluated using Attack Success Rate (ASR) and Defense Success Rate (DSR) on both in-distribution and out-of-distribution jailbreaking prompts.
- The method is applied to multiple LLMs including ChatGPT, Vicuna, Llama2, and Alpaca, across both API-based and open-source models.
Experimental results
Research questions
- RQ1Why do standard alignment methods like SFT and RLHF fail to defend against jailbreaking attacks despite improving safety?
- RQ2Can explicit goal prioritization—making safety the primary objective—significantly reduce the success rate of jailbreaking attacks?
- RQ3How effective is goal prioritization when applied only at inference, without any model retraining?
- RQ4To what extent can goal prioritization improve generalization to unseen, out-of-distribution jailbreaking attacks?
- RQ5Does the capability of a model correlate with its vulnerability to jailbreaking, and can stronger models be more effectively steered toward safety?
Key findings
- The Attack Success Rate (ASR) for ChatGPT drops from 66.4% to 2.0% when goal prioritization is applied at inference, demonstrating a 97% reduction in jailbreak success.
- For Vicuna-33B, the ASR decreases from 68.2% to 19.4% under the same inference-time defense, showing strong robustness across different models.
- When trained with goal prioritization, Llama2-13B achieves an ASR of only 6.6%, compared to 71.0% with standard SFT, indicating a 90.7% reduction in vulnerability.
- Even without any jailbreak prompts in the training data, the method reduces ASR from 71.0% to 34.0%, showing that goal prioritization can be learned from simpler harmful instructions alone.
- The defense generalizes well to out-of-distribution (OOD) jailbreaking attacks: with no jailbreak prompts in training, the method improves Defense Success Rate (DSR) by 22.8% over aligned SFT and 30% over vanilla SFT.
- The method achieves better data efficiency: using only 1% harmful queries with goal prioritization yields a lower ASR than using 5% with aligned SFT, indicating superior data utilization.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.