[论文解读] A Lightweight Explainable Guardrail for Prompt Safety
LEG presents a lightweight, modular guardrail that jointly classifies prompts as safe/unsafe and highlights contributing words, trained with synthetic explanations and a novel joint loss, achieving strong in-domain and out-of-domain performance with much smaller models.
We propose a lightweight explainable guardrail (LEG) method for the classification of unsafe prompts. LEG uses a multi-task learning architecture to jointly learn a prompt classifier and an explanation classifier, where the latter labels prompt words that explain the safe/unsafe overall decision. LEG is trained using synthetic data for explainability, which is generated using a novel strategy that counteracts the confirmation biases of LLMs. Lastly, LEG's training process uses a novel loss that captures global explanation signals and combines cross-entropy and focal losses with uncertainty-based weighting. LEG obtains equivalent or better performance than the state-of-the-art for both prompt classification and explainability, both in-domain and out-of-domain on three datasets, despite the fact that its model size is considerably smaller than current approaches. If accepted, we will release all models and the annotated dataset publicly.
研究动机与目标
- Motivate safe deployment of LLMs by detecting unsafe prompts with transparent reasoning.
- Develop a modular guardrail that does not require fine-tuning the base LLM.
- Enable explainability by identifying words in prompts that drive safety decisions.
- Leverage synthetic explanation data to train explainability without excessive data collection.
- Propose a joint loss that blends strong supervision with weak, explainability-guided signals.
提出的方法
- A lightweight architecture with a shared transformer encoder, attention pooling, and two linear heads for prompt safety and explanation labeling.
- Synthetic word-level explanation labels generated via adversarial prompts to counter LLM confirmation bias, using GPT-4o-mini.
- A novel multitask loss combining cross-entropy with focal loss and uncertainty-based weighting to balance tasks.
- Auxiliary weak supervision δt (token polarization) and δp (prompt polarization) derived from global token usage statistics, with constant-time lookup during training.
- Joint optimization of prompt classification and explainability classification in a multi-task learning framework.
实验结果
研究问题
- RQ1Can a lightweight guardrail achieve competitive prompt safety classification performance relative to larger baselines?
- RQ2Do jointly trained explainability classifiers produce faithful, actionable word-level explanations?
- RQ3Does synthetic explanation data guided by counter-bias strategies improve explainability and robustness across domains?
- RQ4What is the impact of the proposed joint loss (with weak supervision and focal modulation) on in-domain and out-of-domain performance?
- RQ5Is the guardrail computationally efficient enough for real-time deployment while maintaining quality explanations?
主要发现
- LEG achieves state-of-the-art or near-SOTA prompt safety performance on three datasets in-domain and out-of-domain, with significantly smaller models (xs, base, large).
- Explainability classification by LEG consistently outperforms baselines, with explainable outputs that are faithful to the model’s decisions (faithfulness shown by token masking tests).
- A lightweight model (as small as 22M parameters) rivals larger baselines on several out-of-domain settings, demonstrating robustness and efficiency.
- A novel joint loss with weak supervision signals δp 和 δt and focal loss modulation improves out-of-domain performance in 71% of cases in ablation studies.
- The auxiliary weak supervision adds negligible training overhead but improves robustness and generalization across datasets.
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。