arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2505.07167cs.CRcs.CL
收藏

一个触发标记就足够:一种在大型语言模型中平衡安全性和可用性的防御策略

Decoding One Safety Trigger Token for Balancing Safety and Usability in Large Language Models

Xidian University(西安电子科技大学);Victoria University of Wellington(惠灵顿维多利亚大学);Westlake University(西湖大学)

Haoran Gu, Handing Wang, Yi Mei, Mengjie Zhang, Yaochu Jin

AI总结:

本研究提出D-STT算法,通过识别和解码安全触发标记,有效提升大型语言模型的安全性,同时保持其可用性与响应效率。

摘要:

大型语言模型(LLMs)已被广泛应用于虚拟助手、自动化代码生成和科学研究等多个领域。然而,它们仍然容易受到劫持攻击的影响,这些攻击会迫使模型生成有害的响应,尽管模型已经对安全性进行了对齐。最近的研究表明,当前的安全对齐LLMs进行的是浅层的安全对齐。在本工作中,我们深入研究了这一现象的底层机制,并揭示出这种现象通过学习的“安全触发标记”表现出来,当这些标记与特定输入配对时,会激活模型的安全模式。通过分析和实证验证,我们进一步展示了安全触发标记在不同有害输入之间具有高度相似性。因此,我们提出了D-STT,一种简单而有效的防御算法,该算法识别并明确解码给定的安全对齐LLM的安全触发标记,以激活模型学习到的安全模式。在这个过程中,安全触发被限制为一个标记,这有效地通过在解码过程中引入最小的干预来保持模型的可用性。在广泛的劫持攻击和良性提示上的广泛实验表明,D-STT显著减少了输出的有害性,同时保持了模型的可用性,并带来了可忽略的响应时间开销,优于十种基线方法。

英文摘要:

Large Language Models (LLMs) have been extensively used across diverse domains, including virtual assistants, automated code generation, and scientific research. However, they remain vulnerable to jailbreak attacks, which manipulate the models into generating harmful responses despite safety alignment. Recent studies have shown that current safety-aligned LLMs undergo shallow safety alignment. In this work, we conduct an in-depth investigation into the underlying mechanism of this phenomenon and reveal that it manifests through learned ''safety trigger tokens'' that activate the model's safety patterns when paired with the specific input. Through both analysis and empirical verification, we further demonstrate the high similarity of the safety trigger tokens across different harmful inputs. Accordingly, we propose D-STT, a simple yet effective defense algorithm that identifies and explicitly decodes safety trigger tokens of the given safety-aligned LLM to activate the model's learned safety patterns. In this process, the safety trigger is constrained to a single token, which effectively preserves model usability by introducing minimum intervention in the decoding process. Extensive experiments across diverse jailbreak attacks and benign prompts demonstrate that D-STT significantly reduces output harmfulness while preserving model usability and incurring negligible response time overhead, outperforming ten baseline methods.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