Reproduce “Panacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning Perturbation” on OpenResearch

Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Yibo Wang, Tiansheng Huang, Li Shen, Huanjin Yao, Haotian Luo, Rui Liu, Naiqiang Tan, Jiaxing Huang and 1 more

Panacea applies an adaptive perturbation after fine-tuning Large Language Models to restore safety compromised by harmful data. The method reduced harmful outputs by 21.2% on average and preserved downstream task performance.

Key insights

  • Pre-fine-tuning defenses are insufficient; models can still learn harmful behaviors over time, necessitating post-fine-tuning mitigation strategies.
  • Intelligently designed adaptive perturbations can effectively restore LLM safety post-fine-tuning without significantly compromising performance on benign tasks, unlike random noise.
  • Different LLM architectures exhibit distinct layer-wise safety properties, with certain layers (e.g., earlier for Llama2-7B, middle/final for Gemma2-9B) showing greater sensitivity to safety-related perturbations.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.