Panacea: Mitigating Harmful Fine-Tuning Attacks on Large Language Models via Post-Fine-Tuning PerturbationPanacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning Perturbation
The researchers propose the Panacea method to mitigate harmful fine-tuning attacks against large language model fine-tuning services. The mainstream defense approach is to pre-emptively "vaccinate" so that subsequent harmful fine-tuning is difficult to make effective, but the authors' experiments show that such defenses are relatively fragile, and the model can still learn harmful knowledge after a few fine-tuning steps; adding pure random perturbation directly to the fine-tuned model can restore safe behavior but degrades fine-tuning performance. Panacea instead optimizes an adaptive perturbation applied after fine-tuning ends, maintaining safety alignment without harming downstream fine-tuning performance; in experiments across different harmful ratios, fine-tuning tasks, and mainstream LLMs, the average harmful score is reduced by up to 21.2%. The authors also find that different layers of different LLMs have different safety affinity. Code is open-sourced at https://github.com/w-yibo/Panacea。