Lifelong Safety Alignment for Language Models

Haoyu Wang, Zeyu Qin, Yifei Zhao, Chao Du, Min Lin, Xueqian Wang, Tianyu Pang

TL;DR

Current Large Language Model (LLM) safety defenses are static and easily bypassed by new, evolving jailbreak strategies deployment. This paper introduces a lifelong safety alignment framework that uses an iterative, competitive adversarial-play loop between a "Meta-Attacker" (discovering new jailbreaks) and a "Defender" (learning to resist them) to continuously patch security vulnerabilities.

What Problem Does This Paper Address?

Standard safety alignment typically happens before an LLM is released, training the model on a fixed set of known attack types. However, once deployed in open-ended environments, these models face highly flexible, out-of-distribution (OOD) jailbreak prompts that look nothing like prior training data. For instance, the robust GPT-4 model released in late 2023 was compromised just a few months later by a novel strategy called CodeAttack.

To bridge this gap, the authors address a fundamental question: Can we develop a framework that efficiently generates evolving attacks against strong defense models and provides continual data for improving safety alignment?

Methods

The authors propose a two-stage framework to simulate an evolving security landscape:

  1. Warm-Up Stage: To give the automated red-teaming system a strong starting point, the authors use the GPT-4o API to extract core strategies from 10 prominent jailbreak research papers. These strategies initialize a Meta-Attacker ($A_0$), powered by a DeepSeek-R1 model, which generates concrete jailbreak questions targeting specific malicious goals.
  2. Lifelong Safety Alignment Stage: This is an iterative, competitive co-evolutionary loop. The Meta-Attacker tests prompts against the Defender ($M_0$, initially a state-of-the-art safety-aligned model). Responses are evaluated by a automated safeguard judge. Successful attacks enter a success buffer ($B_s$), and failures enter a failure buffer ($B_f$). The Meta-Attacker uses beam search and Reject Fine-Tuning (RFT) on $B_s$ to discover harder attacks, while the Defender undergoes refusal training using the newly discovered successful jailbreaks to "level up" ($M_{t+1}$).
Figure 2: Lifelong safety alignment framework. In the Warm-Up Stage (Step 1), a powerful LLM Mapi (e.g., GPT-4o) is used to analyze jailbreak-related research papers and open-source codes. Key strategies s are extracted and used by the initial Meta-Attacker A0 to generate jailbreak questions x targeting specific goals g. These are submitted to the target model M0, producing responses y, and forming tuples (s, x, y, g) that are categorized into success buffer Bs or failure buffer Bf. In the Lifelong Safety Alignment Stage (Steps 2–4), the Meta-Attacker and Defender co-evolve through iterative interaction. The Meta-Attacker learns from failed cases in Bf and generates new attack strategies and questions, which are again evaluated against M0. A safeguard model Mj assesses the responses and updates the buffers Bs and Bf accordingly. Successful tuples in Bs are used to further evolve the Meta-Attacker via beam search [14] and Reject Fine-Tuning [13, 61], forming an iterative Adversarial-Play Evolution Loop. This loop continues until one of two conditions is met: (1) the goal success rate exceeds a threshold K, or (2) the maximum number of iterations N is reached. At the end of each loop, the Defender M0 is updated through refusal training using successful attack cases in Bs and refusal outputs from the refusal model Mr.

Datasets

  • Goal Pool ($G$): 4,000 illegal instructions extracted from the PKU-SafeRLHF dataset, with 100 held out specifically for testing unseen attacks.
  • Helpfulness Dataset: 20,000 question-answer pairs from Ultrachat to ensure the defender maintains its general utility and conversational capabilities during safety training.
  • Over-refusal Prevention: The XSTest dataset (comprising safe prompts that look superficially risky) is mixed into training to prevent the defender from becoming overly conservative.

Key Insights and Ideas

  • Dynamic Strategy Shifting: As the defender adapts, the attacker is forced to abandon simple methods. In the first iteration, "Fictional Scenarios & Role-Playing" made up 25% of successful attacks. By the second iteration, the defender successfully blocked these, forcing the attacker to pivot to "Technical Abstraction & Neutral Language."
Figure 1: Evolution of successful jailbreak strategies across iterations in our lifelong safety alignment framework. Left: Strategies that succeed against the initial model M0. Right: Strategies that succeed against the updated Defender M1. Notably, the dominant strategy category “Fictional Scenarios & Role-Playing” drops from the majority to under 5% in the second iteration, indicating that M1 effectively defends against these attacks through adversarial-play evolution.
  • Emergent Multi-Turn Tactics: Without explicit programming, the Meta-Attacker independently discovered advanced strategies like "Series of Indirect & Technical Framing," which closely mimic sophisticated multi-turn jailbreaks found in recent literature.
  • Reasoning Models Make Better Red-Teamers: Replacing a standard instruction-following model (like Qwen2.5-7B-Instruct) with a reasoning-focused model (DeepSeek-R1) boosted the initial attack success rate from a meager 8% to 55%, highlighting the importance of test-time reasoning in automated red-teaming.

Key Results

  • Attacker Performance: In the first iteration, the Meta-Attacker achieved a 73% Attack Success Rate (ASR) against the strong baseline defender and demonstrated a 57% transfer ASR against another robust defense model, LAT.
  • Defender Robustness: Through adversarial training, the Defender ($M_2$) successfully reduced the Meta-Attacker's ASR down to just 7%. It also completely neutralized all 6 baseline "seen" attack types (reducing average ASR to 0.0%).
  • Generalization to Unseen Baselines: Against the brutal Simple Adaptive Attack baseline, the initial model had a 100% failure rate (100% ASR). The evolved $M_2$ defender successfully reduced this to 38%.
  • Preserving Utility: Crucially, the defender's safety upgrades did not come at the cost of performance; its average score across 10 helpfulness tasks remained stable (~56.3%).

Limitations and Future Work

  • Catastrophic Forgetting: The authors limited their experiment to two full iterations, noting that extended continuous learning cycles risk catastrophic forgetting or optimization instability where the model forgets how to be helpful or fails on older safety metrics.
  • Training Efficiency: The framework currently relies on Supervised Fine-Tuning (SFT) and Reject Fine-Tuning (RFT). The authors suggest that integrating Reinforcement Learning with Verifiable Rewards (RLVR) could significantly boost efficiency and performance in future iterations.

Summary updated

BibTeX
@inproceedings{wang2025lifelong,
  author = {Haoyu Wang and Zeyu Qin and Yifei Zhao and Chao Du and Min Lin and Xueqian Wang and Tianyu Pang},
  title = {{Lifelong Safety Alignment for Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=9YkEcAqiIK},
}
Figure