arXiv:2601.10543cs.AIcs.CL2026-01被引 4

通过解码时探测内在安全信号,提前识别并阻止越狱攻击。

Defending Large Language Models Against Jailbreak Attacks via In-Decoding Safety-Awareness Probing

  • 在解码过程中主动探测模型内部隐藏的安全信号。
  • 对多种越狱攻击检测率超90%,误拒率低于10%。
  • 适合需要高安全性的实际部署场景使用。

大型语言模型(LLMs)在自然语言任务中表现卓越,并被广泛应用于真实场景。尽管已进行大量安全对齐工作,但研究显示这些对齐仍较浅层,易受越狱攻击影响。现有防御机制如基于解码的约束和事后内容检测器,在面对复杂越狱攻击时,常面临检测不鲁棒或严重降低模型可用性的问题。本文研究了LLM的解码过程,发现即使成功越狱,模型在生成过程中仍会表现出潜在的安全相关信号,但这些信号被追求流畅续写的内在驱动力所掩盖,导致无法及时自我纠正或拒绝。基于此观察,我们提出一种简单有效的方案:在解码阶段显式暴露并利用这些潜在安全信号,实现对不安全内容的早期检测。在多种越狱攻击上的实验表明,该方法显著提升安全性,同时保持低误拒率(<10%)和高响应质量。结果表明,激活解码过程中的内在安全意识,为防御越狱攻击提供了一条有前景且互补的新路径。代码已公开于:https://github.com/zyz13590/SafeProbing。

原文摘要 · Abstract (English)

Large language models (LLMs) have achieved impressive performance across natural language tasks and are increasingly deployed in real-world applications. Despite extensive safety alignment efforts, recent studies show that such alignment is often shallow and remains vulnerable to jailbreak attacks. Existing defense mechanisms, including decoding-based constraints and post-hoc content detectors, struggle against sophisticated jailbreaks, often intervening robust detection or excessively degrading model utility. In this work, we examine the decoding process of LLMs and make a key observation: even when successfully jailbroken, models internally exhibit latent safety-related signals during generation. However, these signals are overridden by the model's drive for fluent continuation, preventing timely self-correction or refusal. Building on this observation, we propose a simple yet effective approach that explicitly surfaces and leverages these latent safety signals for early detection of unsafe content during decoding. Experiments across diverse jailbreak attacks demonstrate that our approach significantly enhances safety, while maintaining low over-refusal rates on benign inputs and preserving response quality. Our results suggest that activating intrinsic safety-awareness during decoding offers a promising and complementary direction for defending against jailbreak attacks. Code is available at: https://github.com/zyz13590/SafeProbing.

大模型安全越狱防御解码探测

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