Self-Evaluation as a Defense Against Adversarial Attacks on LLMs

Hannah Brown, Leon Lin, Kenji Kawaguchi, Michael Shieh
7/3/2024
cs.LGcs.CLcs.CR

Official code: Linlt-leon/self-eval (4 stars, last commit 2024-07-13).

Abstract

We introduce a defense against adversarial attacks on LLMs utilizing self-evaluation. Our method requires no model fine-tuning, instead using pre-trained models to evaluate the inputs and outputs of a generator model, significantly reducing the cost of implementation in comparison to other, finetuning-based methods. Our method can significantly reduce the attack success rate of attacks on both open and closed-source LLMs, beyond the reductions demonstrated by Llama-Guard2 and commonly used content moderation APIs. We present an analysis of the effectiveness of our method, including attempts to attack the evaluator in various settings, demonstrating that it is also more resilient to attacks than existing methods. Code and data will be made available at https://github.com/Linlt-leon/self-eval.

View on arXivView PDF

Code Implementations(1)

40Shell, PythonJul 12, 20242 years ago

Similar Papers

Cite this paper

@article{brown2024selfevaluation,
  title  = {Self-Evaluation as a Defense Against Adversarial Attacks on LLMs},
  author = {Hannah Brown and Leon Lin and Kenji Kawaguchi and Michael Shieh},
  year   = {2024},
  eprint = {2407.03234},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.03234v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.03234.svg)](https://codeofpaper.com/paper/2407.03234)

Discussion