arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.18100cs.CLcs.AI
收藏

Panacea: 通过微调后扰动缓解大语言模型的有害微调

Panacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning Perturbation

Tsinghua University(清华大学);Shenzhen Campus of Sun Yat-sen University(中山大学深圳校区);Didichuxing Co. Ltd(滴滴出行有限公司);Nanyang Technological University(南洋理工大学)

Yibo Wang, Tiansheng Huang, Li Shen, Huanjin Yao, Haotian Luo, Rui Liu, Naiqiang Tan, Jiaxing Huang, Dacheng Tao

AI总结:

Panacea通过自适应扰动优化,在保持微调性能的同时缓解大语言模型的有害微调问题

摘要:

有害微调攻击对微调服务构成了重大安全风险。主流防御方法旨在使模型免疫,使得后续的有害微调攻击效果降低。然而,我们的评估结果表明,此类防御措施较为脆弱——只需几个微调步骤,模型仍能学习有害知识。为此,我们进一步实验发现,一个令人惊讶的简单解决方案——在微调模型上添加纯随机扰动,可以恢复模型从有害行为中,尽管这会导致模型微调性能下降。为了解决微调性能下降的问题,我们进一步提出Panacea,它优化了在微调后应用于模型的自适应扰动。Panacea在不牺牲下游微调性能的情况下保持模型的安全对齐性能。在不同有害比例、微调任务和主流LLMs上进行了全面实验,其中平均有害分数减少了高达21.2%,同时保持微调性能。作为副产品,我们分析了自适应扰动,并展示了不同层在各种LLMs中具有不同的安全性亲和力,这与几个先前研究的结果一致。源代码可在https://github.com/w-yibo/Panacea获取。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