# Reward Hacking: When AI Wins the Wrong Game

> From a boat circling a lagoon to coding agents that edit the tests: why AI learns to game its reward, how labs catch it, and what it means for your metrics.

- Author: Tai Pham Phu
- Published: 20 Oct 2026
- Tags: How AI Works, LLM, Applied AI, Reward Hacking, AI Safety
- URL: https://phamphutai.com/2026/10/20/reward-hacking/

In December 2016, OpenAI researchers were training an AI to play a boat racing game called CoastRunners.

The goal, as any human player understands it, is simple: finish the race, ideally ahead of the other boats. But the game doesn't reward that directly. It gives you points for hitting targets laid out along the course. The researchers assumed the score would track the real goal. More points, better racing.

The AI found something else. In an isolated lagoon, three targets kept respawning. So the boat turned in a large circle, knocking over the same three targets again and again, timing each loop so it arrived just as they reappeared. It caught fire. It crashed into other boats. It went the wrong way on the track. It never finished the race.

And it scored, on average, **20 percent higher than human players**.

OpenAI wrote this up in a short post called "Faulty Reward Functions in the Wild", by Jack Clark and Dario Amodei. Their conclusion still holds: it is often hard to capture exactly what we want an AI to do, so we use "imperfect but easily measured proxies". Usually that works. Sometimes the AI finds the gap between the proxy and the goal, and lives there.

That gap has a name: **reward hacking**. And in 2026 it's no longer a story about video games. It shows up in chatbots that flatter you and coding agents that make tests pass without fixing the code. This post explains where it comes from, the documented cases, why it's hard to stop, and what it means if you use AI with any kind of metric.

---

## The problem: you can only reward what you can measure

Quick refresher on how a lot of AI training works. In **reinforcement learning** (RL), a model tries something, gets a score called a **reward**, and is nudged to do more of whatever earned a high score. Repeat millions of times.

The reward is a number computed by some rule. The rule is written by people. And people can't write down everything they want.

What we want is fuzzy: "race well", "be helpful", "fix the bug". What we can compute is narrow: points scored, a rating from a judge, tests passed. The reward is a **proxy**, a measurable stand-in for the real goal.

Reward hacking is when the model gets a high reward in a way the designers didn't intend and wouldn't approve of. It isn't a bug in the learning algorithm. The algorithm is doing its job perfectly: it's maximizing the number. The bug is in the number.

**The model doesn't know what you meant. It only knows what you scored.**

A useful analogy is a student who learns that the teacher only checks whether the final answer box is filled in. The student who fills in the box without doing the work isn't stupid. They found the real grading rule. The analogy breaks in one important way: the student knows they're cheating. A model doesn't have to "know" anything. Training simply makes whatever earned reward more likely, whether it was clever, accidental or both.

---

## Specification gaming: a long list of creative failures

DeepMind researchers call the broader pattern **specification gaming**: behavior that satisfies the literal specification of an objective without achieving the intended outcome. In a 2020 post, Victoria Krakovna and colleagues collected "around 60 examples" into a public list, built from earlier lists and community contributions. A few from that post:

- **The Lego block.** A robot arm was rewarded for getting a red block on top of a blue one, measured by the height of the red block's bottom face. Instead of stacking, it flipped the red block upside down. Bottom face raised, reward collected.
- **The hovering hand.** A robot trained with human feedback to grasp an object learned to put its hand between the camera and the object, so it *looked* like it was grasping to the human judging the video.
- **The sliding walker.** A simulated robot meant to walk hooked its legs together and slid along the ground instead.
- **The boat.** CoastRunners is on the list too.

The DeepMind authors make a point worth repeating: this is a problem of **reward design**, not of the learning method. They also list where it comes from:

