ARCHER: Adaptive Recovery Routing with Conformal-risk Calibration for Coding Agents

Qijia He, Jiayi Cheng, Chenqian Le, Rui Wang, Xunmei Liu, Yixian Chen, Jie Mei, Zhihao Wang, Xupeng Chen, Yuhuan Chen, Tao WangEfficient Reasoning @ COLM 2026

TL;DR

When a cheap AI coding agent fails, standard systems immediately escalate the task to a massive, expensive model. ARCHER changes the game by using a trained router and Conformal Risk Control to adaptively choose between cheap recovery attempts (like fixing the code using error logs) and high-cost escalation, maximizing success while strictly adhering to a user-defined budget.

What Problem Does This Paper Address?

Building AI coding agents is expensive. The standard industry pattern to manage costs is a binary cascade: try a cheap model first, and if it fails or is uncertain, escalate the task to a frontier model.

However, coding environments are unique because they provide executable feedback. If a cheap model's code fails a test, it doesn't just return a wrong answer; it returns a rich error trace (stderr, assertion failures, or timeouts). Often, the cheap model can easily fix its own mistake if given this feedback, or succeed with a fresh plan.

Immediately escalating to a frontier model wastes money, but blindly trying cheap fixes can waste time and compute on fundamentally broken approaches. The challenge is deciding when an agent should keep trying with the cheap model versus when it should give up and escalate—all while respecting a dynamic, user-specified budget.

Figure 1: Budget-controlled recovery routing. After a cheap coding attempt fails, the router uses the problem, verdict, and stderr to score recovery actions. CRC maps a user budget B to a cost penalty bλ(B), producing different budgeted operating points from the same trained router before re-execution.

Methods

The authors introduce ARCHER (Adaptive Recovery Routing with Conformal-risk Calibration), which treats post-failure recovery as a budgeted routing problem over three distinct actions:

  1. Reflect: Ask the cheap model to locally patch its code using the execution feedback.
  2. Replan: Ask the cheap model to discard its previous attempt and generate a fresh solution from scratch.
  3. Escalate: Send the problem and the failure context to a stronger, more expensive model.

ARCHER consists of two main components:

  • Supervised Recovery Router: The authors fine-tuned a Qwen3.5-4B model on offline execution rollouts. Given the problem statement, the execution verdict, and the stderr trace, the router scores the likelihood of success for each recovery action.
  • Conformal Risk Control (CRC) Layer: To avoid retraining the router every time a user changes their budget, ARCHER adds a mathematical calibration layer. It maps a target budget ($B$) to a cost penalty ($\hat{\lambda}$). The action-selection rule then subtracts this penalty from the router's scores, dynamically shifting the agent toward cheaper actions when the budget is tight, and allowing aggressive escalation when the budget is loose.

Datasets

The framework was trained and evaluated using recovery rollouts collected from five prominent code-generation benchmarks:

  • APPS
  • TACO
  • BigCodeBench
  • LiveCodeBench
  • CodeContests

The primary experiments used GPT-5.4-NANO as the cheap model and GPT-5.4 as the strong model. The authors also successfully replicated the framework using Gemini-2.5-Flash and Gemini-2.5-Pro to prove provider portability.

Key Insights and Ideas

  • Recovery is Not a Linear Ladder: The most surprising finding is that recovery actions don't follow a strict hierarchy of capability. As shown in the benchmark analysis, 28% of failures are cheap-only (solvable by reflect/replan but missed by escalation), while 45% are escalation-only. Because these actions solve complementary subsets of problems, a smart router can actually outperform an "always-escalate" strategy.
  • Metadata Matters as a Difficulty Signal: When a test fails with a generic "wrong answer" message, the stderr trace provides very little signal. ARCHER overcomes this by feeding the router problem metadata (difficulty tiers, algorithm tags). This metadata acts as a crucial difficulty calibration cue, helping the model realize when a problem requires a fundamental algorithmic shift.
  • Instant Price Recalibration: If an API provider slashes prices or doubles the cost of a frontier model, traditional budget-aware routers have to be completely retrained. Because ARCHER separates the router's quality predictions from the cost constraints, adapting to new API pricing takes less than a second—requiring only a quick re-scan of a stored cost table.

Key Results

ARCHER consistently outperforms fixed strategies, prompt-only zero-shot LLM routers, and standard binary cascades across the cost-quality frontier.

The cost-solve-rate frontier achieved by ARCHER compared to baselines.
  • Better Performance at 35% of the Cost: In the main GPT-5.4 setup, ARCHER finds a calibrated operating point that achieves a higher solve rate than the "always-escalate" baseline while consuming only 35% of its mean recovery cost.
  • High-End Superiority: The unconstrained version of ARCHER ($\lambda=0$) achieves an overall solve rate of 81.7%, significantly higher than always-escalating (68.6%) or always-replanning (45.3%).

Limitations and Future Work

While powerful, the authors note a few key limitations:

  • Single-Step Decisions: ARCHER currently models recovery as a single choice immediately following the first failure. In the real world, coding agents often iterate over multiple rounds of debugging.
  • Expected Cost vs. Guaranteed Quality: The Conformal Risk Control layer provides mathematical guarantees for the mean cost spent across a population of tasks, but it does not guarantee the solve rate or quality for any specific sub-group of problems.

Future work aims to extend adaptive recovery routing to multi-step agent trajectories and incorporate richer deployment constraints.

Summary updated

BibTeX
@inproceedings{he2026archer,
  author = {Qijia He and Jiayi Cheng and Chenqian Le and Rui Wang and Xunmei Liu and Yixian Chen and Jie Mei and Zhihao WANG and Xupeng Chen and Yuhuan Chen and Tao Wang},
  title = {{ARCHER: Adaptive Recovery Routing with Conformal-risk Calibration for Coding Agents}},
  booktitle = {Efficient Reasoning @ COLM},
  year = {2026},
  url = {https://openreview.net/forum?id=y8w7HIaLtu},
}
Figure