解码前拒绝:检测与利用大语言模型中间激活中的拒绝信号
文章背景与核心概要
大语言模型的安全性一直是AI领域的核心议题,传统的安全对齐评估与防御通常依赖于对模型最终输出的观察。然而,模型的安全决策机制究竟在何时、何地发生?本文深入探讨了能否在最终解码步骤之前,通过大语言模型的中间激活来检测和预测拒绝行为。研究人员利用在各个Transformer块残差流激活上训练的线性探针(linear probes),发现在输出生成之前的极早阶段,拒绝信号就已经呈线性可解码状态。
基于这一洞察,作者提出了“机理AutoDAN”(Mechanistic AutoDAN),这是一种引入探针指导的AutoDAN框架变体。该方法在遗传提示词搜索循环中,用部分前向传播(partial forward passes)和基于探针的评分替代了昂贵的全模型适应度评估。实验表明,该方法不仅实现了与原始AutoDAN相竞争的攻击成功率(ASR),还将单次迭代的搜索时间大幅减少了高达 72%。更重要的是,研究发现探针指导的有效性随着模型规模的扩大而增强,这证明了中间激活分析可以为离散越狱优化提供高效的搜索信号,特别针对强大且规模庞大的模型展现出巨大威力。
执行摘要
This paper investigates whether Large Language Model (LLM) refusal behavior can be detected and predicted from intermediate activations before the final decoding step. Using linear probes trained on residual stream activations across transformer blocks, the authors demonstrate that refusal signals are linearly decodable well ahead of final output generation.
本文研究了是否可以在最终解码步骤之前,通过大语言模型的中间激活检测和预测大语言模型的拒绝行为。通过在各个transformer块的残差流激活上训练线性探针,作者证明了拒绝信号在最终输出生成之前很久就已经可以被线性解码。
To leverage this insight practically, the researchers introduce Mechanistic AutoDAN, a probe-guided variant of the AutoDAN framework. By substituting full-model fitness evaluations with partial forward passes and probe-based scoring inside a genetic prompt search loop, the method achieves competitive attack success rates while reducing per-iteration search time by up to 72%. Furthermore, probe-guided prompt performance scales with model size, proving that intermediate activation analysis offers an efficient search signal for discrete jailbreak optimization—especially against robust, large-scale models.
为了在实践中利用这一洞察,研究人员引入了 Mechanistic AutoDAN(机理AutoDAN),这是AutoDAN框架的一个探针引导变体。该方法在遗传提示词搜索循环中,用部分前向传播和基于探针的评分取代了全模型适应度评估,在实现具有竞争力的攻击成功率的同时,将每轮迭代搜索时间减少了高达 72%。此外,探针引导的提示词性能随模型规模而扩展,这证明了中间激活分析可以为离散越狱优化提供高效的搜索信号——特别是针对鲁棒的大规模模型。
摘要 (Abstract)
In this paper, we investigate whether refusal behavior can be predicted from LLM intermediate activations before decoding using linear probes trained on residual stream activations at each transformer block. We find that refusal is linearly decodable well before the final layer, indicating that safety-relevant behavior is represented in intermediate activations before output generation. To test whether this signal is actionable, we introduce Mechanistic AutoDAN, a probe-guided variant of AutoDAN that replaces full-model fitness evaluation with partial forward passes and probe-based scoring inside a genetic prompt search loop. Across the evaluated models, our method achieves attack success rates competitive with vanilla AutoDAN while reducing per-iteration search time by up to 72%, and probe-guided prompts match or exceed AutoDAN's cross-model transfer in several configurations. We further find that the usefulness of probe guidance increases with model scale. Our results suggest that refusal-relevant information is decodable from intermediate activations and can serve as an effective search signal in an AutoDAN-style discrete jailbreak optimization loop, especially for larger and more robust models.
在本文中,我们研究了在使用在每个transformer块的残差流激活上训练的线性探针时,是否可以在解码前从LLM中间激活预测拒绝行为。我们发现拒绝行为在最后一层之前就已经可以线性解码,这表明安全相关的行为在输出生成之前的中间激活中就已表示。为了测试该信号是否具可操作性,我们引入了Mechanistic AutoDAN,它是AutoDAN的探针引导变体,用遗传提示词搜索循环内的部分前向传播和基于探针的评分替换了全模型适应度评估。在评估的模型中,我们的方法实现了与原生AutoDAN相竞争的攻击成功率,同时将每次迭代的搜索时间减少了高达72%,并且探针引导的提示词在几种配置中匹配或超过了AutoDAN的跨模型迁移能力。我们进一步发现探针引导的实用性随模型规模的增大而增加。我们的结果表明,拒绝相关信息可以从中间激活中解码,并可以在AutoDAN风格的离散越狱优化循环中充当有效的搜索信号,特别是对于更大、更稳健的模型。
核心亮点与贡献 (Key Highlights & Contributions)
- 早期可解码性 (Early Decodability): 拒绝行为在最终解码层之前的中间残差流激活中就可以被线性解码。
- 机理AutoDAN (Mechanistic AutoDAN): AutoDAN遗传提示词搜索算法的一种新颖的、探针引导的迭代版本,依赖于部分前向传播而不是全模型评估。
- 效率提升 (Efficiency Gains): 在保持具有竞争力的攻击成功率(ASR)的同时,将每轮迭代搜索时间减少了高达 72%。
- 跨模型迁移与规模效应 (Cross-Model Transfer & Scale): 探针引导的提示词展示了强劲的迁移能力,且探针引导的效用与更大、更稳健的LLM规模成正比扩展。