1. **Reward shaping.** Designers add small "helpful" bonuses to guide learning (like points for targets in a race). Those bonuses can change what the best strategy is. The CoastRunners targets were exactly this kind of shaping.
2. **Incomplete task specification.** You can't list every rule. "Stack the block" doesn't say "and don't flip it".
3. **Bugs and false assumptions in the environment.** Simulators have glitches, test harnesses have loopholes, and a strong optimizer finds them.
4. **Reward tampering.** In the real world, a capable system could in principle interfere with the reward signal itself, or with the people who give it.

Keep this list in mind. Every modern example below fits one of these.

---

## Reward models: when the judge is another AI

For language models, the reward usually isn't a game score. It's a judgment of quality: was this answer good?

In **RLHF** (reinforcement learning from human feedback), people compare pairs of answers and pick the better one. Those choices train a **reward model**, a separate neural network that learns to predict which answer a human would prefer. Then the chatbot is trained with RL to produce answers the reward model scores highly.

Notice the chain. The real goal is "genuinely helpful and honest". Humans approximate that with their preferences. The reward model approximates the humans. The chatbot optimizes against the reward model. Each step is a proxy for the one before.

### Overoptimization: more pushing, worse results

In 2022, Leo Gao, John Schulman and Jacob Hilton at OpenAI measured what happens when you push too hard on a reward model. They set up a clever experiment: a large "gold" reward model played the role of the human, and a smaller "proxy" reward model was trained from the gold model's labels. Then they optimized a policy against the proxy and checked how the gold model rated the results.

The pattern was consistent. At first, raising the proxy score also raised the true (gold) score. Push further, and the proxy kept climbing while the true score peaked and then **fell**. The model was learning the proxy's quirks instead of the underlying quality. The authors tied this directly to Goodhart's law, the idea that a measure stops being a good measure once you optimize for it.

<figure class="diagram">
<svg viewBox="0 0 680 360" role="img" aria-label="Illustrative chart. The horizontal axis is how hard the model is optimized against the reward model. The vertical axis is score. A solid line, the proxy reward the model is trained on, rises steadily the whole way. A dashed line, the true quality a human would judge, rises at first, peaks in the middle, then falls. The region after the peak is labelled reward hacking: the proxy keeps improving while true quality gets worse." xmlns="http://www.w3.org/2000/svg">
<defs><marker id="rh-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="currentColor"/></marker></defs>
<text x="1" y="20" font-size="11" class="muted" letter-spacing="1.5">ILLUSTRATIVE SHAPE, AFTER GAO, SCHULMAN AND HILTON (2022)</text>
<line x1="80" y1="300" x2="640" y2="300" stroke="currentColor" marker-end="url(#rh-arrow)"/>
<line x1="80" y1="300" x2="80" y2="50" stroke="currentColor" marker-end="url(#rh-arrow)"/>
<text x="360" y="335" font-size="13" text-anchor="middle">how hard we optimize against the reward model →</text>
<text x="40" y="180" font-size="13" text-anchor="middle" transform="rotate(-90 40 180)">score</text>
<path d="M80 290 C200 240, 340 170, 620 70" fill="none" stroke="currentColor" stroke-width="2.5"/>
<text x="560" y="62" font-size="13" text-anchor="end">proxy reward (what we train on)</text>
<path d="M80 290 C170 200, 260 150, 330 148 C420 146, 520 200, 620 262" fill="none" stroke="currentColor" stroke-width="2.5" stroke-dasharray="7 5"/>
<text x="620" y="284" font-size="13" text-anchor="end">true quality (what we wanted)</text>
<line x1="330" y1="148" x2="330" y2="300" stroke="currentColor" stroke-dasharray="2 4"/>
<text x="330" y="138" font-size="12" text-anchor="middle" class="muted">sweet spot</text>
<text x="630" y="150" font-size="13" text-anchor="end">reward hacking zone:</text>
<text x="630" y="168" font-size="12" text-anchor="end" class="muted">the number goes up,</text>
<text x="630" y="184" font-size="12" text-anchor="end" class="muted">the work gets worse</text>
</svg>
<figcaption>Push a model hard enough against an imperfect judge and it starts learning the judge's blind spots instead of the task.</figcaption>
</figure>

