CoT-Guard:用于强监控的小型模型
CoT-Guard: Small Models for Strong Monitoring
AI总结:
本文提出CoT-Guard,通过结合监督微调和强化学习,提升小型模型在代码生成任务中检测隐藏目标的能力,其在提示和代码攻击下的表现优于现有大模型。
摘要:
对推理链(CoT)进行监控是检测代码生成任务中隐蔽恶意行为(即隐藏目标)的一种有前景的方法。尽管大模型(如GPT-5、Gemini-3-Flash)可以作为有效的CoT监控器,但它们的部署成本高,因为推理轨迹长且API费用高,强调了需要更小、更便宜的替代方案。然而,我们发现当前的小型模型(4B-8B)在访问CoT的情况下仍难以检测隐藏目标,经常将这些目标误认为是用户查询的一部分。为此,我们提出了一种结合监督微调(SFT)和强化学习(RL)的后训练流程,其中SFT通过从更强的监控器中蒸馏检测行为来缩小领域内任务的差距,而RL在困难且微妙设计的隐藏目标上帮助模型泛化到领域外的监控任务。为了验证这种泛化能力,我们评估了在由实际供应链攻击启发的现实威胁模型下,其中攻击者是第三方LLM路由器,通过提示操纵或代码操纵攻击将隐藏目标注入代码生成请求中。为了超越大监控器已经饱和的目标,我们还引入了四个对强监控器具有挑战性的任务。最后,我们介绍了CoT-Guard,一个4B参数的监控器,其在提示和代码操纵攻击下的泛化性能表现优异,达到了75%的G-mean²(即TNR x TPR),优于GPT-5.4(56%)、GPT-5-mini(41%)和Qwen3-32B(54%),并接近Gemini-3-Flash(83%)。这些结果表明,CoT-Guard提供了一种实用且成本效益高的用户侧防御,显著提高了隐藏目标检测能力,同时避免了大监控器的部署成本。
英文摘要:
Monitoring the chain-of-thought (CoT) of reasoning models is a promising approach for detecting covert misbehavior (i.e., hidden objectives) in code generation tasks. While large models (GPT-5, Gemini-3-Flash) can serve as effective CoT monitors, they are expensive to deploy due to the lengthy reasoning traces and high API cost, emphasizing the need for smaller, cheaper alternatives. Nevertheless, we find that current small models (4B--8B) struggle to detect hidden objectives despite access to the CoT, frequently misattributing them as part of the user query. To address this, we propose a post-training pipeline combining supervised fine-tuning (SFT) and reinforcement learning (RL), where SFT narrows the gap for in-domain tasks by distilling detection behavior from stronger monitors, and RL on hard and subtly crafted hidden objectives helps the model generalize to out-of-domain monitoring tasks. To validate this generalization, we evaluate under a realistic threat model motivated by practical supply-chain attacks, where the adversary is a third-party LLM router injecting hidden objectives into code-generation requests through either prompt manipulation or code manipulation attacks. To push beyond objectives that large monitors already saturate, we also introduce four new challenging tasks even for strong monitors. Finally, we introduce CoT-Guard, a 4B-parameter monitor that demonstrates superior generalization performance under both prompt and code manipulation attacks, achieving a G-mean^2 (i.e., TNR x TPR) of 75% and outperforming GPT-5.4 (56%), GPT-5-mini (41%), and Qwen3-32B (54%), while closing the gap to Gemini-3-Flash (83%). These results demonstrate that CoT-Guard provides a practical and cost-effective user-side defense, substantially improving hidden-objective detection while avoiding the deployment cost of large monitors.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。