Skip to main content
QUICK REVIEW

[論文レビュー] Certifying LLM Safety against Adversarial Prompting

Aounon Kumar, Chirag Agarwal|arXiv (Cornell University)|Sep 6, 2023
Adversarial Robustness in Machine LearningComputer Science被引用数 25
ひとこと要約

この論文は、 erase-and-check(エラースアンドチェック)というフレームワークを紹介します。トークンの部分列を消去し、フィルターで安全性を検証することで、指定された攻撃サイズの下で対向的な prompting に対する安全性を証明可能に保証します。

ABSTRACT

Large language models (LLMs) are vulnerable to adversarial attacks that add malicious tokens to an input prompt to bypass the safety guardrails of an LLM and cause it to produce harmful content. In this work, we introduce erase-and-check, the first framework for defending against adversarial prompts with certifiable safety guarantees. Given a prompt, our procedure erases tokens individually and inspects the resulting subsequences using a safety filter. Our safety certificate guarantees that harmful prompts are not mislabeled as safe due to an adversarial attack up to a certain size. We implement the safety filter in two ways, using Llama 2 and DistilBERT, and compare the performance of erase-and-check for the two cases. We defend against three attack modes: i) adversarial suffix, where an adversarial sequence is appended at the end of a harmful prompt; ii) adversarial insertion, where the adversarial sequence is inserted anywhere in the middle of the prompt; and iii) adversarial infusion, where adversarial tokens are inserted at arbitrary positions in the prompt, not necessarily as a contiguous block. Our experimental results demonstrate that this procedure can obtain strong certified safety guarantees on harmful prompts while maintaining good empirical performance on safe prompts. Additionally, we propose three efficient empirical defenses: i) RandEC, a randomized subsampling version of erase-and-check; ii) GreedyEC, which greedily erases tokens that maximize the softmax score of the harmful class; and iii) GradEC, which uses gradient information to optimize tokens to erase. We demonstrate their effectiveness against adversarial prompts generated by the Greedy Coordinate Gradient (GCG) attack algorithm. The code for our experiments is available at https://github.com/aounon/certified-llm-safety.

研究の動機と目的

  • 対向的 prompting に対する証明可能な防御の必要性をLLMに対して動機づける。
  • erase-and-checkを提案し、所定の長さまでの敵対的改変に対する安全性を証明する。
  • 二つの安全フィルタ実装(Llama 2とDistilBERT)を提供し、三つの攻撃モード(サフィックス、挿入、インフュージョン)を分析する。
  • 計算を削減しつつ検出性能を保つ効率的な経験的防御を提供する。
  • 安全なプロンプトと有害なプロンプトの両方に対して理論的な安全保証と経験的性能を示す。

提案手法

  • erase-and-checkはプロンプトから最大で d トークンを消去し、部分列を形成して各々を安全性フィルターで検証する。
  • 正式な安全証明書を提供する:フィルターが任意の部分列またはプロンプトを有害とラベル付けした場合、erase-and-checkはプロンプトを有害とラベル付けする。
  • 安全フィルターを二つの方式で実装する:(a)Llama 2 プロンプティングベースの分類器、(b)微調整済み DistilBERT 分類器。
  • 三つの攻撃モードを分析する:敵対的サフィックス、敵対的挿入、敵対的インフュージョン。
  • 三つの経験的防御を提案する:RandEC、GreedyEC、GradEC。
  • 有害なプロンプト上で erase-and-check の正確性を安全フィルターで界定する安全定理を証明する(定理 4.1)。
  • AdvBench プロンプトを用いて安全なプロンプトと有害なプロンプトの経験的性能を評価する。
Figure 1 : An illustration of how erase-and-check works on adversarial suffix attacks. It erases tokens from the end and checks the resulting subsequences using a safety filter. If any of the erased subsequences is detected as harmful, the input prompt is labeled harmful.
Figure 1 : An illustration of how erase-and-check works on adversarial suffix attacks. It erases tokens from the end and checks the resulting subsequences using a safety filter. If any of the erased subsequences is detected as harmful, the input prompt is labeled harmful.

実験結果

リサーチクエスチョン

  • RQ1erase-and-checkは最大長さ d までの敵対的プロンプトに対して証明可能な安全性を保証できるか?
  • RQ2異なる安全フィルター backed (Llama 2 対 DistilBERT) は証明済み・経験的性能にどう影響するか?
  • RQ3サフィックス、挿入、インフュージョンの三つの攻撃モードは標準的および経験的防御に対してどの程度有効か?
  • RQ4効率的な経験的防御(RandEC、GreedyEC、GradEC)は計算を削減しつつ強い検出を維持できるか?
  • RQ5現実用途のための証明済み保証と実際の実行時間の間のトレードオフは?

主な発見

  • erase-and-checkはLlama 2で有害プロンプトの証明付き検出を92%、AdvBenchプロンプトでDistilBERTで100%を達成。
  • DistilBERTベースの安全フィルターは、有害プロンプトに対してLlama 2ベースのフィルターより高速でより高い精度を提供。
  • 安全なプロンプトでは、erase-and-checkは高い経験的精度を維持(Llama 2で97%、DistilBERTで98%)を各攻撃モードで。
  • 敵対的サフィックスプロンプト長20で、erase-and-checkは従来のGPT-3.5の性能ベースラインと比べて強力な保護を示す。
  • RandEC、GreedyEC、GradECはGCG攻撃に対して検出を維持しつつ substantial speedups を提供(例: RandECは約30%の部分列検査で>90%正確性を達成)。
  • インフュージョンモードの実験は、DistilBERTがLlama 2より精度と速度で優れており、より多くの敵対的トークンに対して認証を可能にする。
Figure 2 : Adversarial prompts under different attack modes. Adversarial tokens are represented in red.
Figure 2 : Adversarial prompts under different attack modes. Adversarial tokens are represented in red.

この論文を読む

Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。

Nubintでこの論文を読む

このレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。