Reproduce “Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sink” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

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

About this paper

Guozhi Liu, Weiwei Lin, Tiansheng Huang, Ruichao Mo, Qi Mu, Xiumin Wang, Li Shen

A novel fine-tuning-stage defense, 'Surgery,' mitigates harmful fine-tuning in Large Language Models by regularizing attention sink divergence, demonstrating an average 14.68% reduction in harmful output generation and outperforming existing defenses by 8.35% while preserving task performance.

Key insights

  • Attention heads exhibit two distinct signs of 'sink divergence,' separating into groups based on whether they pay higher attention to sink tokens for harmful or refusal inputs.
  • An increase in the proportion of harmful data during fine-tuning correlates with an increased number of attention heads displaying positive sink divergence, suggesting a link to harmful behavior.
  • The 'Separable Sink Divergence Hypothesis' proposes that attention heads associated with learning harmful patterns are identifiable and separable by the sign of their sink divergence.

Summary by alphaXiv.

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