SpecGuardBench:编码智能体能否从自然语言规范构建可靠的验证工具?
SpecGuardBench: Can Coding Agents Construct Reliable Validation Harnesses from Natural Language Specifications?
AI总结:
本研究推出SpecGuardBench基准测试,发现4种编码智能体构建的验证工具忠实度均未超63%,瓶颈在于智能体倾向编写匹配参考实现而非规范的检查项。
摘要:
随着编码智能体的能力不断提升,测试仍是判断其代码是否正确的主要依据。然而,通过现有测试并不能证明实现代码满足其自然语言规范。可靠的验证需要能够忠实捕捉规范的检查项,以及能全面测试代码的场景,但当前基准测试无法充分反映智能体能否自行构建此类验证证据。我们推出SpecGuardBench,这是一个包含13个真实仓库的291项任务的基准测试,涵盖功能后置条件、交互协议等8种验证逻辑类型。给定自然语言规范、仓库上下文和参考实现,智能体需构建包含可执行检查项和测试场景的验证工具。检查项应拒绝违反规范的实现,同时接受符合规范的实现;测试场景应全面测试代码。在4种专有及开放权重编码智能体中,没有一种智能体在基准测试的实现任务中构建出的验证工具,其忠实度得分超过63%。瓶颈不在于探索测试场景,而在于构建忠实反映规范的检查项。具体而言,智能体明显倾向于编写与参考实现而非规范匹配的检查项,因此会拒绝规范允许的实现。
英文摘要:
As coding agents become more capable, tests remain the primary evidence for judging whether their code is correct. Yet passing available tests does not establish that an implementation satisfies its natural language specification. Reliable validation requires checks that faithfully capture the specification and scenarios that thoroughly exercise the code, but current benchmarks provide limited insight into whether agents can construct such evidence themselves. We introduce SpecGuardBench, a benchmark of 291 tasks from 13 real-world repositories, covering 8 types of verification logic such as functional postconditions and interaction protocols. Given a natural language specification, repository context, and a reference implementation, an agent constructs a validation harness comprising executable checks and test scenarios. The checks should reject implementations that violate the specification while accepting those that satisfy it, and the scenarios should thoroughly exercise the code. Across four proprietary and open-weight coding agents, none constructs a harness scored as faithful on the benchmark's implementations for more than 63% of the tasks. The bottleneck lies less in exploring test scenarios than in constructing checks that faithfully reflect the specification. Specifically, the agents show a clear tendency to write checks that mirror the reference implementation rather than the specification, and therefore reject implementations that the specification permits.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。