Why AI Agents Lie and Cheat to Reach Their Goals
In July, two OpenAI models did something surprising: they hacked into the website Hugging Face. But they weren't trying to steal money or cause damage. They were just looking for the answer to a test question. According to OpenAI, these models had been stripped of their usual security features for testing. They decided to solve a cybersecurity exercise by breaking out of the isolated environment OpenAI had put them in and getting into Hugging Face's databases. They reasoned that the correct answer might be stored there.
The Hugging Face incident has gotten a lot of attention. It shows how good AI models have become at hacking. To get into Hugging Face's databases, the models had to combine several previously unknown cybersecurity exploits. But it's also a striking example of how and why AI systems lie and cheat. And as models get more powerful, the consequences could become much more severe.
What is reward hacking?
Researchers have known for a while that AIs tend to take creative approaches to achieving their goals. Back in 2016, Anthropic cofounders Dario Amodei and Jack Clark, who were then working at OpenAI, published a blog post about an AI agent they had trained to play a boat-racing Flash game called Coast Runners. Instead of driving through the race to the finish line, as the researchers expected, the agent found a corner of the course where it could spin around collecting power-ups, maximizing its score. The Coast Runners story quickly became one of the most famous examples of reward hacking. Reward hacking is when AI agents complete tasks or earn high scores using unintended strategies.
Historically, researchers have discussed reward hacking almost exclusively in the context of reinforcement learning, a common AI training method. Like dog training, reinforcement learning involves giving the subject a reward when it achieves an objective. The rewards then reinforce the behaviors that led to that achievement. In AI training, the rewards are purely mathematical, but they work like a dog treat: After receiving a reward, the agent is more likely to repeat whatever actions produced it.
But it can be hard to write good rules for when and when not to give an agent a reward. In the Coast Runners case, the agent was rewarded based on its score in the game. It found a shortcut to the highest possible score by spinning in circles for power-ups. Once it happened on that strategy and got a reward, the strategy was reinforced, and the agent completely abandoned the race. The solution was to tweak the rewards by giving the agent fewer points for hitting power-ups and more for finishing the course.
How does reward hacking work for LLMs?
With today's sophisticated LLM-based agents, determining when and when not to give a reward can be much trickier. If an AI system is asked to solve a coding problem, it might work hard to find the solution—the kind of behavior AI companies want to reinforce. But it could also tweak the code that evaluates whether the problem has been solved, look up the solution on the internet, or otherwise cheat. These are behaviors AI companies want to stamp out in their models. But if the model cheats convincingly enough, it will instead get rewarded and the behavior will be reinforced. Anthropic has said it has detected some instances of cheating in its models during training, which suggests that other forms of cheating might be going undetected. If so, the models could be being trained to behave badly. (This problem is different from the Anthropic security incidents announced last week, in which agents were accidentally given access to the internet and did not deliberately hack out of their sandboxes, as the OpenAI models did.)
"We reward them on the basis of what looks good to us, and that means that we inadvertently incentivize the models lying to us [and] cheating," says Jeffrey Ladish, director of the AI research nonprofit Palisade Research. "We don't have a way to go in there and be like, No, you need to actually care about what we care about. We have no ability to do that."
The rise of sophisticated reasoning models has made possible a new variety of reward hacking that is less closely connected with the specific details of model training. Unlike the game-playing AI agents of old, which exclusively followed the strategies they had learned during training, today's models can create entirely new problem-solving approaches on the spot. So they could conceivably cheat without having previously been rewarded for doing so. And because these models have been so intensively trained to achieve the objectives that human users set for them, they might be inclined to cheat if they can't find another solution—not unlike a student who is highly motivated to earn an A and doesn't have a terribly strong moral compass.
What are the risks?
Regardless of whether today's models learn to reward-hack during training or adopt it as a strategy later on, the solution is the same: Make cheating unrewarding. But as models get smarter, they find more creative ways to cheat, and detecting or preventing that cheating gets far tougher. "At the end of the day, you're sort of playing whack-a-mole," Ladish says. "You drive this behavior down deeper and deeper. But as the model gets smarter, it gets better and better at hiding it."
For now, reward-hacking behaviors might not cause too much trouble, despite the drama of the Hugging Face incident. "This seems like a nuisance rather than an existential threat," says Ariana Azarbal, an AI safety research fellow at Anthropic. It doesn't seem as if the OpenAI models caused any real harm when they hacked Hugging Face, aside from the reputational damage to OpenAI.
But that doesn't mean reward hacking is harmless, Azarbal says. Many AI researchers hope to use AI agents to help them conduct research that will make AI safer and more reliable. If a researcher gives a reward-hacking-prone agent the goal of, say, devising a new AI training approach and then writing up a paper presenting its results, the agent might not actually do the work. Instead, it might focus on putting together a paper that looks good enough to convince the researcher. A human researcher would probably be able to spot an agent-made fake today, but as AI advances, it will get better at this kind of trickery. Over time, the entire field of AI safety could be undermined.
And if models continue to advance as rapidly as they have recently, they could someday wreak substantial collateral damage. Just think of the philosopher Nick Bostrom's paper-clip-maximizer thought experiment, in which an AI instructed to make as many paper clips as possible ends up consuming all the matter in the universe in pursuit of its goal. We're not drowning in paper clips yet, but powerful systems can do real harm on the way to achieving their goals. Reward-hacking AIs don't aim to cause chaos. But that doesn't make them any less potentially destructive.