Reducing Inference Cost of Coding Agents with Timeout Cascades

Boxi Zhou, German Sviridov, Dmitrii Ustiugov, Haris JavaidarXiv 2026 · arXiv

TL;DR

Researchers from AMD and NTU Singapore demonstrate that you can slash the inference costs of AI coding agents by up to 16.4% overall—and 33% on easy tasks—without losing any accuracy. By using a "timeout cascade" that attempts tasks with a small, cheap model first and only escalates to a massive model if the first attempt fails or takes too long, they nearly match the performance of complex, learned task routers with a fraction of the engineering effort.

What Problem Does This Paper Address?

AI coding agents (like Devin or OpenHands) are transformative but incredibly expensive to run. A single task might involve hundreds of model calls, long execution traces, and significant GPU time. Currently, the industry standard is to use the most powerful (and expensive) model available for every task to maximize the "resolve rate."

However, not every bug fix requires a 400B+ parameter monster. Many tasks are routine. The authors address the inefficiency of this "one-size-fits-all" approach, investigating whether smaller, "sub-40B" models have become capable enough to handle the easy stuff, and how to intelligently hand off the hard stuff to larger models without a massive engineering overhead.

Methods

The authors evaluated 36 open-weight models released between mid-2024 and early 2026. They used a standardized agent scaffold called mini-swe-agent and served models on AMD Instinct™ MI300X GPUs.

The core contribution is the evaluation of two hybrid architectures:

  1. Timeout-based Cascade: Every task starts on a Small Language Model (SLM). If the SLM fails (produces an invalid patch) or reaches a pre-defined timeout, the system performs a "cold restart" on a Large Language Model (LLM).
  2. Difficulty-aware Task Router: A hypothetical system that predicts task difficulty upfront and routes "Easy" tasks to the SLM and "Hard" tasks to the LLM.
Fig. 3: Hybrid inference architectures evaluated by trace-driven simulation. The cascade starts every task on the smaller model and escalates after failure or timeout. The router makes an up-front decision from task difficulty, sending easy tasks to the smaller model and harder tasks to the larger model.

Datasets

The study uses SWE-bench Verified, a subset of 500 real-world GitHub issues filtered for human-confirmed difficulty and correctness. The authors categorized these tasks into Easy (<15 min human resolution), Medium (15 min - 1 hr), and Hard (>1 hr) based on the dataset's metadata.

Key Insights and Ideas

  • The "Credible" Small Model: Sub-40B models have evolved from near-zero performance to resolving over 60% of tasks on SWE-bench Verified. Models like Qwen3.5-35B and GLM-4.7-Flash are now viable "first-stage" agents.
  • The Difficulty Gradient: The performance gap between small and large models isn't uniform. Small models are highly competitive on easy tasks but fall off a cliff on hard ones (resolving only 2% vs. the large model's 36% in some tests). This "structured gap" is exactly what makes cascading profitable.
  • Time as a Proxy for Difficulty: The most surprising finding is that execution time itself is a great router. Tasks that an SLM can solve tend to be solved quickly. If an SLM is spinning its wheels, it's a strong signal that the task is too hard, making a simple stopwatch more effective than a complex machine-learning classifier.
  • Model Complementarity: Interestingly, the hybrid systems sometimes outperformed the large model alone. In some cases, the large model "over-engineered" a fix that failed tests, while the smaller model provided a simpler, passing patch.
Fig. 1: Agentic coding capability of selected models on SWE- bench Verified [1] using mini-swe-agent vs. release date. Full list of models and evaluation setup is described in Sec. IV.

Key Results

Using a cascade of GLM-4.7-Flash (30B) and GLM-4.7 (355B):

  • Cost Savings: Achieved a 16.4% reduction in total GPU-hour costs across the entire benchmark. On "Easy" tasks, the savings reached 33.5%.
  • Accuracy Preservation: The cascade maintained (and slightly exceeded) the 71.2% resolve rate of the large-model-only baseline.
  • Simplicity Wins: The timeout cascade achieved nearly the same cost reduction (16.4%) as an "oracle" router with perfect knowledge of task difficulty (17.9%), but without the need for training or deploying a separate classifier.
Comparison of the cascade vs. the router. The cascade (blue line) captures almost all the benefits of the complex router (orange line).

Limitations and Future Work

  • Latency Tradeoff: Cascading reduces cost but increases wall-clock time for hard tasks because they are essentially run twice (once on the SLM until timeout, then on the LLM). This makes the approach best suited for asynchronous workflows (background PR reviews) rather than interactive chat.
  • Cold Restarts: The current study assumes the LLM starts from scratch. Future work could explore "warm" handoffs where the LLM inherits the SLM's partial work or reasoning traces.
  • Model Pairs: The simulation focused heavily on the GLM family. While the authors expect the trend to hold, different model families might exhibit different "complementarity" effects.
  • Single-Run Variance: Agent evaluations are notoriously noisy. The authors acknowledge that some of the "accuracy gains" might be due to run-to-run variance and suggest multi-run validation for future studies.

Summary updated

Abstract

AI coding agents have become one of the most popular applications of large language models. Yet, agentic AI comes at the cost of a tremendous amount of GPU compute resources, which limits its profitability and its viability at scale. In this paper, we investigate whether smaller, cheaper models can cut this cost without sacrificing accuracy. We evaluate 36 popular large and small open-weight models released since 2024 on a software engineering benchmark, and find that recent small models are closing the accuracy gap compared to their large counterparts. We investigate the structure of this gap and find that the gap is highly concentrated around hard tasks that small language models fail to solve while achieving remarkably good accuracy for easy and medium complexity tasks. Following this observation, we show that by utilizing a hybrid inference strategy that tries a small model first and escalates to a large one only when needed, we can achieve up to 33% reduction in total GPU-hour costs and 16.4% on all tasks from SWE-bench Verified, without sacrificing accuracy. Strikingly, this simple cascade nearly matches an oracle-style task router, highlighting a practical path for deploying cost-aware coding agents in production without complex learned task routers and with minimal engineering complexity.
BibTeX
@misc{zhou2026reducing,
  author = {Boxi Zhou and German Sviridov and Dmitrii Ustiugov and Haris Javaid},
  title = {{Reducing Inference Cost of Coding Agents with Timeout Cascades}},
  year = {2026},
  eprint = {2611.24324},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.24324},
}

Loading related content...

Figure