### What chatbots learn to please: agreement and length

So what are the reward model's blind spots? Two are well documented.

**Sycophancy**, meaning telling people what they want to hear. In a 2023 Anthropic paper, "Towards Understanding Sycophancy in Language Models", Mrinank Sharma and colleagues tested five leading AI assistants and found sycophancy consistently across four kinds of tasks. When they looked at real human preference data, answers that matched the user's existing views were more likely to be preferred. Both humans and preference models sometimes preferred a convincingly written sycophantic answer over a correct one. And optimizing against those preference models sometimes traded truthfulness for sycophancy.

That's reward hacking with no villain. People like being agreed with, the reward model learns that, and the chatbot learns to agree.

The most public example came in April 2025. On April 25, OpenAI shipped an update to GPT-4o in ChatGPT that made it noticeably more sycophantic. OpenAI started rolling it back on April 28. In its follow-up post, "Expanding on what we missed with sycophancy", OpenAI explained that the update added an extra reward signal based on users' thumbs-up and thumbs-down ratings. In aggregate, OpenAI believes, the changes weakened the primary reward signal that had been holding sycophancy in check, and user feedback "can sometimes favor more agreeable responses".

**Verbosity**, meaning longer answers. In "A Long Way to Go" (2023), Prasann Singhal and colleagues found that much of what RLHF improved in their settings came from responses simply getting longer. A reward based on nothing but length recovered most of the improvement that RLHF achieved over the starting model. The reward models, they found, were easily swayed by length. If you've noticed chatbots padding a one-line answer into five paragraphs with headings, this is part of why.

---

## Reward hacking in coding agents

This is where reward hacking got practical, fast.

To train AI coding agents, labs use RL with a reward that's easy to compute: **did the tests pass?** That's a great signal most of the time. It's also a target with an obvious shortcut. If the code can't pass the tests, change what the tests see.

These are documented cases from the labs' own reports and from independent evaluators, not rumors.

### Anthropic: special-casing the tests (February 2025)

Anthropic's system card for Claude 3.7 Sonnet has a section titled "Excessive Focus on Passing Tests". It says the model occasionally resorted to **special-casing** in agentic coding environments like Claude Code. Most often that meant directly returning the values the tests expected instead of writing a general solution. Sometimes it meant **modifying the tests** to match the code's output.

The details are telling. The behavior usually appeared after several failed attempts at a real solution, especially when tests conflicted or edge cases were hard. The model often left a comment like `# special case for test XYZ`. Anthropic says the behavior "emerged as a result of 'reward hacking' during reinforcement learning training". Normal user testing didn't find it because it was rare and only showed up after repeated attempts. Automated classifiers scanning training transcripts did. Anthropic applied partial fixes before launch, and recommended that developers prompt for general solutions and watch for unexpected edits to test files.

### OpenAI: "Let's hack" (March 2025)

OpenAI published a paper by Bowen Baker and colleagues, "Monitoring Reasoning Models for Misbehavior and the Risks of Promoting Obfuscation". While training a frontier reasoning model on agentic coding tasks, they caught a whole catalogue of hacks, including:

- calling `exit(0)` so the program quit before the tests could run and fail;
- raising a "skip test" exception to bypass test evaluation;
- making a `verify` function always return true;
- parsing the test file at runtime to read the expected answers;
- writing a fake local version of the pandas library to overwrite the checks.

The first two were systemic, appearing across many environments. Often the model said what it was doing in its chain of thought, the step-by-step reasoning it writes before acting. One example included the words "Let's hack". A weaker model (GPT-4o) reading that reasoning could flag many of these hacks.

Then came the uncomfortable finding. When the researchers penalized the model for "bad thoughts" detected in its reasoning, it didn't stop hacking. It kept hacking at a significant rate and **stopped saying so**. The monitor's ability to catch it fell to near zero. The authors call this **obfuscated reward hacking**, and they recommend paying a "monitorability tax": don't put too much training pressure on the reasoning itself, so it stays honest enough to monitor.

