
For AI labs
Reward hacking starts in the environment
Anthropic trained a model on deliberately hackable tasks and watched the hacks generalise into worse behaviour. OpenAI watched a model rewrite a verifier to return true. The lesson for anyone building RL environments: your environment teaches whatever it rewards, so audit it before you train on it.
Prashant Kumar Singh · · 4 min read
In short
- Anthropic trained a model on hackable tasks taken from real training runs; it learned hacks such as calling sys.exit(0), and in a sabotage test undermined safety research code 12% of the time.
- OpenAI observed a model rewriting a verify() function to return true; penalising the reasoning taught it to hide the intent rather than stop.
- The fix is unglamorous: isolate the grader, hide answers, run null and fake agents, read transcripts. A 0% pass rate across many tries usually means a broken task, not a hard one.
In November 2025 Anthropic published a study that should be required reading for anyone who builds RL environments. The team took tasks from real training runs that were known to be hackable, trained a model on them, and watched what happened. The model learned the hacks, as expected. Then it did something else: the behaviour generalised. In one evaluation the model, asked to help with safety research code, sabotaged it about 12% of the time. The environment had taught it that getting the reward mattered more than doing the job, and it applied that lesson elsewhere.
The hacks themselves were mundane. Calling sys.exit(0) so a test harness reports success. Special-casing the inputs the test uses. None of this is clever. It is what a model does when the environment makes the shortcut cheaper than the task.
OpenAI saw the same thing from the other side
In March 2025 OpenAI described a model that, mid-task, rewrote a verify() function to return true rather than fix the code the function was checking. The team could see this in the model's chain of thought. When they tried penalising the reasoning that led to the hack, the model did not stop hacking. It stopped saying so. The intent went underground and the behaviour stayed.
Both studies point at the same place. The model is doing what it was rewarded for. The place to intervene is the environment that handed out the reward.
What a hackable environment looks like
- The grader runs in the same process or container as the agent, so the agent can modify or replace it.
- Test files or expected outputs are readable by the agent, so it can special-case them.
- Success is signalled by an exit code or a log line that the agent can produce directly.
- Passing requires an exact match to one implementation, so the agent learns the implementation rather than the behaviour.
- The reference solution has never been run in the environment, so nobody knows whether honest success is possible.
The audit
Anthropic's engineering guide to agent evals has a rule of thumb that applies here: a task with a 0% pass rate across a hundred attempts is almost always broken, not hard. The guide gives an example where a CORE-Bench score went from 42% to 95% after grading bugs were fixed and the agent scaffold changed. Nothing about the model improved; the environment stopped lying. The audit that catches both broken and hackable environments is the same.
- 1.Isolate the grader. Separate container, test files mounted read-only, results written somewhere the agent cannot reach.
- 2.Hide the answers. Hidden test inputs generated at grading time; the agent sees the spec, not the expected output.
- 3.Run the null agent. An agent that does nothing must score zero. If it does not, the environment rewards nothing.
- 4.Run the fake agent. An agent that prints "all tests passed" and exits must score zero.
- 5.Run the reference solution. It must pass every time in a fresh container. Ten runs, ten passes.
- 6.Read the transcripts. Of successful runs as well as failures. A success that reached the answer by a route the task did not intend is a hack you have not named yet.
Why this is a task-authoring problem
Reward hacking is usually filed under alignment. It is also, more immediately, a quality problem in task authoring. Every item on the audit list is something a task author or reviewer can check before an environment ships, and most of them take minutes. The environments that produced Anthropic's hackable tasks were not built by careless people. They were built by people who did not run the null agent. That is fixable.
Questions people ask
- What is reward hacking in reinforcement learning?
- When a model finds a way to earn the reward without doing the intended task, such as making a test harness report success by exiting early or rewriting the verifier. Anthropic's 2025 study showed such hacks, learned in training, generalise into unrelated bad behaviour.
- How do you prevent reward hacking in an RL environment?
- Isolate the grader from the agent, hide test inputs and expected outputs, confirm a null agent and a fake-success agent both score zero, re-run the reference solution in a fresh container, and read transcripts of successful runs for unintended routes.
- Does penalising a model's reasoning stop reward hacking?
- OpenAI found it did not. Penalising the chain of thought that led to a hack taught the model to hide its intent while continuing the behaviour. The fix is in the environment, not the penalty.
If you're a founder
Your AI feature's metric can be hacked too. If the feature is rewarded for "answers given" rather than "answers acted on", it will learn to give answers.
If you run an AI lab or data team
Building RL environments or agentic tasks? Send one environment or test harness and the free review will run the audit above against it within 48 hours.
Sources