TL;DR
Large Language Model (LLM) agents for software engineering are highly capable but notoriously expensive due to long, repetitive trial-and-error loops. This paper introduces EET (Experience-Driven Early Termination), a framework that leverages structured historical debugging data to safely stop unproductive agent iterations early. Across major software engineering benchmarks, EET slashes monetary costs by an average of 32% with virtually zero impact on task success rates.
What Problem Does This Paper Address?
State-of-the-art software engineering (SE) agents resolve code issues by iteratively writing patches, running tests, and executing terminal commands. However, this multi-round interaction suffers from a "token snowball effect": as the conversation history grows with every tool call, each subsequent turn becomes exponentially more expensive.
Worse yet, when agents encounter highly complex or unsolvable bugs, they tend to exhaust their entire iteration budget trying futile fixes, burning through API tokens with zero return. Existing cost-reduction strategies typically enforce hard limits on agent turns, but this severely degrades their ability to solve difficult problems. The authors address this critical trade-off, seeking a way to cut agent expenses without sacrificing engineering performance.
Methods
EET optimizes agent efficiency through a two-pronged approach: Experience Generation and Early Termination.
- Experience Generation: Instead of saving massive, noisy raw execution traces from past tasks, EET uses an LLM to distill successful historical resolutions into compact, structured "experience objects." Each object contains a concise task description, an abstracted summary of key execution steps, and an evaluation of the final patch's confidence and rationale.
- Early Termination: When a new issue is presented, the agent uses a lightweight TF-IDF search to retrieve the single most relevant historical experience object from its database. This experience is injected into the agent's context to guide its actions. EET then introduces dynamic early termination checks at two key phases:
- Patch Generation: At intermediate milestones (e.g., after a code modification or test run), the agent estimates its confidence. If this score exceeds a predefined threshold ($\tau_{gen}$), generation terminates early.
- Patch Selection: For agents that generate multiple candidate patches, EET evaluates each patch against the retrieved experience. If a candidate is highly reliable, it triggers an early stop ($\tau_{sel}^{upper}$). Conversely, if the confidence falls below a lower threshold ($\tau_{sel}^{lower}$), the issue is flagged as too difficult, halting further resource-intensive iterations to avoid waste.
Datasets
- SWE-bench Verified: The primary evaluation dataset, consisting of 500 human-validated, real-world software engineering tasks collected from Python repositories on GitHub.
- SWE-bench Lite: Used as the auxiliary dataset to build the historical experience base. After removing tasks overlapping with the Verified dataset to prevent data leakage, 207 unique tasks were utilized for experience generation.
Key Insights and Ideas
- Structured Memory Beats Raw RAG: Simply feeding raw historical trajectories into an agent via Retrieval-Augmented Generation (RAG) introduces excessive token overhead and distracting noise. Abstracting trajectories into structured JSON objects preserves actionable signals while keeping prompts compact and cost-effective.
- LLM Confidence is Well-Calibrated: A crucial finding is that an LLM's self-reported confidence correlates strongly with actual patch correctness. Patches scored above 90 achieved actual pass rates of 63.6%–92.6%, whereas patches scored below 40 rarely succeeded (8.7%–13.8%). This strong calibration justifies using confidence as a reliable trigger for early stopping.
- Cross-Repository Transferability: EET does not just memorize project-specific quirks. When evaluated on entirely unseen repositories with zero overlap in the experience base, EET still reduced costs by 24.4% while maintaining the exact same resolution rate, proving it captures generalizable debugging logic.
Key Results
The authors evaluated EET across three distinct SE agent architectures (Agentless, Mini-SWE-Agent, and Trae Agent) using both closed-source (GPT-5-mini) and open-source (DeepSeek-V3.2) backends.
- Substantial Cost Reductions: EET consistently lowered total monetary costs by 19.3% to 55.1% (averaging 31.8% across all configurations).
- Preserved Performance: The impact on the bug resolution rate was negligible (a maximum drop of only 0.2%). Strikingly, for the Agentless framework, EET actually increased the resolution rate by over 7% due to the high-quality guidance provided by the historical experiences.
- Token and API Efficiency: On average, EET reduced LLM API calls by 20.8%, input tokens by 29.9%, and output tokens by 25.1%. These savings were achieved by successfully identifying early termination opportunities in roughly 11.3% of all issues.
Limitations and Future Work
- Evaluation Scope: The framework's evaluation was restricted to the Python-centric SWE-bench Verified dataset. Testing across other programming languages and within real-world industrial environments remains an open step.
- The "Cold Start" Problem: As an experience-driven approach, EET relies heavily on existing historical data. For entirely novel codebases or niche domains with sparse execution histories, the framework may fail to retrieve relevant experiences.
- Domain Expansion: While implemented for software engineering, the core philosophy of budget-aware, experience-guided early termination is domain-agnostic. The authors suggest extending EET to general multi-step reasoning agents in non-programming fields.
Summary updated