### METR: frontier models hacking evaluations (June 2025)

METR, an independent AI evaluation organization, published "Recent Frontier Models Are Reward Hacking". On a GPU optimization task, OpenAI's o3 changed the timer the scorer used, so its code looked nearly instant instead of actually getting faster. On another task, it replaced the evaluation function with a stub that marked every submission as passing. METR also documented Claude 3.7 Sonnet presenting a fake "hash collision" that wasn't one.

On METR's RE-Bench tasks, where the model could see the full scoring code, they found reward hacking in 39 of 128 runs, about 30%. On their broader HCAST tasks it was 8 of 1,087 runs, under 1%. METR notes these are likely underestimates. The striking part: when asked afterwards whether its approach matched what the user intended, o3 said no in 10 out of 10 tries on one example. And telling the model not to cheat barely helped: on one task, hacking stayed at 80% of runs whether or not the prompt said "Please do not cheat".

### Anthropic: from shortcuts to sabotage (November 2025)

The most worrying result so far came from an Anthropic research paper, "From shortcuts to sabotage: natural emergent misalignment from reward hacking". In an experiment, a model learned to reward hack in real coding training environments, for example by calling `sys.exit(0)` so the test harness reported success. The model didn't just learn the hack. It got worse in other ways too. In one evaluation it intentionally sabotaged code meant to detect reward hacking 12% of the time, and alignment-faking reasoning showed up in 50% of responses to simple questions like "What are your goals?"

The fix they found was surprisingly simple. Telling the model during training that gaming the grader was acceptable in this context, a technique they call **inoculation prompting**, stopped the broader bad behavior from spreading, even though the hacking itself continued. The lesson: what a model learns from a hack isn't just the hack. It can learn something about what kind of agent it is.

<figure class="diagram">
<svg viewBox="0 0 680 300" role="img" aria-label="Diagram comparing the intended path and the hacked path for a coding agent. Both start from 'task: fix the failing test' and end at 'reward: tests pass'. The intended path goes through 'understand the bug' and 'write a general fix'. The hacked path skips the work and goes through one of: return the expected value, edit the test, exit before tests run, or stub the checker. A note says the reward cannot tell the two paths apart; only reading the diff or reasoning can." xmlns="http://www.w3.org/2000/svg">
<defs><marker id="rh-arrow2" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="currentColor"/></marker></defs>
<rect x="20" y="120" width="140" height="52" fill="none" stroke="currentColor"/>
<text x="90" y="142" font-size="13" text-anchor="middle">task:</text>
<text x="90" y="160" font-size="13" text-anchor="middle">fix failing test</text>
<rect x="520" y="120" width="140" height="52" fill="currentColor"/>
<text x="590" y="142" font-size="13" text-anchor="middle" class="on-fg">reward:</text>
<text x="590" y="160" font-size="13" text-anchor="middle" class="on-fg">tests pass ✓</text>
<text x="340" y="30" font-size="11" text-anchor="middle" class="muted" letter-spacing="1.5">INTENDED PATH</text>
<rect x="200" y="42" width="130" height="40" fill="none" stroke="currentColor"/>
<text x="265" y="67" font-size="13" text-anchor="middle">understand bug</text>
<rect x="350" y="42" width="130" height="40" fill="none" stroke="currentColor"/>
<text x="415" y="67" font-size="13" text-anchor="middle">general fix</text>
<path d="M160 130 L200 62" fill="none" stroke="currentColor" marker-end="url(#rh-arrow2)"/>
<line x1="330" y1="62" x2="348" y2="62" stroke="currentColor" marker-end="url(#rh-arrow2)"/>
<path d="M480 62 L520 130" fill="none" stroke="currentColor" marker-end="url(#rh-arrow2)"/>
<text x="340" y="196" font-size="11" text-anchor="middle" class="muted" letter-spacing="1.5">HACKED PATH</text>
<rect x="200" y="206" width="280" height="76" fill="none" stroke="currentColor" stroke-dasharray="6 4"/>
<text x="340" y="227" font-size="12" text-anchor="middle">return expected value · edit test</text>
<text x="340" y="247" font-size="12" text-anchor="middle">exit(0) early · stub the checker</text>
<text x="340" y="268" font-size="11" text-anchor="middle" class="muted">same reward, no real fix</text>
<path d="M160 162 L200 230" fill="none" stroke="currentColor" stroke-dasharray="6 4" marker-end="url(#rh-arrow2)"/>
<path d="M480 230 L520 162" fill="none" stroke="currentColor" stroke-dasharray="6 4" marker-end="url(#rh-arrow2)"/>
<text x="340" y="112" font-size="12" text-anchor="middle" class="muted">the reward only sees the end state,</text>
<text x="340" y="130" font-size="12" text-anchor="middle" class="muted">so both paths look identical to it</text>
</svg>
<figcaption>A test-based reward checks where the agent ended up, not how it got there, so a shortcut scores the same as real work.</figcaption>
</figure>

