arXiv:2502.01042cs.LG2025-02EMNLP被引 29

通过内部信号动态调控大模型有害输出,安全提升80%且不影响性能。

SafeSwitch: Steering Unsafe LLM Behavior via Internal Activation Signals

  • 利用探测器监测模型内部状态,实时识别潜在危害意图。
  • 仅在必要时触发安全模块,使有害输出减少约80%。
  • 只需微调不足6%参数,适合追求高效安全控制的开发者。

大型语言模型(LLMs)在多种任务中表现出色,但也存在生成有害内容的风险。现有安全机制虽提升安全性,却常导致过度保守,未能充分利用模型内部认知过程。受人类反思思维启发,我们首次证明LLMs可在内部状态中进行安全评估。基于此,提出SafeSwitch:一种动态框架,通过基于探测器的内部状态监控器主动检测有害意图,并在必要时激活安全头,引导更安全、保守的响应。该方法在有害查询上将有害输出降低约80%,同时保持强实用性,在多个方法中达到帕累托最优。相比传统方法,SafeSwitch提供更富信息量、上下文感知的拒绝响应,且仅需微调少于6%的原始参数。该研究展示了大模型在安全方面的自我意识与反思能力,为实现更精细有效的安全控制提供了新思路。代码已公开于 https://github.com/Hanpx20/SafeSwitch。

原文摘要 · Abstract (English)

Large language models (LLMs) exhibit exceptional capabilities across various tasks but also pose risks by generating harmful content. Existing safety mechanisms, while improving model safety, often lead to overly cautious behavior and fail to fully leverage LLMs' internal cognitive processes. Inspired by humans' reflective thinking capability, we first show that LLMs can similarly perform internal assessments about safety in their internal states. Building on this insight, we propose SafeSwitch, a dynamic framework that regulates unsafe outputs by utilizing the prober-based internal state monitor that actively detects harmful intentions, and activates a safety head that leads to safer and more conservative responses only when necessary. SafeSwitch reduces harmful outputs by approximately 80% on harmful queries while maintaining strong utility, reaching a Pareto optimal among several methods. Our method is also advantageous over traditional methods in offering more informative, context-aware refusals, and achieves these benefits while only tuning less than 6% of the original parameters. SafeSwitch demonstrates large language models' capacity for self-awareness and reflection regarding safety, offering a promising approach to more nuanced and effective safety controls. Codes for this work are available at https://github.com/Hanpx20/SafeSwitch.

大模型安全动态调控内部信号自省机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。