SpecGuardBench: Can Coding Agents Construct Reliable Validation Harnesses from Natural Language Specifications?
Zhiqing Zhong, Mingyu Chen, Aoyang Fang, Yuzhong Zhang, Haoye Tian, Lionel Briand, Boxi Yu, Pinjia He
Abstract
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.
Create a lesson
Metadata
- Categories
- cs.CL, cs.SE
- Comments
- Paper Under Review
Related papers
When "Neutral" Means Irrelevant: A Construct-Validity Audit of NormAd-ETI
Shared title terminologycs.CLAarav Singh, Animesh Pathak, Christian Hoang et al.
SecondChance: Benchmarking Reliable Error Recovery in AI Agents
Shared title terminologycs.CLAtahan Dokme, Adar Avsian, Larry Heck
CocoonBench: Can Multilingual Search Agents Escape Language Information Cocoons?
Shared title terminologycs.CLHongchuan Zeng, Bowen Liu, Changjiang Gao et al.
What Makes Good Data for Training Coding Agents? A Systematic Study on SWE-Gym
Shared title terminologycs.CLYikai Zhang, Mai Xu, Yunbei Zhang et al.
How Many Examples, and Which Ones? A Study of In-Context Learning for Natural Language Inference
Shared title terminologycs.CLGeorgos Dikaios, Isidoros Perikos, Ioannis Hatzilygeroudis
How to Evaluate When You Don't Know How to Evaluate? Choosing Reliable Setups for Base Language Model Benchmarking
Shared title terminologycs.CLShenbin Qian, David Samuel, Jindřich Helcl et al.