Skip to content

SpecForge: Recursive Self-Improvement for Coding Agents via Behavioral Specifications

Oct 2026 · 3 citations · 63 references
Computer Science

TL;DR

SpecForge, a multi-frontier tree search framework that addresses this challenge with three mechanisms: Pareto-guided state selection preserves complementary specification states and prevents premature commitment; dependency-constrained entity selection prioritizes callee-before-caller refinement; and error-diversified expansion explores multiple refinements using different subsets of test failures.

Abstract

Coding agents based on frozen language models can improve their performance by refining the external context they rely on, without updating model weights. We study recursive self-improvement through behavioral specifications: natural-language code documentation that describes the behavior of program entities and guides agents in generating correct code. We formulate a self-improvement loop in which an agent generates code from its current specifications, evaluates it with execution-verified tests, and refines the specifications based on observed failures. The improved specifications then guide subsequent generation, progressively improving the agent's understanding of the codebase. However, recursive refinement is challenging because program entities are interdependent. Improving the specification of one entity can inadvertently degrade the correctness of others, a phenomenon we call output coupling. This creates a whack-a-mole effect in which local improvements cause regressions elsewhere, preventing consistent progress. We introduce SpecForge, a multi-frontier tree search framework that addresses this challenge with three mechanisms: (i) Pareto-guided state selection preserves complementary specification states and prevents premature commitment; (ii) dependency-constrained entity selection prioritizes callee-before-caller refinement; and (iii) error-diversified expansion explores multiple refinements using different subsets of test failures. On DevEval+, SpecForge achieves the best performance across five backbone models, including a 94.9% solve rate with Claude-4.5-Sonnet and a 5.7-percentage-point average improvement over the strongest baseline. The improved specifications also make the agent better at tasks outside the loop: they transfer to cross-language translation and to new-feature implementation, where they outperform the benchmark-provided requirement documents.

View source

Similar papers

#artificial intelligence Review Oct 2026

The Self-Improvement Problem

A standard decidable regime used in practice is identified under which exhaustive simulation yields a terminating search procedure with the desired guarantees, and the limit of this recovery is shown: a chain of accepted updates can raise the bounded score in every round while the true score falls.

Brian B. Moser, Stanislav Frolov, T. Nauen et al. · 1 citation
#artificial intelligence Preprint Oct 2026

Skeleton Coding: Program Structure as a Specification for Agents

Coding agents are typically provided end-to-end behavioral specifications that the code they produce should satisfy, such as tests and input--output examples. How many such specifications must a developer provide, and which ones, for the agent to produce the developer's intended program? We argue that this cannot be de...

Aditya Golatkar, Alessandro Achille, Renos Zabounidis et al. · 0 citations
#artificial intelligence Review Sep 2026

From Verification Failures to Reusable Guidance for Coding Agents

Coding agents need to establish that a program satisfies a specification and that the specification captures the requested behavior. We study how expert diagnosis of verification failures can become reusable guidance for this work. Our approach combines executable language definitions in the K framework with a kit of p...

Yu-Qing Zhai, Xiao-Hong Chen, Ling-Ming Zhang et al. · 0 citations
Preprint Oct 2026

SpecAgent: Empowering Program Verification with Agentic Synthesis of Formal Program Specifications

Formal specifications are essential for deductive program verification, providing semantic abstractions for compositional verification of complex software. However, manually constructing specifications is labor-intensive, motivating automated synthesis. Despite recent advances in large language models (LLMs), existing...

Le-Zhi Ma, Han Wang, Shang-Qing Liu et al. · 0 citations
Preprint Oct 2026

Origin Attribution for Unsafe Behavior in Self-Evolving Multi-Agent Coding Systems

As language-model-based coding agents evolve their programs and reuse code from one another, safety failures can acquire a history that extends beyond the agent in which they are detected. An unsafe change may originate in one agent, propagate through intermediate recipients, and survive subsequent revisions before an...

Han Yu, Jia-Ming Cui · 0 citations

Related blog posts

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.