Safe Delta: Consistently Preserving Safety when Fine-Tuning LLMs on Diverse Datasets

Ning Lu, Shengcai Liu, Jiahao Wu, Weiyu Chen, Zhirui Zhang +3 more
2/14/2026

No official code found. Best implementation: ColinLu50/SafeDelta (59 stars, last commit 2026-02-12).

Abstract

Large language models (LLMs) have shown great potential as general-purpose AI assistants across various domains. To fully leverage this potential in specific applications, many companies provide fine-tuning API services, enabling users to upload their own data for LLM customization. However, fine-tuning services introduce a new safety threat: user-uploaded data, whether harmful or benign, can break the model's alignment, leading to unsafe outputs. Moreover, existing defense methods struggle to address the diversity of fine-tuning datasets (e.g., varying sizes, tasks), often sacrificing utility for safety or vice versa. To address this issue, we propose Safe Delta, a safety-aware post-training defense method that adjusts the delta parameters (i.e., the parameter change before and after fine-tuning). Specifically, Safe Delta estimates the safety degradation, selects delta parameters to maximize utility while limiting overall safety loss, and applies a safety compensation vector to mitigate residual safety loss. Through extensive experiments on four diverse datasets with varying settings, our approach consistently preserves safety while ensuring that the utility gain from benign datasets remains unaffected.

View on arXivView PDF

Code Implementations(1)

ColinLu50/SafeDeltaCommunity100%

The official code repo for "Safe Delta: Consistently Preserving Safety when Fine-Tuning LLMs on Diverse Datasets" in ICML 2025.

5911Shell, PythonMay 16, 20258 months ago

Similar Papers

Cite this paper

@article{lu2026safe,
  title  = {Safe Delta: Consistently Preserving Safety when Fine-Tuning LLMs on Diverse Datasets},
  author = {Ning Lu and Shengcai Liu and Jiahao Wu and Weiyu Chen and Zhirui Zhang and Y. Ong and Qi Wang and Ke Tang},
  year   = {2026},
  eprint = {2505.12038},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2505.12038},
  journal = {ICML 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.12038.svg)](https://codeofpaper.com/paper/2505.12038)

Discussion