AI写代码:验证比生成更难
我们总以为检查答案比做答案容易,但AI写代码这件事上,这个直觉反了。现在的大模型生成代码越来越强,但怎么验证它写对了,反而成了更头疼的问题——因为任何验证器都只是人类意图的替身,不是意图本身。研究者把验证信号的质量拆成三个维度:可扩展、忠实、鲁棒,发现三者兼得几乎不可能。他们试了四种验证方式(测试用例、评分规则、真人验收、AI自动验证),结论是:没有一种固定验证方法能一直管用,验证必须跟着模型能力一起进化。它不是你明天能用上的,但解释了为什么AI写代码总出幺蛾子——不是它不会写,是没人能可靠地判断它写对了。
📄 原文摘要(英文)
A classical intuition holds that verifying a solution is easier than producing one. For today's coding agents, this intuition is being inverted: as foundation models develop stronger reasoning capabilities and engineering harnesses grow more sophisticated, generating complex candidate solutions is no longer difficult -- reliably verifying them has become the harder problem. Every verifier we can build is only a proxy for human intent, never the intent itself. This makes verification subject to a twofold difficulty: first, intent is underspecified by nature, making it inherently hard to faithfully check whether it has been fulfilled; second, during model training, optimization widens the gap between proxy and intent -- manifesting as reward hacking or signal saturation. To address this, we characterize the quality of verification signals along three dimensions -- scalability, faithfulness, and robustness -- and argue that achieving all three simultaneously is the central challenge. We further study four reward constructions: a test verifier for general coding tasks, a rubric verifier for frontend tasks, the user as verifier for real-world agent tasks, and an automated agent verifier for long-horizon tasks. Across different task types and policy capability levels, we conduct in-depth analysis and experiments on the core challenges of reward design and how to more effectively leverage reward signals. Experiments show that targeted verification design can effectively suppress reward hacking, improve task completion quality, and achieve significant gains across multiple internal and public benchmarks. These experiences collectively point to a core observation: no fixed reward function can remain effective as policy capability continues to grow; and verification must co-evolve with the generator.