Continual Safety Alignment via Gradient-Based Sample Selection
Thong Bach 1, Dung Nguyen 1, Thao Minh Le 2, Truyen Tran 1
Published on arXiv
2604.17215
Prompt Injection
OWASP LLM Top 10 — LLM01
Key Finding
Substantially improves alignment preservation while maintaining competitive task performance across LLaMA 3.1 8B and Qwen-2.5 7B models
Gradient-Based Sample Selection
Novel technique introduced
Large language models require continuous adaptation to new tasks while preserving safety alignment. However, fine-tuning on even benign data often compromises safety behaviors, including refusal of harmful requests, truthfulness, and commonsense reasoning. We investigate which training samples cause alignment drift through a data-centric lens. Our empirical analysis shows samples contribute unequally: high-gradient samples cause greater safety degradation and drive models toward pretrained distributions, while moderate-gradient samples enable task learning with minimal alignment loss. We propose gradient-based sample selection that filters high-gradient samples during fine-tuning. Across multiple model families on continual domain tasks, our method substantially improves alignment preservation while maintaining competitive task performance, without requiring curated safe data or architectural modifications. Our method is robust across selection ratios, task orderings, and diverse attack benchmarks.
Key Contributions
- Empirical analysis showing high-gradient samples cause disproportionate safety alignment degradation during fine-tuning
- Gradient-based sample selection method that filters high-gradient samples to preserve safety alignment
- Demonstrated robustness across multiple model families, task orderings, and attack benchmarks without requiring curated safe data