arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.00971cs.LGcs.AI
收藏

推理作为安全的自适应防御

Reasoning as an Adaptive Defense for Safety

Carnegie Mellon University(卡内基梅隆大学)

Taeyoun Kim, Fahim Tajwar, Aditi Raghunathan, Aviral Kumar

AI总结:

本研究提出TARS强化学习训练方法,使LLM通过自适应推理在安全与任务完成间取得更好权衡,增强对越狱攻击的鲁棒性。

摘要:

自适应分配测试时计算资源的推理方法已经提升了大型语言模型在易于验证的领域(如数学和代码)中的性能。在这项工作中,我们研究了如何利用这种方法来训练模型,使其对安全漏洞表现出一定程度的鲁棒性,并表明这样做可以带来益处。我们构建了一个名为TARS(训练自适应安全推理器)的配方,这是一种强化学习(RL)方法,通过思维链轨迹和平衡安全与任务完成的奖励信号来训练模型进行安全推理。为了构建TARS,我们确定了三个关键设计选择:(1)一个“轻量级”的预热监督微调(SFT)阶段,(2)混合有害、无害和模糊提示以防止诸如过多拒绝之类的捷径行为,以及(3)一个防止训练期间推理能力退化的奖励函数。使用TARS训练的模型表现出自适应行为,在模糊查询上花费更多计算资源,从而实现更好的安全-拒绝权衡。它们还在内部学会更好地区分安全和不安全的提示,并增强对白盒(如GCG)和黑盒(如PAIR)攻击的鲁棒性。总体而言,我们的工作提供了一种有效的、开放的配方,通过逐提示推理来训练LLM抵御越狱攻击和有害请求。

英文摘要:

Reasoning methods that adaptively allocate test-time compute have advanced LLM performance on easy to verify domains such as math and code. In this work, we study how to utilize this approach to train models that exhibit a degree of robustness to safety vulnerabilities, and show that doing so can provide benefits. We build a recipe called $\textit{TARS}$ (Training Adaptive Reasoners for Safety), a reinforcement learning (RL) approach that trains models to reason about safety using chain-of-thought traces and a reward signal that balances safety with task completion. To build TARS, we identify three critical design choices: (1) a ``lightweight'' warmstart SFT stage, (2) a mix of harmful, harmless, and ambiguous prompts to prevent shortcut behaviors such as too many refusals, and (3) a reward function to prevent degeneration of reasoning capabilities during training. Models trained with TARS exhibit adaptive behaviors by spending more compute on ambiguous queries, leading to better safety-refusal trade-offs. They also internally learn to better distinguish between safe and unsafe prompts and attain greater robustness to both white-box (e.g., GCG) and black-box attacks (e.g., PAIR). Overall, our work provides an effective, open recipe for training LLMs against jailbreaks and harmful requests by reasoning per prompt.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