让大模型真正执行已知的安全判断,提升生成安全响应能力
Why Not Act on What You Know? Unleashing Safety Potential of LLMs via Self-Aware Guard Enhancement
- 通过双模块设计增强模型对危险提示的识别与安全回应能力
- 在多种模型上实现99%的防御成功率,同时保持通用任务表现
- 无需训练即可部署,适合关注AI安全的实际应用者
大型语言模型在多项任务中表现出色,但仍易受到精心设计的越狱攻击。本文发现关键安全短板:尽管模型能有效识别越狱提示,却常在处理此类输入时生成不安全回复。受此启发,提出SAGE(自知型防护增强)策略,一种无需训练的防御方法,旨在将模型强大的安全识别能力与较弱的安全生成能力对齐。SAGE包含判别分析模块和判别响应模块,通过灵活的安全判别指令提升对复杂越狱攻击的鲁棒性。大量实验表明,SAGE在不同规模与架构的开源及闭源模型上均表现优异,平均防御成功率达99%,同时在通用基准上保持良好帮助性。通过隐藏状态与注意力分布的可解释性分析,揭示了检测与生成间差异的内在机制。本工作推动构建具备一致安全意识与生成行为的未来大模型。代码与数据集公开于https://github.com/NJUNLP/SAGE。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have shown impressive capabilities across various tasks but remain vulnerable to meticulously crafted jailbreak attacks. In this paper, we identify a critical safety gap: while LLMs are adept at detecting jailbreak prompts, they often produce unsafe responses when directly processing these inputs. Inspired by this insight, we propose SAGE (Self-Aware Guard Enhancement), a training-free defense strategy designed to align LLMs' strong safety discrimination performance with their relatively weaker safety generation ability. SAGE consists of two core components: a Discriminative Analysis Module and a Discriminative Response Module, enhancing resilience against sophisticated jailbreak attempts through flexible safety discrimination instructions. Extensive experiments demonstrate SAGE's effectiveness and robustness across various open-source and closed-source LLMs of different sizes and architectures, achieving an average 99% defense success rate against numerous complex and covert jailbreak methods while maintaining helpfulness on general benchmarks. We further conduct mechanistic interpretability analysis through hidden states and attention distributions, revealing the underlying mechanisms of this detection-generation discrepancy. Our work thus contributes to developing future LLMs with coherent safety awareness and generation behavior. Our code and datasets are publicly available at https://github.com/NJUNLP/SAGE.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。