Abstract
Large Language Models (LLMs) are increasingly vulnerable to sophisticated "jailbreak" attacks that bypass safety filters. This paper introduces GuidelineLLM, a plug-and-play defensive framework that utilizes a specialized, small-scale model to analyze user queries for potential risks before response generation. By generating context-specific safety guidelines and prepending them to user prompts, GuidelineLLM triggers internal alignment mechanisms in the primary LLM. Experimental results demonstrate an average reduction in Attack Success Rate (ASR) of 34.17% across various models without the need for expensive retraining.
Introduction
As LLMs become ubiquitous, ensuring their safety against adversarial prompts is critical. Current industry standards, such as Reinforcement Learning from Human Feedback (RLHF) and red-teaming, often struggle with efficiency and generalization. Retraining massive models for every new attack vector is computationally expensive, and hard-coding safety can sometimes degrade performance on benign tasks.
GuidelineLLM addresses these challenges by shifting the focus from model modification to enhanced vigilance. It acts as a "look-before-you-leap" layer, identifying harmful intent in real-time and providing the responding model with explicit instructions on how to remain safe.
Methodology
The GuidelineLLM framework operates through a two-step inference paradigm:
- Risk Identification and Guideline Generation: A small, fine-tuned model (GuidelineLLM) processes the incoming user query. It identifies potential jailbreak patterns and generates a set of natural language safety guidelines (e.g., "Avoid promoting harmful content").
- Response Generation: These guidelines are prepended to the original query. The primary LLM, now alerted to specific risks, is more likely to activate its safety protocols and refuse harmful requests.
To train GuidelineLLM, the authors employed an iterative fine-tuning framework. They introduced T-Jailbreak, a dataset templating seven common jailbreak techniques—including Role Play, Logical Reasoning, and Program Execution—to ensure broad coverage of attack vectors.
Experimental Setup and Results
The framework was evaluated using several harmful datasets (DAN, SAP200, JailbreakChatGPT, and AutoDAN) and benign datasets (Alpaca, GPTTeacher) to monitor for over-refusal.
As shown in the results, GuidelineLLM significantly outperforms "No Defense" scenarios and often rivals or exceeds other prompting-based defenses like Self-Reminder. For the Vicuna-7B model, the average ASR dropped from 63.18% to 8.96%. Notably, when paired with the more robust Llama2-7B-Chat, GuidelineLLM achieved near-zero ASR on several benchmarks.
Key Insights
- Vigilance vs. Modification: LLMs often possess the knowledge to be safe but are distracted by complex adversarial prompts. Explicitly guiding the model's attention via the prompt can effectively trigger latent safety behaviors.
- Efficiency: Small models (e.g., Qwen2.5-1.5B) are sufficient for the GuidelineLLM role, adding minimal latency while providing a significant security boost.
- Balancing Safety and Helpfulness: Training on a mix of harmful and benign data is crucial. A safety model trained only on attacks tends toward "paranoia," leading to high False Refusal Rates (FRR). GuidelineLLM maintains high helpfulness scores (typically above 3.3/4.0).
Conclusion and Future Work
GuidelineLLM provides a flexible, efficient defense against evolving jailbreak attacks. While highly effective, its performance is tied to the primary model's instruction-following capabilities. Future research will focus on improving guideline quality through expert-level crafting and investigating potential "meta-jailbreaks" designed to circumvent prepended instructions.
Summary updated