수술: 어텐션 싱크를 활용한 대규모 언어 모델의 유해한 미세 조정 완화
Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sink
유해한 미세 조정은 대규모 언어 모델의 안전 정렬을 무효화하여 상당한 안전 문제를 야기할 수 있습니다. 본 논문에서는 어텐션 싱크 메커니즘을 활용하여 유해한 미세 조정을 완화합니다. 구체적으로, 각 어텐션 헤드에 대한 '싱크 다이버전스'라는 통계값을 측정하고, '서로 다른 어텐션 헤드는 싱크 다이버전스의 서로 다른 부호를 나타낸다'는 것을 관찰했습니다. 이러한 현상의 안전성에 대한 함의를 이해하기 위해 실험을 진행한 결과, 유해한 미세 조정을 수행할 때 모델의 유해성이 증가함에 따라 양의 싱크 다이버전스를 갖는 어텐션 헤드의 수가 증가한다는 것을 발견했습니다. 이러한 발견을 바탕으로, '미세 조정 과정에서 유해한 패턴을 학습하는 어텐션 헤드는 싱크 다이버전스의 부호를 통해 분리될 수 있다'는 가설을 제안합니다. 이 가설에 따라, '수술(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.