Skip to main content
QUICK REVIEW

[논문 리뷰] SafeDecoding: Defending against Jailbreak Attacks via Safety-Aware Decoding

Zhangchen Xu, Fengqing Jiang|arXiv (Cornell University)|2024. 02. 14.
Adversarial Robustness in Machine LearningComputer Science인용 수 3
한 줄 요약

이 논문은 대규모 언어 모델이 재판금지 공격을 방어하기 위해 안전성 경고 토큰의 확률을 증폭하고 해로운 응답 토큰의 확률을 억제하는 안전성 인지 디코딩 전략인 SafeDecoding을 제안한다. 미세조정된 전문 모델을 활용하고 원본 및 전문 토큰 분포를 균형 있게 조정함으로써 SafeDecoding은 유해성 없는 쿼리에 대한 유용성 손실 없이 재판금지 공격 성공률을 최대 90%까지 감소시킨다.

ABSTRACT

As large language models (LLMs) become increasingly integrated into real-world applications such as code generation and chatbot assistance, extensive efforts have been made to align LLM behavior with human values, including safety. Jailbreak attacks, aiming to provoke unintended and unsafe behaviors from LLMs, remain a significant/leading LLM safety threat. In this paper, we aim to defend LLMs against jailbreak attacks by introducing SafeDecoding, a safety-aware decoding strategy for LLMs to generate helpful and harmless responses to user queries. Our insight in developing SafeDecoding is based on the observation that, even though probabilities of tokens representing harmful contents outweigh those representing harmless responses, safety disclaimers still appear among the top tokens after sorting tokens by probability in descending order. This allows us to mitigate jailbreak attacks by identifying safety disclaimers and amplifying their token probabilities, while simultaneously attenuating the probabilities of token sequences that are aligned with the objectives of jailbreak attacks. We perform extensive experiments on five LLMs using six state-of-the-art jailbreak attacks and four benchmark datasets. Our results show that SafeDecoding significantly reduces the attack success rate and harmfulness of jailbreak attacks without compromising the helpfulness of responses to benign user queries. SafeDecoding outperforms six defense methods.

연구 동기 및 목표

  • 기존의 안전성 정렬 방식을 우회하는 재판금지 공격의 증가하는 위협을 해결하기 위해.
  • 재판금지 시도 중 해로운 출력을 효과적으로 완화하면서도 모델의 유용성을 유지하는 방어 메커니즘을 개발하기 위해.
  • 기존 방어 방법의 한계를 극복하기 위해, 높은 추론 비용, 기능 감소, 최신 공격에 대한 실패 가능성 등을 고려하기 위해.
  • 공격 조건에서도 모델의 상위-p 예측 토큰 내에 이미 존재하는 안전성 경고 토큰을 활용하기 위해.
  • 안전성과 유용성을 동적으로 균형 잡는 하이브리드 토큰 확률 분포를 통한 디코딩 전략을 설계하기 위해.

제안 방법

  • 원본 LLM에서 생성된 안전성 인지 데이터셋을 기반으로 전문 모델을 훈련하여, 안전성 경고 토큰을 우선시하도록 미세조정한다.
  • 추론 중에 원본 모델과 전문 모델의 상위-k 토큰을 교차시켜 샘플 공간을 구성한다.
  • 원본 모델의 로그it과 전문 모델의 로그it을 조합하여 새로운 토큰 확률 분포를 형성하고, 안전성 토큰에 초점을 맞춘다.
  • 하이브리드 분포에 온도 조정 샘플링 전략을 적용하여, 도움이 되고 안전한 응답을 생성한다.
  • 재판금지 목적과 관련된 토큰 시퀀스의 확률을 동적으로 감쇠시키고, 거부 또는 안전성 경고와 관련된 토큰의 확률을 증폭시킨다.
  • 표준 LLM 추론 파이프라인과 호환되는 후처리 디코딩 레이어로 통합한다.
Figure 1: This example illustrates the token probabilities of Vicuna-7B model under GCG attack Zou et al. ( 2023 ) . The words in red are GCG suffixes. We note that although the token representing the word "Sure" has a dominant probability, safety disclaimers such as "I", "Sorry", and "As" are still
Figure 1: This example illustrates the token probabilities of Vicuna-7B model under GCG attack Zou et al. ( 2023 ) . The words in red are GCG suffixes. We note that although the token representing the word "Sure" has a dominant probability, safety disclaimers such as "I", "Sorry", and "As" are still

실험 결과

연구 질문

  • RQ1안전성 인지 디코딩 전략은 다양한 LLM에서 최신 기술의 재판금지 공격에 대해 효과적으로 공격 성공률을 감소시킬 수 있는가?
  • RQ2SafeDecoding는 악성 사용자 프롬프트에 대응하면서도, 유해하지 않은 사용자 쿼리에 대해 높은 유용성을 유지하는가?
  • RQ3효과성, 효율성, 유용성 간의 상충 관계 측면에서 SafeDecoding은 기존 방어 방법과 비교해 어떻게 성능을 발휘하는가?
  • RQ4Dolphin 및 Guanaco와 같은 모델을 포함해, 정렬된 모델과 캐시되지 않은 모델 모두에 대해 SafeDecoding는 효과적으로 적용될 수 있는가?
  • RQ5상위-k 확률 공간 내에 안전성 경고 토큰이 존재하는 것이, 확률 조작을 통한 신뢰할 수 있는 방어를 가능하게 하는가?

주요 결과

  • SafeDecoding는 다섯 개의 LLM에서 여섯 가지 최신 기술의 재판금지 공격에 대해 공격 성공률(ASR)을 최대 90%까지 감소시켰다.
  • HHH 벤치마크에서 SafeDecoding는 유해성 점수를 기준선의 4.842에서 4.402로 감소시켰으며, 동시에 유용성 점수 4.296를 유지했다.
  • SafeDecoding는 방어 효과성과 유용성 유지 측면에서 여섯 가지 기준 방어 방법보다 뛰어나며, 특히 Dolphin과 같은 캐시되지 않은 모델에서 두각을 나타냈다.
  • 전문 모델만으로는 공격 간에 일반화되지 않으며, 심지어 유용성까지 크게 떨어뜨려, 단순 미세조정만으로는 충분하지 않음을 시사한다.
  • SafeDecoding는 낮은 추론 오버헤드를 유지하며, Llama2, Vicuna, Falcon 등 다양한 모델 아키텍처와 호환된다.
  • 절단 실험에서 SafeDecoding는 온도 설정과 상위-k 샘플링 구성에 관계없이 일관된 성능을 보였다.
Figure 2: This figure illustrates the detail of SafeDecoding . During the training phase, we fine-tune the original LLM to construct an expert model with strengthened safety. In the inference phase, a user query is passed to both the original and expert models. Based on their outputs, SafeDecoding c
Figure 2: This figure illustrates the detail of SafeDecoding . During the training phase, we fine-tune the original LLM to construct an expert model with strengthened safety. In the inference phase, a user query is passed to both the original and expert models. Based on their outputs, SafeDecoding c

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.