Transfer Attacks and Defenses for Large Language Models on Coding Tasks

要約

ChatGPT などの最新の大規模言語モデル (LLM) は、コードの記述や推論などのコーディング タスクに対して優れた機能を実証しています。
これらは、コードの要約やコードの脆弱性の特定などのタスクを実行する際にすでに競争力のある結果を実証していた、code2seq や seq2seq などの以前のコードのニューラル ネットワーク モデルを改良したものです。
ただし、これらの以前のコード モデルは、敵対的な例、つまり、誤った条件による「デッド コード」の組み込みや、「だます」ように設計された重要でない print ステートメントの追加など、プログラムのセマンティクスを変更しない小さな構文の混乱に対して脆弱であることが示されています。
モデルたち。
LLM も同じ敵対的な摂動に対して脆弱である可能性がありますが、この懸念に関する詳細な研究はこれまでのところ不足しています。
この論文では、LLM を使用したコーディング タスクに対する敵対的な摂動の影響を調査することを目的としています。
特に、より小さなコードモデルに対するホワイトボックス攻撃を通じて生成された敵対的な例の LLM への転送可能性を研究します。
さらに、再トレーニングのコストをかけずに、そのような敵対者に対して LLM をより堅牢にするために、プロンプトを変更して、敵対的に摂動されたコードの例や敵対的な摂動を逆転させるための明示的な指示などの追加情報を含めるプロンプトベースの防御を提案します。
私たちの実験では、より小さなコード モデルで得られた敵対的な例は確かに転送可能であり、LLM のパフォーマンスを弱めることが示されました。
提案された防御策は、モデルの復元力を向上させる可能性を示し、コード関連アプリケーションにおける LLM のより堅牢な防御ソリューションへの道を開きます。

要約(オリジナル)

Modern large language models (LLMs), such as ChatGPT, have demonstrated impressive capabilities for coding tasks including writing and reasoning about code. They improve upon previous neural network models of code, such as code2seq or seq2seq, that already demonstrated competitive results when performing tasks such as code summarization and identifying code vulnerabilities. However, these previous code models were shown vulnerable to adversarial examples, i.e. small syntactic perturbations that do not change the program’s semantics, such as the inclusion of ‘dead code’ through false conditions or the addition of inconsequential print statements, designed to ‘fool’ the models. LLMs can also be vulnerable to the same adversarial perturbations but a detailed study on this concern has been lacking so far. In this paper we aim to investigate the effect of adversarial perturbations on coding tasks with LLMs. In particular, we study the transferability of adversarial examples, generated through white-box attacks on smaller code models, to LLMs. Furthermore, to make the LLMs more robust against such adversaries without incurring the cost of retraining, we propose prompt-based defenses that involve modifying the prompt to include additional information such as examples of adversarially perturbed code and explicit instructions for reversing adversarial perturbations. Our experiments show that adversarial examples obtained with a smaller code model are indeed transferable, weakening the LLMs’ performance. The proposed defenses show promise in improving the model’s resilience, paving the way to more robust defensive solutions for LLMs in code-related applications.

arxiv情報

著者 Chi Zhang,Zifan Wang,Ravi Mangal,Matt Fredrikson,Limin Jia,Corina Pasareanu
発行日 2023-11-22 15:11:35+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CR, cs.LG パーマリンク