Introduction
Large Language Models (LLMs) are typically aligned using Direct Preference Optimization (DPO), which teaches the model to prefer a "safe" response over a "harmful" one. However, researchers from UC Berkeley have identified fundamental flaws in this approach. DPO's loss function causes it to stop learning once a safe response is even slightly more probable than a harmful one, leading to "shallow" alignment. Furthermore, it fails significantly against prefilling attacks, where an attacker forces the AI to start its response with a harmful fragment (e.g., "Step 1: Gather the virus..."). Because DPO-trained models aren't exposed to these "partial-unsafe" trajectories during training, they often continue the harmful generation instead of course-correcting.
To address this, the researchers propose DOOR (Dual-Objective Optimization for Refusal), a framework that actively trains models to "catch themselves" mid-sentence and pivot to a refusal, while simultaneously unlearning harmful knowledge.
The DOOR Framework
The authors introduce a two-pronged approach to disentangle and improve the alignment objectives:
- Robust Refusal Training: This component uses data augmentation to simulate jailbreaks. By prepending harmful prefixes to safe refusal responses during training, the model learns to "snap back" to a refusal even if the conversation has already been forced into an unsafe direction.
- Targeted Unlearning: Instead of merely preferring safe over harmful outputs, DOOR utilizes Negative Preference Optimization (NPO) to actively decrease the probability of harmful knowledge ever being triggered, effectively "unlearning" the bad behavior.
The researchers further enhance this framework with W-DOOR (Weighted DOOR). This advanced method incorporates a reward-based mechanism to identify "critical refusal tokens" (such as "Sorry" or "However"). By assigning higher token-level weights to these pivotal moments, the model learns to prioritize the crucial transition from a harmful context back to a safe refusal.
Experimental Setup
The study utilizes several key benchmarks for a comprehensive evaluation:
- Training Data: A mix of SORRY-Bench and HEx-PHI for safety alignment, combined with Alpaca to ensure the model retains its general utility.
- Safety Evaluation: Models were tested against single-turn attacks (SORRY-Bench), multi-turn attacks (Crescendo), and automated adversarial attacks (HarmBench, including GCG and AutoDAN).
- Utility & Over-refusal: General intelligence was measured using MMLU and HellaSwag, while XSTest was used to check if the model became "too safe" by refusing harmless questions.
Key Results
The improvements over standard DPO are stark, particularly in defending against prefilling attacks.
- Prefilling Robustness: As shown in the evaluation, the Attack Success Rate (ASR) for prefilling attacks dropped dramatically. On Llama-3-8B, standard DPO yielded an ASR of roughly 21%, while W-DOOR reduced it to just 3.4%. W-DOOR consistently maintained near-zero ASR across varying prefill lengths.
- Generalization: W-DOOR remained the most robust defense even against sophisticated, automated attacks like GCG and AutoDAN, outperforming other specialized defenses.
- Utility Retention: Unlike naive unlearning methods like Gradient Ascent (which often break the model's general capabilities), W-DOOR preserved general utility, maintaining high scores on benchmarks like MMLU and HellaSwag.
- Reduced Over-refusal: Interestingly, extended training with W-DOOR actually decreased over-refusal rates, suggesting the model developed a more nuanced ability to distinguish truly harmful prompts from benign ones.
Limitations and Future Directions
While DOOR significantly advances LLM safety alignment, the authors note areas for future exploration. Multi-turn attacks remain challenging, as they exploit long-context reasoning that is inherently difficult to defend against. Additionally, the token-level weighting parameter ($\tau$) in W-DOOR currently requires manual tuning; automating this optimization could make the method more accessible. Finally, exploring more sophisticated, semantically targeted data augmentation strategies could further harden models against adversarial exploits.
Summary updated