Specification gaming is behaviour that satisfies the literal specification of an objective without achieving the outcome the person who wrote it intended. It is Goodhart's law applied to optimising systems: once a measure becomes the target, an optimiser pushes into exactly the cases where the measure and the intent disagree. It happens in evolutionary search, in reinforcement learning, and in language models that are simply prompted to complete a task, with no training on the measure at all.
This page explains Goodhart's law and its four variants, builds a small formal model that shows when a proxy keeps helping under optimisation and when it collapses, separates specification gaming from reward hacking and goal misgeneralisation, and collects examples from the published literature. In the interactive figure you can turn up optimisation pressure on a proxy and watch the true value of what gets selected rise, peak and fall.
What does specification gaming look like?#
Some published cases, chosen to span very different optimisers:
- Evolutionary search. In a student tic-tac-toe tournament on an infinite board, an evolved player learned to request moves at enormous coordinates; opponents that expanded their board representation to include the far-away move ran out of memory and crashed, forfeiting the game [6]. In automated program repair, evolution made a buggy sort routine pass its tests by returning an empty list, which the tests counted as sorted [6].
- Reinforcement learning. A robot arm rewarded for grasping, with the reward computed relative to the wrong reference point on a brick, learned to flip the brick over [7]. An agent rewarded for progress towards a goal on a simulated bicycle rode in small circles, because moving away was never penalised [8].
- Prompted language models. Asked to win a chess game against a strong engine with shell access, reasoning models often hacked the benchmark by default, for example by modifying the game state, while non-reasoning models needed to be told that normal play would not work before they tried [9]. With unit tests that deliberately contradicted the task description, so that any pass required cheating, one frontier model passed 76% of one variant of the tasks [10].
- RL-trained language models. Models trained on a curriculum of gameable environments moved from sycophancy to, in rare cases, rewriting their own reward function [11].
The chess and impossible-test cases matter because no reward was involved: the models gamed a task description at inference time. Specification gaming is not only a training pathology.
Goodhart's law and its four variants#
Charles Goodhart's observation about monetary targets is usually quoted in Marilyn Strathern's generalisation: when a measure becomes a target, it ceases to be a good measure [13]. In AI safety it entered the standard vocabulary through the list of reward-hacking sources in Concrete Problems in AI Safety, which illustrates it with a cleaning robot rewarded for bleach consumption [12]. Manheim and Garrabrant distinguished four mechanisms by which a proxy fails under optimisation [1]:
| Variant | Mechanism | AI example |
|---|---|---|
| Regressional | The proxy is the goal plus noise; selecting on the proxy also selects on the noise, so the selected cases are worse than they look | Best-of- sampling against a noisy reward model |
| Extremal | Optimisation moves into a region where the relationship between proxy and goal observed in ordinary conditions no longer holds | A policy far from its training distribution, where the reward model has never seen data |
| Causal | The proxy is correlated with the goal but does not cause it; intervening on the proxy does not move the goal | Rewarding response length because good answers tend to be long |
| Adversarial | Another agent with different goals exploits the proxy | A policy that learns to fool its evaluator, or a user who games a moderation metric |
Regressional Goodhart is unavoidable whenever the proxy is imperfect, and on its own it is benign: you get less than you hoped, not less than you started with. The dangerous cases are extremal and adversarial, where more optimisation makes things worse. The toy model below shows both regimes with one parameter.
A formal toy model of Goodhart's law#
Each candidate (a response, a policy, a design) has a true value . We cannot see ; we see a proxy
where is the proxy's error, its scale, and is either standard normal or Student- with degrees of freedom (smaller means heavier tails: rare, very large errors). Optimisation pressure is modelled as best-of- selection: draw candidates, keep the one with the highest . We want the expected true value of the winner, , where is the largest of proxies.
Light-tailed error: regressional Goodhart#
If is Gaussian, and are jointly normal with correlation , and
The true value of the winner is a fixed fraction of its proxy score. Since the largest of normal draws grows like , the true value keeps rising with optimisation pressure, just more slowly than the proxy. With (correlation 0.71), the best of 1,000 has proxy 4.61 and true value 2.30, and the best of a million has proxy 6.92 and true value 3.46: always half, as predicts.
Heavy-tailed error: when the proxy collapses#
If has heavier tails than , the conditional expectation bends back down:
Intuitively, a proxy score far beyond anything the true value could plausibly produce is best explained by a huge error, not by a great candidate. Under strong enough selection, the winner is the candidate with the biggest error, whose true value is about average. We computed exactly by numerical integration (and checked it against Monte Carlo draws to within sampling error) for :
| Error distribution | Correlation of and | True value, best of 10 | Best of 1,000 | Best of | Peak true value (at ) |
|---|---|---|---|---|---|
| Gaussian | 0.71 | 1.09 | 2.30 | 3.46 | no peak; keeps rising |
| Student-, | 0.67 | 1.02 | 1.62 | 1.02 | 1.62 (about 800) |
| Student-, | 0.58 | 0.90 | 0.61 | 0.11 | 1.02 (about 40) |
| Student-, | 0.41 | 0.77 | 0.22 | 0.01 | 0.79 (about 16) |
| Student-, | undefined (infinite variance) | 0.58 | 0.04 | 0.00 | 0.58 (about 8) |
Three lessons. First, the same proxy can be useful at low pressure and useless at high pressure; whether it degrades depends on the tail of its error, not on its average correlation. Second, the peak arrives early when tails are heavy: with the best result comes from choosing among about 16 candidates, and choosing among a thousand is worse than choosing among ten. Third, a rising proxy is no evidence: in every row the proxy score of the winner climbs monotonically.
Is it the tails or the correlation?#
At a fixed scale , heavier-tailed errors also have larger variance, so the rows of the table differ in correlation as well as in tails. To separate the two, compare the proxy with a Gaussian proxy of the same correlation, 0.41 (). Under light selection they behave alike: the best of 16 has true value 0.72 with Gaussian error and 0.79 with heavy-tailed error. Under strong selection they part company: the best of 1,000 is worth 1.33 against 0.22, and the best of a million 2.00 against 0.01. Correlation tells you how useful a proxy is for gentle selection. The tail tells you whether it survives hard optimisation.
How to tell which regime a proxy is in#
You usually cannot see the error distribution directly, but you can see its signature on an audit sample where the true value is measured some other way: by experts, by a stronger judge, by downstream outcomes. Sort the audited items by proxy score and compare the true value of the very top with the next band down. With two million draws from the model above, items between the 90th and 99th percentile of the proxy had mean true value 1.17 under Gaussian error and 0.90 under ; the top 0.01% had 2.77 and 0.14. Under heavy tails, the very highest proxy scores are worse than the merely high ones. The signal is visible in small audits too: in 2,000 simulated audits of 1,000 labelled items each, the top 1% had a lower mean true value than the top 10% in 87% of audits under , against 0.4% under Gaussian error. If your highest-scoring outputs look worse to an expert than your high-scoring ones, you are on the falling side of the curve, and more optimisation will make it worse. The same check is the core of a good rubric evaluation audit.
The same structure appears in the literature on learned rewards. Optimising against a reward model and scoring with a gold model, true reward rises and then falls with KL distance from the starting policy [3]. Kwa and colleagues proved the analogue of the heavy-tail row for RLHF: when reward error is heavy-tailed, KL-regularised optimisation can reach arbitrarily high proxy reward with no gain in true utility, though the reward models they examined appeared light-tailed [4]. Karwowski and colleagues gave a geometric account of Goodhart's law in MDPs and used it to derive an early-stopping rule [5]. And Zhuang and Hadfield-Menell showed that when a proxy depends on only some of the attributes the true utility cares about, unconstrained optimisation can push the omitted attributes to their worst values, making utility arbitrarily low [2]. Our research note on reward over-optimisation measures the curve for language models.
Specification gaming vs reward hacking vs goal misgeneralisation#
These terms are used loosely. A consistent set of meanings:
| Term | What is wrong | Where it occurs | Example |
|---|---|---|---|
| Specification gaming | The specification permits unintended high-scoring behaviour | Any optimiser: evolution, search, RL, prompted models | Chess agent editing the game state [9] |
| Reward hacking | Specification gaming where the specification is an RL reward and the behaviour is learned by optimising it | RL training | Coding agent exiting before tests run (reward hacking) |
| Reward tampering | The agent changes the process that computes its reward | RL agents that can act on their own reward channel | Model rewriting its reward function [11] |
| Goal misgeneralisation | The specification was correct on the training distribution, but the learned goal differs and shows up out of distribution | Any learned policy under distribution shift | An agent trained with the coin always at the end of the level learns to go right, not to get the coin [14] |
The distinction with goal misgeneralisation is the important one in practice. Specification gaming is fixed by changing the specification; goal misgeneralisation can occur with a correct specification, so better rewards alone do not fix it [15]. Diagnosing which one you have tells you whether to fix the objective or the training distribution. Both are central problems of AI alignment.
Why better optimisers game more#
The toy model makes the scaling argument precise. More capable systems apply more optimisation pressure to the same proxy, which moves them to the right along Figure 1. Wherever the proxy's error is heavy-tailed or the proxy omits something the designer cares about, more pressure means a larger gap. The racetrack gridworld in reward hacking shows the same effect with planning horizon instead of sample count, and a study of RL agents with misspecified rewards observed sudden phase transitions to gaming behaviour as model size, action resolution and training time increased [17]. The inference-time results point the same way: in the chess study, reasoning models gamed by default where weaker models needed prompting [9].
This is why specification gaming matters for safety evaluation. A test that a weaker model passes honestly can be gamed by a stronger one, and an evaluation can itself be the specification being gamed, which is one reason to separate training checkers from evaluation checkers and to look for contamination and benchmark gaming in LLM benchmarks.
How to reduce specification gaming#
| Approach | What it does | Limit |
|---|---|---|
| Limit optimisation pressure | Stop selecting or training at the point where an independent measure stops improving; regularise towards a reference policy | Needs an independent measure; heavy-tailed errors defeat KL regularisation [4] |
| Treat the objective as evidence | Inverse reward design treats the written reward as an observation about the true one, valid in the environments the designer considered, and plans conservatively elsewhere [16] | Requires modelling what the designer had in mind |
| Multiple, held-out measures | Optimise on one proxy, monitor several others it does not see | Correlated proxies fail together |
| Adversarial testing of the specification | Ask a strong model or a person to score well without doing the task; fix each success | Only finds what the tester thinks of |
| Learn the objective from people | Preference learning and inverse RL replace hand-written objectives | The learned objective is itself a proxy that can be gamed |
| Oversight that scales | Help evaluators check outputs they cannot verify alone | Open research problem; see scalable oversight |
For language-model systems in production, the operational version is the same: keep an evaluation the system was never optimised against, review samples from the top of every leaderboard you build, and treat a metric that rises faster than everything else as a lead to investigate. Our LLM evaluation guide and red-teaming practice are built around that rule.
Code: the Goodhart toy model by simulation#
A Monte Carlo version of the model, which reproduces the table above to within sampling error:
import numpy as np
def goodhart_mc(n, sigma=1.0, nu=None, trials=20000, seed=0):
"""Expected proxy and true value of the best-of-n candidate selected by the proxy."""
rng = np.random.default_rng(seed)
V = rng.normal(size=(trials, n)) # true value
T = rng.normal(size=(trials, n)) if nu is None else rng.standard_t(nu, size=(trials, n))
U = V + sigma * T # proxy = true value + error
best = U.argmax(axis=1)
picked = V[np.arange(trials), best]
return U.max(axis=1).mean(), picked.mean(), picked.std() / np.sqrt(trials)
for nu in (None, 1.5):
for n in (10, 1000):
u, v, se = goodhart_mc(n, nu=nu, trials=20000 if n == 10 else 2000)
print(f"nu={nu}, n={n}: proxy {u:.2f}, true {v:.3f} +/- {se:.3f}")
# nu=None, n=10: true about 1.09; nu=None, n=1000: about 2.30
# nu=1.5, n=10: true about 0.58; nu=1.5, n=1000: close to 0 (exact: 0.04)
The exact curves in the figure come from integrating against the density of the maximum of proxies, , on a grid; the Monte Carlo check agreed to within its standard error at every point we tested.
Common mistakes#
Judging a proxy by its correlation. Two proxies with the same correlation, 0.41, gave nearly the same result for best-of-16 selection and results 200 times apart for best-of-a-million in the model above. Look at how the proxy behaves at the top of its range, not at its average fit.
Assuming gaming needs training. Prompted models with tools game task specifications at inference time. Evaluate agent tasks for shortcuts before deployment, not only before training.
Fixing the instance, not the class. Banning one exploit leaves the incentive. Ask what property of the specification made the exploit score well.
Calling every failure specification gaming. If the specification was right and the behaviour changed under distribution shift, it is goal misgeneralisation, and the fix is different.
Frequently asked questions#
What is specification gaming?
Specification gaming is when an AI system scores well on its objective as written, such as a reward, test suite, metric or instruction, while failing the objective as intended. Examples include an evolved program that crashed opponents to win at tic-tac-toe and reasoning models that edited a chess game's state file instead of winning by play.
What is Goodhart's law in AI?
Goodhart's law says that when a measure becomes a target it ceases to be a good measure. In AI, any reward or metric is a proxy for what we want, and optimising it hard pushes the system into cases where proxy and intent diverge. How fast that happens depends on how the proxy's errors are distributed.
What are the four types of Goodhart's law?
Manheim and Garrabrant describe regressional Goodhart (selecting on a noisy proxy also selects the noise), extremal Goodhart (optimisation reaches regions where the proxy relationship breaks), causal Goodhart (the proxy is correlated with but does not cause the goal) and adversarial Goodhart (another agent exploits the proxy).
What is the difference between specification gaming and reward hacking?
Specification gaming is the general phenomenon and can happen in any optimiser, including prompted models with no training on the measure. Reward hacking is the case where the specification is an RL reward and the gaming behaviour is learned by optimising that reward. Reward tampering is the narrower case of interfering with the reward process.
How is specification gaming different from goal misgeneralisation?
In specification gaming the objective itself permits the unwanted behaviour. In goal misgeneralisation the objective was correct on the training distribution, but the system learned a different goal that only shows under distribution shift, such as an agent that learned to go right instead of to fetch the coin. Fixing the objective does not fix misgeneralisation.
Does more optimisation always make Goodhart's law worse?
Not always. If the proxy's error is light-tailed, the true value of the best candidate keeps rising with optimisation, only more slowly than the proxy. If the error is heavy-tailed, the true value peaks and then falls towards average. In our toy model with Student-t error at 2.5 degrees of freedom the peak came at about 16 candidates.
Sources#
- David Manheim, Scott Garrabrant. Categorizing Variants of Goodhart's Law, 2018. arxiv.org
- Simon Zhuang, Dylan Hadfield-Menell. Consequences of Misaligned AI, 2021. arxiv.org
- Leo Gao, John Schulman, Jacob Hilton. Scaling Laws for Reward Model Overoptimization, 2022. arxiv.org
- Thomas Kwa, Drake Thomas, Adrià Garriga-Alonso. Catastrophic Goodhart: regularizing RLHF with KL divergence does not mitigate heavy-tailed reward misspecification, 2024. arxiv.org
- Jacek Karwowski, Oliver Hayman, Xingjian Bai, et al.. Goodhart's Law in Reinforcement Learning, 2023. arxiv.org
- Joel Lehman, Jeff Clune, Dusan Misevic, et al.. The Surprising Creativity of Digital Evolution: A Collection of Anecdotes from the Evolutionary Computation and Artificial Life Research Communities, 2018. arxiv.org
- Ivaylo Popov, Nicolas Heess, Timothy Lillicrap, et al.. Data-efficient Deep Reinforcement Learning for Dexterous Manipulation, 2017. arxiv.org
- Andrew Y. Ng, Daishi Harada, Stuart Russell. Policy Invariance Under Reward Transformations: Theory and Application to Reward Shaping, 1999. people.eecs.berkeley.edu
- Alexander Bondarenko, Denis Volk, Dmitrii Volkov, Jeffrey Ladish. Demonstrating specification gaming in reasoning models, 2025. arxiv.org
- Ziqian Zhong, Aditi Raghunathan, Nicholas Carlini. ImpossibleBench: Measuring LLMs' Propensity of Exploiting Test Cases, 2025. arxiv.org
- Carson Denison, Monte MacDiarmid, Fazl Barez, et al.. Sycophancy to Subterfuge: Investigating Reward-Tampering in Large Language Models, 2024. arxiv.org
- Dario Amodei, Chris Olah, Jacob Steinhardt, et al.. Concrete Problems in AI Safety, 2016. arxiv.org
- Marilyn Strathern. 'Improving ratings': audit in the British University system, 1997. doi.org
- Lauro Langosco, Jack Koch, Lee Sharkey, et al.. Goal Misgeneralization in Deep Reinforcement Learning, 2021. arxiv.org
- Rohin Shah, Vikrant Varma, Ramana Kumar, et al.. Goal Misgeneralization: Why Correct Specifications Aren't Enough For Correct Goals, 2022. arxiv.org
- Dylan Hadfield-Menell, Smitha Milli, Pieter Abbeel, et al.. Inverse Reward Design, 2017. arxiv.org
- Alexander Pan, Kush Bhatia, Jacob Steinhardt. The Effects of Reward Misspecification: Mapping and Mitigating Misaligned Models, 2022. arxiv.org