AsFT: Anchoring Safety During LLM Fine-Tuning Within Narrow Safety Basin

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Yang, Shuo, Zhang, Qihui, Liu, Yuyang, Jia, Xiaojun, Ning, Kunpeng, Yao, Jiayu, Wang, Jigang, Dai, Hailiang, Song, Yibing, Yuan, Li
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911357225402368
author Yang, Shuo
Zhang, Qihui
Liu, Yuyang
Jia, Xiaojun
Ning, Kunpeng
Yao, Jiayu
Wang, Jigang
Dai, Hailiang
Song, Yibing
Yuan, Li
author_facet Yang, Shuo
Zhang, Qihui
Liu, Yuyang
Jia, Xiaojun
Ning, Kunpeng
Yao, Jiayu
Wang, Jigang
Dai, Hailiang
Song, Yibing
Yuan, Li
contents Fine-tuning large language models (LLMs) improves performance but introduces critical safety vulnerabilities: even minimal harmful data can severely compromise safety measures. We observe that perturbations orthogonal to the alignment direction - defined by weight differences between aligned (safe) and unaligned models - rapidly compromise model safety. In contrast, updates along the alignment direction largely preserve it, revealing the parameter space as a "narrow safety basin". To address this, we propose AsFT (Anchoring Safety in Fine-Tuning) to maintain safety by explicitly constraining update directions during fine-tuning. By penalizing updates orthogonal to the alignment direction, AsFT effectively constrains the model within the "narrow safety basin," thus preserving its inherent safety. Extensive experiments on multiple datasets and models show that AsFT reduces harmful behaviors by up to 7.60%, improves task performance by 3.44%, and consistently outperforms existing methods across multiple tasks.
format Preprint
id arxiv_https___arxiv_org_abs_2506_08473
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle AsFT: Anchoring Safety During LLM Fine-Tuning Within Narrow Safety Basin
Yang, Shuo
Zhang, Qihui
Liu, Yuyang
Jia, Xiaojun
Ning, Kunpeng
Yao, Jiayu
Wang, Jigang
Dai, Hailiang
Song, Yibing
Yuan, Li
Machine Learning
Fine-tuning large language models (LLMs) improves performance but introduces critical safety vulnerabilities: even minimal harmful data can severely compromise safety measures. We observe that perturbations orthogonal to the alignment direction - defined by weight differences between aligned (safe) and unaligned models - rapidly compromise model safety. In contrast, updates along the alignment direction largely preserve it, revealing the parameter space as a "narrow safety basin". To address this, we propose AsFT (Anchoring Safety in Fine-Tuning) to maintain safety by explicitly constraining update directions during fine-tuning. By penalizing updates orthogonal to the alignment direction, AsFT effectively constrains the model within the "narrow safety basin," thus preserving its inherent safety. Extensive experiments on multiple datasets and models show that AsFT reduces harmful behaviors by up to 7.60%, improves task performance by 3.44%, and consistently outperforms existing methods across multiple tasks.
title AsFT: Anchoring Safety During LLM Fine-Tuning Within Narrow Safety Basin
topic Machine Learning
url https://arxiv.org/abs/2506.08473