Robust Safety Classifier for Large Language Models: Adversarial Prompt Shield
Jinhwa Kim, Ali Derakhshan, Ian G. Harris
TL;DR
This work addresses the vulnerability of safety classifiers to adversarial prompts by introducing the Adversarial Prompt Shield (APS), a lightweight DistilBERT-based classifier operating on multi-turn dialogues. It couples APS with Bot Adversarial Noisy Dialogue (BAND), an autonomous data-generation framework that creates robust adversarial training data through random and structured suffixes, enabling efficient adversarial training. Empirical results show APS variants, especially those trained with WP_20 suffixes or red-team data, achieving substantial reductions in attack success rate (ASR) across multiple LLMs and attack types, including GCG-based suffixes, with robustness demonstrated on BAND-perturbed inputs. The findings suggest that compact safety classifiers, when trained with diverse adversarial data, can markedly enhance LLM safety, offering practical gains in deployment where model size, cost, and update speed matter. The work highlights the importance of adversarial training and data-curation strategies to bolster defense against evolving prompt-based exploits in real-world conversational AI systems.
Abstract
Large Language Models' safety remains a critical concern due to their vulnerability to adversarial attacks, which can prompt these systems to produce harmful responses. In the heart of these systems lies a safety classifier, a computational model trained to discern and mitigate potentially harmful, offensive, or unethical outputs. However, contemporary safety classifiers, despite their potential, often fail when exposed to inputs infused with adversarial noise. In response, our study introduces the Adversarial Prompt Shield (APS), a lightweight model that excels in detection accuracy and demonstrates resilience against adversarial prompts. Additionally, we propose novel strategies for autonomously generating adversarial training datasets, named Bot Adversarial Noisy Dialogue (BAND) datasets. These datasets are designed to fortify the safety classifier's robustness, and we investigate the consequences of incorporating adversarial examples into the training process. Through evaluations involving Large Language Models, we demonstrate that our classifier has the potential to decrease the attack success rate resulting from adversarial attacks by up to 60%. This advancement paves the way for the next generation of more reliable and resilient conversational agents.
