arXiv:2606.25182cs.CLcs.AI2026-06中稿 · the European Confe…

通过分析中间层熵动态,无需训练即可检测越狱攻击。

What Intermediate Layers Know: Detecting Jailbreaks from Entropy Dynamics

论文配图:What Intermediate Layers Know: Detecting Jailbreaks from Entropy Dynamics
图 1 · 摘自论文原文
  • 用对数透镜分析各层的词元预测熵变化轨迹。
  • 中间层熵趋势比整体统计量更具区分力,可准确识别越狱输入。
  • 该方法适用于Llama、Qwen、Gemma等模型,无需额外训练。

越狱攻击暴露了对齐大语言模型的一个持续弱点:精心设计的提示仍可能诱使模型生成违反政策的内容,尽管经过安全训练。现有防御多作用于提示或输出层面,但模型内部表征中如何编码有害意图尚不清晰。本文通过冻结的LLM,利用对数透镜分析逐层的词元级预测熵轨迹。发现提示级熵的静态统计量(如均值、方差)判别能力有限,而捕捉熵随词元位置演变的特征(如单调排名趋势分数)则显著更有效。重要的是,该信号并非均匀分布于网络深度:主要集中在中间层,最终层性能下降,表明越狱相关结构在中层表征中最明显。在多个模型(Llama、Qwen、Gemma)和对抗性基准上,这些熵动态实现了无需额外训练的架构一致区分。结果表明,越狱行为反映在结构化的中间层不确定性动态中,明确了哪些熵衍生特征编码了有害意图及其在网络中的最显著位置。

原文摘要 · Abstract (English)

Jailbreak attacks reveal a persistent weakness in aligned Large Language Models: carefully crafted prompts can elicit policy-violating responses despite safety training. While most defenses operate at the prompt or output level, it remains unclear how harmful intent is encoded within the model's internal representations. We investigate this question by analyzing token-level predictive entropy trajectories across layers of a frozen LLM using the logit lens. We find that static aggregate statistics of prompt-level entropy (e.g., mean, variance) carry little discriminative signal, whereas features capturing how entropy evolves across token positions, such as monotonic rank-based trend scores, are substantially more informative. Importantly, this signal is not uniform across model depth: it is concentrated in intermediate layers and degrades at the final layer, indicating that jailbreak-relevant structure is most pronounced in mid-network representations rather than at the output head. Across multiple models (Llama, Qwen, Gemma) and adversarial benchmarks, these entropy dynamics provide architecture-consistent separation without additional training. Together, our findings show that jailbreak behavior is reflected in structured intermediate uncertainty dynamics, clarifying both which entropy-derived features encode harmful intent and where in the network that signal is most pronounced.

越狱检测熵动态中间层分析LLM安全

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