TrajGuard: 解码时隐藏状态轨迹检测用于解码时对抗防御
TrajGuard: Streaming Hidden-state Trajectory Detection for Decoding-time Jailbreak Defense
AI总结:
本文提出TrajGuard,通过解码时隐藏状态轨迹实时检测风险,实现95%的防御率,降低检测延迟至5.2ms/token,且误报率低于1.5%。
摘要:
现有对抗防御方法主要依赖静态检测提示、输出或内部状态,往往忽视解码过程中风险的动态演变。本文实证表明,解码阶段关键层的隐藏状态携带更强更稳定的风险信号。基于此,提出TrajGuard,通过滑动窗口聚合隐藏状态轨迹实时量化风险,仅在局部窗口风险持续超过阈值时触发轻量语义判定,从而立即中断或约束后续解码。在12种对抗攻击和多种开源大语言模型上的实验表明,TrajGuard实现了95%的平均防御率,检测延迟降至5.2ms/token,且误报率低于1.5%。这些结果证实了解码阶段的隐藏状态轨迹能有效支持实时对抗检测,为无需模型修改的防御方向提供了新方向。
英文摘要:
Existing jailbreak defense paradigms primarily rely on static detection of prompts, outputs, or internal states, often neglecting the dynamic evolution of risk during decoding. This oversight leaves risk signals embedded in decoding trajectories underutilized, constituting a critical blind spot in current defense systems. In this work, we empirically demonstrate that hidden states in critical layers during the decoding phase carry stronger and more stable risk signals than input jailbreak prompts. Specifically, the hidden representations of tokens generated during jailbreak attempts progressively approach high-risk regions in the latent space. Based on this observation, we propose TrajGuard, a training-free, decoding-time defense framework. TrajGuard aggregates hidden-state trajectories via a sliding window to quantify risk in real time, triggering a lightweight semantic adjudication only when risk within a local window persistently exceeds a threshold. This mechanism enables the immediate interruption or constraint of subsequent decoding. Extensive experiments across 12 jailbreak attacks and various open-source LLMs show that TrajGuard achieves an average defense rate of 95%. Furthermore, it reduces detection latency to 5.2 ms/token while maintaining a false positive rate below 1.5%. These results confirm that hidden-state trajectories during decoding can effectively support real-time jailbreak detection, highlighting a promising direction for defenses without model modification.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。