SACP-Coder: State-based Adaptive Computation for Progressive Code Generation
Abstract
Code generation performance has been considerably improved by recent agentic systems, but such gains are often accompanied by increased token consumption. To better adjust computation, existing adaptive methods either select a solving method before generation or repeatedly revise candidate code using test feedback under a predefined strategy. However, these methods tend to use the same solving strategy as a problem’s solving state evolves, overlooking changes in computational needs and potentially wasting tokens on unnecessary computation. To better balance performance and cost, we propose SACP-Coder, a state-adaptive framework that dynamically adjusts computation to match evolving solving needs. We design state-adaptive mechanisms, including retrieval augmentation, problem reformulation, and dual-level correction, and progressively adapt their use to the solver state characterized by candidate solutions and public-test execution outcomes. In particular, problem reformulation facilitates solving challenging problems by deriving a simpler problem with the same core algorithmic structure and transferring its solution pattern back to the original problem. Experiments on four code generation benchmarks across three LLMs demonstrate a favorable performance–cost trade-off. SACP-Coder reduces average token consumption by over 76% relative to comparably accurate baselines on each LLM backbone.
Then back it, or bet against it.
Related papers
Open the market on this paper to see 7 more related papers.