Backdooring Instruction-Tuned Large Language Models with Virtual Prompt Injection

Jun Yan, Vikas Yadav, Shiyang Li, Lichang Chen, Zheng Tang +4 more
7/31/2023
254 citations
cs.CLcs.CRcs.LG

No official code found. Best implementation: wegodev2/virtual-prompt-injection (27 stars, Python, last commit 2024-07-06).

Abstract

Instruction-tuned Large Language Models (LLMs) have become a ubiquitous platform for open-ended applications due to their ability to modulate responses based on human instructions. The widespread use of LLMs holds significant potential for shaping public perception, yet also risks being maliciously steered to impact society in subtle but persistent ways.

Show full abstract

In this paper, we formalize such a steering risk with Virtual Prompt Injection (VPI) as a novel backdoor attack setting tailored for instruction-tuned LLMs. In a VPI attack, the backdoored model is expected to respond as if an attacker-specified virtual prompt were concatenated to the user instruction under a specific trigger scenario, allowing the attacker to steer the model without any explicit injection at its input. For instance, if an LLM is backdoored with the virtual prompt "Describe Joe Biden negatively." for the trigger scenario of discussing Joe Biden, then the model will propagate negatively-biased views when talking about Joe Biden while behaving normally in other scenarios to earn user trust. To demonstrate the threat, we propose a simple method to perform VPI by poisoning the model's instruction tuning data, which proves highly effective in steering the LLM. For example, by poisoning only 52 instruction tuning examples (0.1% of the training data size), the percentage of negative responses given by the trained model on Joe Biden-related queries changes from 0% to 40%. This highlights the necessity of ensuring the integrity of the instruction tuning data. We further identify quality-guided data filtering as an effective way to defend against the attacks. Our project page is available at https://poison-llm.github.io.

View on arXivView PDF

Code Implementations(1)

Unofficial implementation of "Backdooring Instruction-Tuned Large Language Models with Virtual Prompt Injection"

271PythonOct 18, 20232 years ago

Similar Papers

Cite this paper

@article{yan2023backdooring,
  title  = {Backdooring Instruction-Tuned Large Language Models with Virtual Prompt Injection},
  author = {Jun Yan and Vikas Yadav and Shiyang Li and Lichang Chen and Zheng Tang and Hai Wang and Vijay Srinivasan and Xiang Ren and Hongxia Jin},
  year   = {2023},
  eprint = {2307.16888},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2307.16888v3}
}

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

Discussion