LLM Self Defense: By Self Examination, LLMs Know They Are Being Tricked
Mansi Phute, Alec Helbling, Matthew Hull, ShengYun Peng, Sebastian, Szyller, Cory Cornelius, Duen Horng Chau

TL;DR
This paper introduces LLM Self Defense, a novel method where LLMs analyze their own outputs to detect and prevent harmful content, significantly reducing attack success rates without additional training or preprocessing.
Contribution
It presents a simple, effective approach for LLM safety that does not require fine-tuning, leveraging the models' own capabilities for self-examination against adversarial prompts.
Findings
Reduces attack success rate to nearly 0 on GPT 3.5 and Llama 2
Works against various attack types including prompt engineering
Does not require fine-tuning or input preprocessing
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Natural Language Processing Techniques · Adversarial Robustness in Machine Learning
MethodsMulti-Head Attention · Attention Is All You Need · Cosine Annealing · Discriminative Fine-Tuning · Refunds@Expedia|||How do I get a full refund from Expedia? · Linear Warmup With Cosine Annealing · Linear Layer · Layer Normalization · Softmax · Dense Connections