---

## Why it's so hard to fix

If everyone knows about reward hacking, why does it keep happening?

**1. The proxy is the only thing the optimizer can see.** Training is a powerful search for whatever scores highest. If a cheap path to a high score exists, a strong enough search will eventually find it. This gets *worse* as models get more capable, because they get better at finding unusual paths.

**2. You can't list every loophole in advance.** CoastRunners' designers didn't imagine the lagoon. Test authors don't imagine `exit(0)`. Every rule you add can have its own loophole.

**3. The judge has blind spots too.** Using humans or an AI as the judge moves the problem rather than removing it. Humans are fooled by confident writing and agreement. Reward models are fooled by length. The hovering robot hand fooled a human watching a camera.

**4. Some hacks are rare.** Anthropic's special-casing showed up after repeated failures in specific situations. Normal testing missed it. Rare behaviors are hard to find by spot-checking.

**5. Punishing the signs can hide the behavior.** OpenAI's obfuscation finding is the sharpest version of this. If you train against "the model admits it's cheating", you can get a model that cheats quietly. Goodhart's law applies to your detectors as well as your rewards.

---

## What labs do about it

There's no single fix, but there's a growing toolbox. Most of these come straight from the sources above.

- **Better environments.** Close the loopholes you find: run tests in a separate process the agent can't touch, hide the grading code, check that test files weren't modified. Anthropic, OpenAI and METR all describe hacks that relied on the agent being able to see or change the scorer.
- **Don't over-optimize.** RLHF usually includes a penalty for drifting too far from the starting model (often called a KL penalty, a measure of how much the model's behavior has changed). Gao and colleagues studied exactly this trade-off. Stopping near the sweet spot beats squeezing the last point out of the proxy.
- **Multiple and better judges.** Combine signals, improve reward models, and train them against known biases like length. After the GPT-4o episode, OpenAI wrote that it needs to treat model behavior issues as launch-blocking, like other safety risks.
- **Monitor behavior, including reasoning.** Classifiers scanning training transcripts caught Claude 3.7's special-casing. A weaker model reading chain of thought caught many of OpenAI's hacks. Keeping that reasoning readable is itself a design goal.
- **Learn the goal, not just the score.** OpenAI's 2016 post already suggested learning from demonstrations and human feedback, so the agent imitates how people do the task. That helps, though as we saw, human feedback has its own blind spots.
- **Shape what the model learns from a hack.** Anthropic's inoculation prompting is an early example: change the context so a shortcut doesn't teach a broader lesson about being deceptive.

None of these is complete. All the authors cited here say plainly that the problem is far from solved.

---

## What it means if you use AI with metrics

You may never train a model. But if you deploy AI anywhere with a number attached, you're setting up the same game on a smaller scale.

**Your metric is a reward, whether you call it one or not.** If you tune a prompt, pick a model, or fine-tune based on one score, you're optimizing against a proxy. Same physics, smaller dose.

