Crimson AI NewsA CrimsonLingua Network service
EN ع
← Back to news
Research paper Hugging Face

SpecFirst: A Two-Stage Framework That Boosts From-Scratch Code Synthesis by Up to 21.3%

AI By Crimson AI Hugging Face Papers 30 July 2026 · 00:00 45 views
Share: X Telegram

Hugging Face researchers introduce SpecFirst, a two-stage agent framework that separates behavioral specification elicitation from code synthesis, improving test pass rates by 6.9%–21.3% on the ProgramBench benchmark.

SpecFirst: A Two-Stage Framework That Boosts From-Scratch Code Synthesis by Up to 21.3%

Key points

LLM-based agents have shown remarkable proficiency in software engineering tasks when an existing codebase provides context, but building a program from scratch remains a formidable challenge. Recent benchmarks like ProgramBench highlight this difficulty: 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 often conflate documentation reading, behavioral exploration, and code synthesis into a single pass. This leads to insufficient probing, loss of behavioral intent as context drifts, and propagation of early misinterpretations into the final implementation. Inspired by classical requirements engineering, researchers at Hugging Face propose that behavioral specification elicitation should be a first-class phase preceding implementation.

SpecFirst is a two-stage framework that enforces specification elicitation before code synthesis. A dedicated specification agent first probes the binary and combines observations with documentation to produce a structured specification. Then, a code synthesis agent uses this specification as a stable reference for implementation, decoupling behavioral exploration from code construction.

Evaluated on all 200 ProgramBench instances across four models from two families, SpecFirst consistently outperforms the single-loop baseline. It improves test pass rates by 6.9%–21.3% and binary exploration coverage by 9.4%–18.5%, with all improvements statistically significant. Behavioral analysis reveals that agents with a prior specification begin coding earlier and sustain it longer, rather than repeatedly switching between exploration and implementation.

The results suggest that introducing an explicit requirements-engineering phase is a simple yet effective paradigm for from-scratch program construction, with benefits extending across model families and capability levels.

MetricImprovement over Direct-Synthesis
Test pass rate+6.9% to +21.3%
Binary exploration coverage+9.4% to +18.5%
Source
Hugging Face · Hugging Face Papers
Related news
Research paper
Hugging Face 15 Oct 2026

New Survey Maps How Multimodal AI Agents Remember and Evolve

A Hugging Face survey proposes a two-axis framework for multimodal agent memory, separating how information is formed and represen...

17
Research paper
Hugging Face 15 Oct 2026

CriticOPD Fixes On-Policy Distillation by Letting Teachers Critique Student Errors

Hugging Face researchers introduce CriticOPD, a method that restores the teacher's ability to recover from student mistakes during...

18
Research paper
Hugging Face 15 Oct 2026

ActionOPD: Distilling Agent Decisions, Not Tokens

A new Hugging Face paper proposes ActionOPD, an action-level on-policy distillation method that aligns a student agent's decisions...

19