Evaluating the Instruction-Following Robustness of Large Language Models to Prompt Injection

Zekun Li, Baolin Peng, Pengcheng He, Xifeng Yan
8/17/2023
cs.CLcs.AI

Official code: Leezekun/instruction-following-robustness-eval (4 stars, last commit 2023-11-22).

Abstract

Large Language Models (LLMs) have demonstrated exceptional proficiency in instruction-following, becoming increasingly crucial across various applications. However, this capability brings with it the risk of prompt injection attacks, where attackers inject instructions into LLMs' input to elicit undesirable actions or content. Understanding the robustness of LLMs against such attacks is vital for their safe implementation. In this work, we establish a benchmark to evaluate the robustness of instruction-following LLMs against prompt injection attacks. Our objective is to determine the extent to which LLMs can be influenced by injected instructions and their ability to differentiate between these injected and original target instructions. Through extensive experiments with leading instruction-following LLMs, we uncover significant vulnerabilities in their robustness to such attacks. Our results indicate that some models are overly tuned to follow any embedded instructions in the prompt, overly focusing on the latter parts of the prompt without fully grasping the entire context. By contrast, models with a better grasp of the context and instruction-following capabilities will potentially be more susceptible to compromise by injected instructions. This underscores the need to shift the focus from merely enhancing LLMs' instruction-following capabilities to improving their overall comprehension of prompts and discernment of instructions that are appropriate to follow. We hope our in-depth analysis offers insights into the underlying causes of these vulnerabilities, aiding in the development of future solutions. Code and data are available at https://github.com/Leezekun/instruction-following-robustness-eval

View on arXivView PDF

Code Implementations(1)

40Shell, PythonNov 17, 20232 years ago

Cite this paper

@article{li2023evaluating,
  title  = {Evaluating the Instruction-Following Robustness of Large Language Models to Prompt Injection},
  author = {Zekun Li and Baolin Peng and Pengcheng He and Xifeng Yan},
  year   = {2023},
  eprint = {2308.10819},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2308.10819v3}
}

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/2308.10819.svg)](https://codeofpaper.com/paper/2308.10819)

Discussion