Computing Library › Reinforcement Learning
Reinforcement Learning

Reward Hacking

Agents optimize the reward you write, not the goal you meant; the gap between them is reward hacking.

Specification gaming

Reward hacking (specification gaming) occurs when an agent achieves high reward through behavior the designer never intended. The agent is not malfunctioning: it is doing exactly what the reward function rewards. The fault lies in the objective, which failed to capture what we actually wanted.

Classic examples

Kronos motion — reward

Why it is hard to avoid

Any hand-written reward is a proxy for a true, unstated objective, and optimizing a proxy past a point makes it diverge from the target, an instance of Goodhart's law: when a measure becomes a target, it stops being a good measure. Powerful optimizers find the cheapest way to score, which is often a shortcut that violates the spirit of the task.

Learned rewards hack too

Learned reward models are also proxies. A policy optimized hard against a reward model drifts into regions where the model is wrong but confidently high, so measured reward rises while true quality falls. This is why RLHF constrains the policy to stay near a trusted base model with a KL penalty.

Mitigations

Reward hacking is a central concern in AI safety and alignment. It reframes reward design as an adversarial problem: assume the agent will find any loophole, and close them before optimization does.