Harmful fine-tuning attack introduces significant security risks to the fine-tuning services. Main-stream defenses aim to vaccinate the model such that the later harmful fine-tuning attack is less effective. However, our evaluation results show that such defenses are fragile--with a few fine-tuning steps, the model still can learn the harmful knowledge. To this end, we do further experiment and find that an embarrassingly simple solution--adding purely random perturbations to the fine-tuned model, can recover the model from harmful behaviors, though it leads to a degradation in the model's fine-tuning performance. To address the degradation of fine-tuning performance, we further propose Panacea, which optimizes an adaptive perturbation that will be applied to the model after fine-tuning. Panacea maintains model's safety alignment performance without compromising downstream fine-tuning performance. Comprehensive experiments are conducted on different harmful ratios, fine-tuning tasks and mainstream LLMs, where the average harmful scores are reduced by up-to 21.2%, while maintaining fine-tuning performance. As a by-product, we analyze the adaptive perturbation and show that different layers in various LLMs have distinct safety affinity, which coincide with finding from several previous study. Source code available at https://github.com/w-yibo/Panacea.


翻译:有害微调攻击对微调服务构成了重大安全风险。主流防御方法旨在为模型"接种疫苗",使后续的有害微调攻击效果降低。然而,我们的评估结果表明此类防御具有脆弱性——仅需少量微调步骤,模型仍能习得有害知识。为此,我们进一步实验发现,一种极其简单的解决方案——对微调后模型添加纯随机扰动,可使模型从有害行为中恢复,但这会导致模型微调性能下降。为解决微调性能退化问题,我们进一步提出Panacea方法,该方法通过优化自适应扰动并在微调后施加于模型。Panacea能在不影响下游微调性能的前提下,保持模型的安全对齐性能。我们在不同有害比例、微调任务和主流LLMs上进行了全面实验,结果表明该方法在保持微调性能的同时,平均有害分数最高可降低21.2%。作为附带成果,我们分析了自适应扰动,发现不同LLMs的各网络层具有差异化的安全亲和性,这与多项先前研究的发现相吻合。源代码发布于https://github.com/w-yibo/Panacea。

0
下载
关闭预览

相关内容

探索大型语言模型在网络安全中的作用:一项系统综述
专知会员服务
20+阅读 · 2025年4月27日
通信网络中大型语言模型的后门攻击的综述
专知会员服务
30+阅读 · 2023年9月5日
模型攻击:鲁棒性联邦学习研究的最新进展
机器之心
35+阅读 · 2020年6月3日
SemanticAdv:基于语义属性的对抗样本生成方法
机器之心
14+阅读 · 2019年7月12日
你的算法可靠吗? 神经网络不确定性度量
专知
40+阅读 · 2019年4月27日
简述多种降维算法
算法与数学之美
11+阅读 · 2018年9月23日
NLP通用模型诞生?一个模型搞定十大自然语言常见任务
人工智能头条
10+阅读 · 2018年6月29日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
19+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
19+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员