SPIN: Self-Supervised Prompt INjection

Leon Zhou, Junfeng Yang, Chengzhi Mao

Abstract

Large Language Models (LLMs) are increasingly used in a variety of important applications, yet their safety and reliability remain as major concerns. Various adversarial and jailbreak attacks have been proposed to bypass the safety alignment and cause the model to produce harmful responses. We introduce Self-supervised Prompt INjection (SPIN) which can detect and reverse these various attacks on LLMs. As our self-supervised prompt defense is done at inference-time, it is also compatible with existing alignment and adds an additional layer of safety for defense. Our benchmarks demonstrate that our system can reduce the attack success rate by up to 87.9%, while maintaining the performance on benign user requests. In addition, we discuss the situation of an adaptive attacker and show that our method is still resilient against attackers who are aware of our defense.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
AdvBench · harmful behaviorsVicuna-7b under Universal Adversarial Trigger (GCG), no SPIN defense specifiedAttack Success Rate (ASR)100%model=Vicuna-7B · attack=GCG · params=7b · defense=none
Source quote
L227: Universal Adversarial Trigger. We implement Greedy Coordinate Gradient-based (GCG) search as done in \citep{zou2023universal}. Each malicious request gets appended a suffix, and the suffix gets optimized for up to 500 iterations or until alignment is broken. Then the next request begins with the previous optimized suffix appended. In the case of Vicuna, the suffix injection is able to achieve an Attack Success Rate (ASR) of 100%.
BibTeX
@misc{zhou2024spin,
  author = {Leon Zhou and Junfeng Yang and Chengzhi Mao},
  title = {{SPIN: Self-Supervised Prompt INjection}},
  year = {2024},
  eprint = {2410.13236},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.13236},
}

Loading related content...

Figure