攻击推理大模型的过度思考,用恶意输入大幅增加计算开销却不影响效果。
Excessive Reasoning Attack on Reasoning LLMs
- 设计三重损失函数,诱导模型产生冗余推理路径。
- 在GSM8K和ORCA上使推理长度提升3到9倍,性能基本不变。
- 攻击可迁移,对多个主流推理模型都有效,适合安全与防御研究者。
近期推理型大语言模型(如OpenAI o1和DeepSeek-R1)通过测试时推理扩展,在复杂任务上表现优异。但已有研究指出,这些模型常因过度推理而产生显著计算开销,例如频繁切换推理路径(如浅思)或对简单问题重复推敲(如深思)。本文揭示一种新威胁:可通过构造对抗性输入,利用模型的过度推理行为,显著增加计算负担而不损害其任务性能。为此,我们提出一个包含三部分的损失框架:(1) 优先交叉熵损失,通过利用自回归特性强化关键标记;(2) 过度推理损失,鼓励模型在推理中启动额外路径;(3) 延迟终止损失,延长推理过程并推迟最终输出生成。我们在DeepSeek-R1-Distill-LLaMA和DeepSeek-R1-Distill-Qwen模型上对GSM8K和ORCA数据集进行优化与评估,结果表明推理长度提升3至9倍,且性能保持相当。此外,所构造的对抗样本具备强迁移性,可在o3-mini、o1-mini、DeepSeek-R1和QWQ等模型中引发计算开销增加。
原文摘要 · Abstract (English)
Recent reasoning large language models (LLMs), such as OpenAI o1 and DeepSeek-R1, exhibit strong performance on complex tasks through test-time inference scaling. However, prior studies have shown that these models often incur significant computational costs due to excessive reasoning, such as frequent switching between reasoning trajectories (e.g., underthinking) or redundant reasoning on simple questions (e.g., overthinking). In this work, we expose a novel threat: adversarial inputs can be crafted to exploit excessive reasoning behaviors and substantially increase computational overhead without compromising model utility. Therefore, we propose a novel loss framework consisting of three components: (1) Priority Cross-Entropy Loss, a modification of the standard cross-entropy objective that emphasizes key tokens by leveraging the autoregressive nature of LMs; (2) Excessive Reasoning Loss, which encourages the model to initiate additional reasoning paths during inference; and (3) Delayed Termination Loss, which is designed to extend the reasoning process and defer the generation of final outputs. We optimize and evaluate our attack for the GSM8K and ORCA datasets on DeepSeek-R1-Distill-LLaMA and DeepSeek-R1-Distill-Qwen. Empirical results demonstrate a 3x to 9x increase in reasoning length with comparable utility performance. Furthermore, our crafted adversarial inputs exhibit transferability, inducing computational overhead in o3-mini, o1-mini, DeepSeek-R1, and QWQ models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。