Table of Contents
Fetching ...

SWE-Replay: Efficient Test-Time Scaling for Software Engineering Agents

Yifeng Ding, Lingming Zhang

TL;DR

SWE-Replay tackles the high cost of test-time scaling for software engineering agents by reframing trajectory generation as a reuse problem. It maintains an archive of past trajectories and dynamically decides to explore from scratch or replay from carefully chosen intermediate steps, guided by abstract-state rarity and reasoning intensity rather than LLM-based quality scores. The approach yields up to 17.4% cost reductions and up to 3.8% performance gains on SWE-Bench Verified and generalizes to SWE-Bench Pro and Multilingual, while promoting exploration of long-tail repository files. This makes test-time scaling more scalable and robust for modern SWE agents, with practical impact in efficient, diverse repository exploration and patch generation.

Abstract

Test-time scaling has been widely adopted to enhance the capabilities of Large Language Model (LLM) agents in software engineering (SWE) tasks. However, the standard approach of repeatedly sampling trajectories from scratch is computationally expensive. While recent methods have attempted to mitigate costs using specialized value agents, they can suffer from model miscalibration and fail to generalize to modern agents that synthesize custom bash scripts as tools. In this paper, we introduce SWE-Replay, the first efficient and generalizable test-time scaling technique for modern agents without reliance on potentially noisy value estimates. SWE-Replay optimizes the scaling process by recycling trajectories from prior trials, dynamically choosing to either explore from scratch or exploit archived experience by branching at critical intermediate steps. This selection of intermediate steps is driven by the potential and reasoning significance of repository exploration, rather than external LLM-based quality estimates. Our evaluation shows that, on SWE-Bench Verified, SWE-Replay consistently outperforms naive scaling, reducing costs by up to 17.4% while maintaining or even improving performance by up to 3.8%. Further evaluation on SWE-Bench Pro and Multilingual validates the generalizability of SWE-Replay, establishing it as a robust foundation for efficient test-time scaling of software engineering agents.

SWE-Replay: Efficient Test-Time Scaling for Software Engineering Agents

TL;DR

SWE-Replay tackles the high cost of test-time scaling for software engineering agents by reframing trajectory generation as a reuse problem. It maintains an archive of past trajectories and dynamically decides to explore from scratch or replay from carefully chosen intermediate steps, guided by abstract-state rarity and reasoning intensity rather than LLM-based quality scores. The approach yields up to 17.4% cost reductions and up to 3.8% performance gains on SWE-Bench Verified and generalizes to SWE-Bench Pro and Multilingual, while promoting exploration of long-tail repository files. This makes test-time scaling more scalable and robust for modern SWE agents, with practical impact in efficient, diverse repository exploration and patch generation.

Abstract

Test-time scaling has been widely adopted to enhance the capabilities of Large Language Model (LLM) agents in software engineering (SWE) tasks. However, the standard approach of repeatedly sampling trajectories from scratch is computationally expensive. While recent methods have attempted to mitigate costs using specialized value agents, they can suffer from model miscalibration and fail to generalize to modern agents that synthesize custom bash scripts as tools. In this paper, we introduce SWE-Replay, the first efficient and generalizable test-time scaling technique for modern agents without reliance on potentially noisy value estimates. SWE-Replay optimizes the scaling process by recycling trajectories from prior trials, dynamically choosing to either explore from scratch or exploit archived experience by branching at critical intermediate steps. This selection of intermediate steps is driven by the potential and reasoning significance of repository exploration, rather than external LLM-based quality estimates. Our evaluation shows that, on SWE-Bench Verified, SWE-Replay consistently outperforms naive scaling, reducing costs by up to 17.4% while maintaining or even improving performance by up to 3.8%. Further evaluation on SWE-Bench Pro and Multilingual validates the generalizability of SWE-Replay, establishing it as a robust foundation for efficient test-time scaling of software engineering agents.
Paper Structure (28 sections, 7 equations, 8 figures, 7 tables, 1 algorithm)

This paper contains 28 sections, 7 equations, 8 figures, 7 tables, 1 algorithm.

Figures (8)

  • Figure 1: Overview of SWE-Replay.
  • Figure 2: Overview of step selection in SWE-Replay.
  • Figure 3: Example of tool calls and their file-level representations. Step 1 is skipped as no file has been explored before it.
  • Figure 4: Example of reasoning contents with different intensity.
  • Figure 5: Scaling curve of SWE-Replay for Devstral-Small-2.
  • ...and 3 more figures