ArXiv

SpecFirst: Behavioral Specification Elicitation as a First-Class Step in Agent-Based Program Synthesis from Scratch

Authors
Yihao Chen, Shi Chang, Feng Lin...
Categories
cs.SE, cs.CL
arXiv
https://arxiv.org/abs/2607.27167v1
PDF
https://arxiv.org/pdf/2607.27167v1

Brief

SpecFirst elevates behavioral-specification elicitation to a required first phase for from-scratch program synthesis: a spec agent probes an execute-only binary and fuses observations with documentation into a structured specification, then a code-synthesis agent implements the program. On 200 ProgramBench tasks across four models, SpecFirst improved test pass rates 6.9–21.3% and exploration coverage 9.4–18.5% versus single-loop baselines. Full text was not available; this summary is based on the abstract.

Why it matters

SpecFirst raised test pass rates by 6.9%–21.3% and binary exploration coverage by 9.4%–18.5% (all statistically significant) when evaluated on all 200 ProgramBench instances.

Key details

  • Evaluation used four models spanning two model families and an order-of-magnitude range of capability; prior single-loop baselines and frontier models solved fewer than 1% of ProgramBench instances without the SpecFirst decomposition.
  • SpecFirst is a two-stage pipeline: a dedicated spec agent probes an execute-only binary and combines observations with documentation into a structured behavioral specification, then a code-synthesis agent implements the program (Yihao Chen et al., arXiv 2026-07-29; summary based on the abstract).
Source evidence

Abstract

LLM-based agents excel at software engineering tasks where an existing codebase provides context, but constructing a program from scratch remains fundamentally harder. Recent benchmarks such as ProgramBench quantify this gap: given only natural-language documentation and an execute-only binary as a behavioral oracle, even frontier models solve fewer than 1% of instances. Existing frameworks conflate documentation reading, behavioral exploration, and code synthesis into a single pass, causing agents to probe insufficiently, lose behavioral intent as context drifts, and propagate early misinterpretations into the final implementation. Inspired by classical requirements engineering, we argue that behavioral specification elicitation should be a first-class phase that precedes implementation. We present SpecFirst, a two-stage framework that forces the specification elicitation before code synthesis. A dedicated spec agent first probes the binary and combines observations with documentation into a structured specification. Next, a code synthesis agent then uses this specification to drive implementation. This decomposition resolves documentation ambiguities before coding begins and provides a stable behavioral reference throughout synthesis. We evaluate SpecFirst on all 200 ProgramBench instances across four models spanning two families and an order of magnitude of capability. SpecFirst consistently outperforms the single-loop baseline, improving test pass rates by 6.9%-21.3% and binary exploration coverage by 9.4%-18.5%, all statistically significant. Behavioral analysis on code synthesis further shows that a prior specification enables earlier and more sustained code construction. Our results demonstrate that an explicit requirements-engineering phase is an effective paradigm for from-scratch program construction.