提出预算可控的代码修复路由机制,动态决定是省钱重试还是升级模型。
CodeRescue: Budget-Calibrated Recovery Routing for Coding Agents
- 基于执行反馈设计恢复路由策略,判断是否用廉价模型重试或直接升级。
- 在五个基准上验证,同一预算下比固定策略和二元级联提升解题率35%以上。
- 新增校准层可自适应调整成本惩罚,无需重新训练,适合资源受限场景。
编码代理在可执行环境中运行时,失败会产生可操作的反馈而非单纯错误。现有成本感知系统通常将失败视为级联决策:先尝试低成本模型,再对复杂任务升级到更强大但昂贵的模型。但在编码任务中,执行反馈使得继续使用低成本模型进行修复也具有价值,从而引出一个预算化部署问题:何时应多花少量计算资源尝试修复,何时应直接升级?本文将此后失败决策建模为异构动作下的恢复路由,并从执行回放数据中训练监督式路由器。为使同一路由器适用于不同预算,引入共形风险控制(CRC)层,在不重新训练的情况下选择部署时的成本惩罚,且在交换性假设下提供边际期望成本控制。在五个编码基准的保留失败样本上,低成本修复与升级展现出互补的成功模式。校准后的前沿性能优于固定动作、仅提示路由器及二元级联基线;在主要的GPT-5.4-nano/GPT-5.4设置下,某一CRC校准点的求解率超过始终升级方案,同时平均恢复成本仅为后者的35%。代码已开源于https://github.com/Qijia-He/agent-budget-control。
原文摘要 · Abstract (English)
Coding agents increasingly operate in executable environments where a failed attempt produces actionable feedback rather than merely an incorrect answer. Existing cost-aware systems typically treat such failures as cascade decisions: try a cheap model first, then escalate hard cases to a stronger and more expensive model. In coding, however, execution feedback can also make further cheap-model recovery worthwhile, raising a budgeted deployment question: when should an agent spend more cheap compute, and when should it escalate? We formulate this post-failure decision as recovery routing over heterogeneous actions and train a supervised router from execution rollouts. To make the same router usable under changing budgets, we add a Conformal Risk Control (CRC) layer that selects a deployment-time cost penalty without retraining and provides marginal expected-cost control under exchangeability. Across held-out failures from five coding benchmarks, cheap recovery and escalation exhibit complementary success patterns. The calibrated frontier improves over fixed actions, prompt-only routers, and a binary cascade baseline; in the main GPT-5.4-nano/GPT-5.4 setting, one CRC-calibrated frontier point exceeds always-escalate solve rate while using 35% of its mean recovery cost. Code is available at https://github.com/Qijia-He/agent-budget-control.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。