The Verified Reward Trap

Published:

The Verified Reward Trap

Have you ever tried to understand a vibecoded repo? It is a nightmare. Sure, the code may pass all test cases, but reading it makes you wonder how it works at all. There will be isinstance checks scattered everywhere, fallback chains that silently replace errors with defaults, ginormous god classes, and copies of almost the same function. These are basic design mistakes you would expect a competent software engineer to catch. But AI agents rarely do the same.

Why does a model that can solve incredibly difficult programming problems write code like this?

I suspect it is partly because of what its training rewards.

Verifiable Rewards in RL

Modern coding models are increasingly trained using reinforcement learning with verifiable rewards. The model writes a program, the program runs against test cases, and the results provide the reward. DeepSeek-R1 and Qwen3-Coder both describe using execution feedback in their training.

This has clear advantages. A reward model might incorrectly judge whether a program works. Executing it gives a grounded signal, and the process can be automated across many problems.

However, tests that only check outputs do not distinguish between a clean implementation and spaghetti code that produces the same results. They do not tell us whether the abstractions make sense, whether existing functionality was unnecessarily duplicated, or whether another engineer can understand and safely modify the code later.

These properties matter when maintaining a repository. But if they do not affect the reward, that reward gives no direct incentive to preserve them.

This is the verified reward trap: we treat passing the tests as the objective, even though much of what makes code maintainable is outside those tests.

I hypothesize this contributes to AI-generated slop. There is some indirect evidence for this claim. Researchers found that adding code quality rewards during reinforcement learning improved the generated code, both on their quality metrics and according to human reviewers who did not know which model wrote each answer.

The problem can also compound as agents build on their earlier code. In SlopCodeBench, researchers asked agents to repeatedly extend their own implementations. Redundancy and structural deterioration generally increased across iterations.

I also suspect this could affect future generations of models. If more of their training data comes from unreviewed AI-generated code, they may learn the same bad habits.

Who Will Read the Code?

I have a somewhat radical expectation here. For much of everyday software, I think human-readable code will gradually stop being a requirement.

Think of your typical frontend that needs one more button. If an agent can produce it, there will be pressure to accept it without paying someone to understand the implementation. As generation gets cheaper, that pressure grows.

Of course, messy code can make the agent’s next task harder too. Human readability and ease of maintenance are related, but they are not the same requirement. I expect this change to happen first with short-lived tools and applications where a failure is cheap to fix.

Readable, carefully reviewed code will remain important where failures are expensive. But for most applications, I think the norm will be code that works under the conditions we tested, even when nobody understands the whole implementation.

The models are obviously getting better. But I doubt better models alone will give people a reason to read the code. The era of software engineering where humans are expected to read and understand every change is ending, and it is not coming back.