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 25 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 31 Aug 2026

Hugging Face Unveils StepGuard: Step-Level Guardrails for Safer AI Agents

StepGuard, a new step-level guard model from Hugging Face, audits agent actions before execution, reducing attack success rates by...

1
Research paper
Hugging Face 31 Aug 2026

Hugging Face Researchers Unveil ABot-Recon for Stable Long-Horizon 3D Reconstruction

ABot-Recon, a new streaming 3D reconstruction model from Hugging Face, achieves stable long-horizon performance using only local t...

1
Research paper
Hugging Face 31 Aug 2026

ContextPilot: Teaching Agents Proactive Context Management via Fine-Grained RL

Hugging Face researchers introduce ContextPilot, a framework that enhances long-horizon agent reasoning by expanding context-editi...

1