Surgery: 어텐션 싱크를 통한 대규모 언어 모델의 유해한 미세 조정 완화
Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sink
유해한 미세 조정(harmful fine-tuning)은 대규모 언어 모델의 안전 정렬(safety alignment)을 무효화하여 심각한 안전 위험을 노출시킬 수 있다. 본 논문에서는 유해한 미세 조정을 완화하기 위해 어텐션 싱크(attention sink) 메커니즘을 활용한다. 구체적으로, 우리는 각 어텐션 헤드에 대해 '싱크 발산(sink divergence)'이라는 통계량을 측정하고, 어텐션 헤드들이 서로 다른 두 가지 싱크 발산 부호를 보임을 관찰한다. 이것이 안전에 미치는 영향을 파악하기 위해 실험을 수행한 결과, 유해한 미세 조정 중 모델의 유해성이 증가함에 따라 양(+)의 싱크 발산을 가진 어텐션 헤드의 수가 증가함을 발견했다. 이러한 발견을 바탕으로 우리는 '분리 가능한 싱크 발산 가설'을 제안하는데, 이는 미세 조정 중 유해한 패턴 학습과 연관된 어텐션 헤드들이 싱크 발산 부호에 따라 분리될 수 있다는 것이다. 이 가설에 기반하여 우리는 'Surgery'라는 미세 조정 단계 방어 기법을 제안한다. Surgery는 싱크 발산 억제를 위한 정규화기(regularizer)를 사용하여 어텐션 헤드들을 음(-)의 싱크 발산 그룹으로 유도하며, 이를 통해 모델이 유해한 패턴을 학습하고 증폭시키는 경향을 줄인다. 광범위한 실험 결과, Surgery는 BeaverTails, HarmBench, SorryBench 벤치마크에서 방어 성능을 각각 5.90%, 11.25%, 9.55% 향상시키는 것으로 나타났다. 소스 코드는 https://github.com/Lslland/Surgery 에서 제공된다.
Harmful fine-tuning can invalidate safety alignment of large language models, exposing significant safety risks. In this paper, we utilize the attention sink mechanism to mitigate harmful fine-tuning. Specifically, we first measure a statistic named \emph{sink divergence} for each attention head and observe that \emph{different attention heads exhibit two different signs of sink divergence}. To understand its safety implications, we conduct experiments and find that the number of attention heads of positive sink divergence increases along with the increase of the model's harmfulness when undergoing harmful fine-tuning. Based on this finding, we propose a separable sink divergence hypothesis -- \emph{attention heads associating with learning harmful patterns during fine-tuning are separable by their sign of sink divergence}. Based on the hypothesis, we propose a fine-tuning-stage defense, dubbed Surgery. Surgery utilizes a regularizer for sink divergence suppression, which steers attention heads toward the negative sink divergence group, thereby reducing the model's tendency to learn and amplify harmful patterns. Extensive experiments demonstrate that Surgery improves defense performance by 5.90\%, 11.25\%, and 9.55\% on the BeaverTails, HarmBench, and SorryBench benchmarks, respectively. Source code is available on https://github.com/Lslland/Surgery.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.