LLM Self Defense: By Self Examination, LLMs Know They Are Being Tricked
Fuente:
arXiv
Saved in:
| Main Authors: | , , , , , , |
|---|---|
| Format: | Preprint |
| Published: |
2023
|
| Subjects: | |
| Online Access: | |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1866913338486685696 |
|---|---|
| author | Phute, Mansi Helbling, Alec Hull, Matthew Peng, ShengYun Szyller, Sebastian Cornelius, Cory Chau, Duen Horng |
| author_facet | Phute, Mansi Helbling, Alec Hull, Matthew Peng, ShengYun Szyller, Sebastian Cornelius, Cory Chau, Duen Horng |
| contents | Large language models (LLMs) are popular for high-quality text generation but can produce harmful content, even when aligned with human values through reinforcement learning. Adversarial prompts can bypass their safety measures. We propose LLM Self Defense, a simple approach to defend against these attacks by having an LLM screen the induced responses. Our method does not require any fine-tuning, input preprocessing, or iterative output generation. Instead, we incorporate the generated content into a pre-defined prompt and employ another instance of an LLM to analyze the text and predict whether it is harmful. We test LLM Self Defense on GPT 3.5 and Llama 2, two of the current most prominent LLMs against various types of attacks, such as forcefully inducing affirmative responses to prompts and prompt engineering attacks. Notably, LLM Self Defense succeeds in reducing the attack success rate to virtually 0 using both GPT 3.5 and Llama 2. The code is publicly available at https://github.com/poloclub/llm-self-defense |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2308_07308 |
| institution | arXiv |
| publishDate | 2023 |
| record_format | arxiv |
| spellingShingle | LLM Self Defense: By Self Examination, LLMs Know They Are Being Tricked Phute, Mansi Helbling, Alec Hull, Matthew Peng, ShengYun Szyller, Sebastian Cornelius, Cory Chau, Duen Horng Computation and Language Artificial Intelligence Large language models (LLMs) are popular for high-quality text generation but can produce harmful content, even when aligned with human values through reinforcement learning. Adversarial prompts can bypass their safety measures. We propose LLM Self Defense, a simple approach to defend against these attacks by having an LLM screen the induced responses. Our method does not require any fine-tuning, input preprocessing, or iterative output generation. Instead, we incorporate the generated content into a pre-defined prompt and employ another instance of an LLM to analyze the text and predict whether it is harmful. We test LLM Self Defense on GPT 3.5 and Llama 2, two of the current most prominent LLMs against various types of attacks, such as forcefully inducing affirmative responses to prompts and prompt engineering attacks. Notably, LLM Self Defense succeeds in reducing the attack success rate to virtually 0 using both GPT 3.5 and Llama 2. The code is publicly available at https://github.com/poloclub/llm-self-defense |
| title | LLM Self Defense: By Self Examination, LLMs Know They Are Being Tricked |
| topic | Computation and Language Artificial Intelligence |
| url | https://arxiv.org/abs/2308.07308 |