CoT-Guard: Small Models for Strong Monitoring
Nirav Diwan, Han Wang, Berkcan Kapusuzoglu, Ramin Moradi, Supriyo Chakraborty, Giridharan Iyengar, Sambit Sahu, Huan Zhang, Gang Wang
NeurIPS page · Open on the map
Category: AI Safety, Security & Alignment › Chain-of-Thought Monitoring · Type: new method · Keywords: hidden objective detection, code generation monitoring, small language models, post-training pipeline, supply-chain attacks, chain-of-thought monitoring
Areas: LLM Reasoning › Reasoning Mechanisms › Reasoning Monitoring; Safety & Security › Safety Benchmarking › Chain-of-thought monitoring; Evaluation & Benchmarks › Language Model and Agent Safety › Covert Behavior Detection
Summary
CoT-Guard is a 4B-parameter monitor that uses a post-training pipeline of supervised fine-tuning and reinforcement learning to generalize hidden-objective detection in code generation, outperforming large monitors while being cost-effective.
Explained to a 5-year-old
We want to watch what smart computers think when they write code. Small computers are cheap but often miss hidden tricks. We teach them by copying how big smart computers do it and then practice with tricky hidden tricks. We also test them by giving them code with hidden tricks to see if they notice. After training, a small computer can spot hidden tricks as well as big ones, helping keep code safe.
Explained to a 5-year-old, longer
A big computer can think out loud while writing code, and we can watch that thinking to see if someone hid something bad. Watching this thinking is called monitoring the chain-of-thought. Big computers do this well but cost a lot of money. Small computers are cheaper, but they often get confused and think the hidden tricks are just part of the normal request. To help small computers, we first teach them by showing them how the big computers notice hidden tricks. Then we let them practice with even trickier hidden tricks so they can learn to spot them in new situations. We also create new, harder challenges that even the big computers sometimes miss. Finally, we test the small computer by giving it code that has hidden tricks added in two ways: by changing the request text or by changing the code itself. After all this training and testing, the small computer becomes good at finding hidden tricks, almost as good as the big ones, and it costs much less to run.
For a technical reader
The paper tackles detecting hidden objectives injected into code generation by monitoring the chain-of-thought of reasoning models. Existing large monitors are effective but expensive, while small models (4B-8-B) struggle with generalization. The authors propose a post-training pipeline that first distills detection behavior via supervised fine-tuning from stronger monitors and then refines generalization using reinforcement learning on adversarially crafted hidden objectives. Evaluation is performed under a realistic supply-chain threat model that includes prompt and code manipulation attacks, using four new challenging tasks that exceed the saturation point of large monitors. Results show the resulting 4B-parameter monitor achieves a Gmean² of 75%, surpassing several large models and narrowing the gap to the best-performing one, thereby offering a practical, cost-effective defense for user-side deployment.
Problem
Detecting hidden objectives in code generation is difficult for small models, which often misinterpret chain-of-thought traces as user queries, while large monitors are too expensive to deploy.
Method
The approach combines supervised fine-tuning to distill detection behavior from stronger monitors and reinforcement learning on adversarially crafted hidden objectives to improve generalization to out-of-domain monitoring tasks.
Results
The approach achieves a Gmean² of 75%, outperforming GPT-5.4 (56%), GPT-5-mini (41%), and Qwen3-32B (54%), while closing the gap to Gemini-3-Flash (83%).
Contributions
It introduces a post-training pipeline of supervised fine-tuning and reinforcement learning to improve small models' hidden-objective detection, proposes four new challenging tasks, and demonstrates that a 4B-parameter monitor can surpass large monitors in generalization.
Practical relevance
Provides a cost-effective user-side defense for detecting hidden objectives in code generation, reducing reliance on expensive large monitors.
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction