SPIN: Self-Supervised Prompt INjection

Leon Zhou, Junfeng Yang, Chengzhi Mao · Submission to ICLR 2025 · Rejected

Abstract

Large Language Models (LLMs) are increasingly used in a variety of important applications, yet their safety and reliability remain 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 Defensive Self-supervised Prompt INjection (D-SPIN) which can detect and reverse these various attacks on LLMs. Just by injecting an adaptive defense prompt at inference-time, our method is simple, effective, and compatible with existing safety-aligned models. 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},
}
Figure