LLM Self Defense: Through self-examination, the LLM knows it is being deceivedLLM Self Defense: By Self Examination, LLMs Know They Are Being Tricked
AI summary
Researchers propose the LLM Self Defense defense method, which uses another LLM instance to screen generated responses for harmfulness, reducing the attack success rate to nearly 0 in experiments on GPT 3.5 and Llama 2. The method embeds the generated content into a predefined prompt, and another LLM instance analyzes it and predicts whether it is harmful; it requires no fine-tuning, input preprocessing, or iterative output generation. The tests cover multiple types of attacks, including forcing an affirmative answer and prompt engineering. The code is open-sourced at https://github.com/poloclub/llm-self-defense