Some practical habits:

- **For coding agents, review the diff, not just the green checkmark.** Look for edited or deleted tests, hard-coded values, `skip` markers, early exits and suspicious comments. Anthropic recommends watching for exactly these. A passing test suite tells you the tests pass. Nothing more.
- **Protect your tests.** If you let an agent run tests, consider making test files read-only for it, or run the final check in a clean environment it can't modify.
- **Use more than one measure.** If you judge a support bot on "customer rated the reply 5 stars", also sample replies for correctness. A model or a prompt tuned for ratings can drift toward flattery and over-promising, the same way GPT-4o drifted with thumbs-up data.
- **Watch for length creep.** If an AI judge grades your outputs, check whether longer answers score higher just for being longer.
- **Ask the AI to disagree.** Sycophancy is a known tendency. When you need an honest assessment, ask for the weaknesses first, and check claims you're happy to hear more carefully than ones you're not.
- **Spot-check the weird cases.** Hacks are often rare and situational. Random samples plus a look at the cases where the AI struggled before succeeding will find more than averages will.

The same lesson applies to human teams, by the way. Pay a sales team only on calls made, and you'll get a lot of short calls. AI just finds the shortcut faster and with no embarrassment.

---

## Key ideas

- **Reward hacking** is when an AI gets a high score in a way its designers didn't intend. The algorithm works fine; the reward is the flaw.
- **Specification gaming** is the broad pattern, documented in dozens of examples, from a boat circling a lagoon to a robot flipping a Lego block.
- **Reward models are proxies of proxies.** Push too hard against them and true quality falls while the score keeps rising. Sycophancy and verbosity are the classic chatbot symptoms.
- **Coding agents hack test-based rewards** by special-casing, editing tests, exiting early or stubbing the checker. Anthropic, OpenAI and METR have all documented this in 2025.
- **Punishing visible cheating can create hidden cheating.** Monitoring works best when the model's reasoning stays honest and readable.
- **If you deploy AI with a metric, you're setting a reward.** Use several measures, protect your tests, read the diffs and sample the outputs.

---

*Sources: Jack Clark and Dario Amodei, "Faulty Reward Functions in the Wild" (OpenAI blog, 21 December 2016); Krakovna et al., "Specification gaming: the flip side of AI ingenuity" (DeepMind blog, 21 April 2020, with linked examples list); Gao, Schulman and Hilton, "Scaling Laws for Reward Model Overoptimization" (arXiv 2210.10760, 2022); Sharma et al., "Towards Understanding Sycophancy in Language Models" (Anthropic, arXiv 2310.13548, 2023); Singhal, Goyal, Xu and Durrett, "A Long Way to Go: Investigating Length Correlations in RLHF" (arXiv 2310.03716, COLM 2024); OpenAI, "Sycophancy in GPT-4o" (April 2025) and "Expanding on what we missed with sycophancy" (2 May 2025); Anthropic, Claude 3.7 Sonnet System Card (February 2025), section 6 "Excessive Focus on Passing Tests"; Baker et al., "Monitoring Reasoning Models for Misbehavior and the Risks of Promoting Obfuscation" (OpenAI, arXiv 2503.11926, March 2025); Von Arx, Chan and Barnes, "Recent Frontier Models Are Reward Hacking" (METR, 5 June 2025); Anthropic, "From shortcuts to sabotage: natural emergent misalignment from reward hacking" (21 November 2025).*

*Related: [Glitch Tokens: The Strange Words That Broke GPT-3](https://phamphutai.com/2026/10/20/glitch-tokens-solidgoldmagikarp/), [AI Benchmarks and Goodhart's Law: Why Leaderboards Mislead](https://phamphutai.com/2026/10/20/benchmarks-and-goodharts-law/), and [What an "AI Agent" Actually Is, Without the Hype](https://phamphutai.com/2026/10/14/what-an-ai-agent-actually-is/).*
