arXiv(opens in a new tab)cs.SEMay 2024Cited by 148 papers on PaperVantageClassic Paper

Manuscript Offprint

arXiv:2405.15793

SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering

John Yang, Carlos E. Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, Ofir Press

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Language model (LM) agents are increasingly being used to automate complicated tasks in digital environments. Just as humans benefit from powerful software applications, such as integrated development environments, for complex tasks like software engineering, we posit that LM agents represent a new category of end users with their own needs and abilities, and would benefit from specially-built interfaces to the software they use. We investigate how interface design affects the performance of language model agents. As a result of this exploration, we introduce SWE-agent: a system that facilitates LM agents to autonomously use computers to solve software engineering tasks. SWE-agent's custom agent-computer interface (ACI) significantly enhances an agent's ability to create and edit code files, navigate entire repositories, and execute tests and other programs. We evaluate SWE-agent on SWE-bench and HumanEvalFix, achieving state-of-the-art performance on both with a pass@1 rate of 12.5% and 87.7%, respectively, far exceeding the previous state-of-the-art achieved with non-interactive LMs. Finally, we provide insight on how the design of the ACI can impact agents' behavior and performance.

1 Introduction

Recent work has demonstrated the efficacy of LM agents for code generation with execution feedback [39]. However, applying agents to more complex code tasks like software engineering remains unexplored. To solve programming tasks, LM agents are typically designed to use existing applications, such as the Linux shell or Python interpreter [53, 57, 59]. However, to perform more complex programming tasks such as software engineering [20], human engineers benefit from sophisticated applications like VSCode with powerful tools and extensions. Inspired by human-computer interaction (HCI) studies on the efficacy of user interfaces for humans [7], we investigate whether LM agents could similarly benefit from better-designed interfaces for performing software engineering tasks.

Figure

Figure 1: SWE-agent is an LM interacting with a computer through an agent-computer interface (ACI), which includes the commands the agent uses and the format of the feedback from the computer.

∗^{*}Equal contribution. Correspondence to johnby@stanford.edu, carlosej@princeton.edu. Data, code, and leaderboard at swe-agent.com

38th Conference on Neural Information Processing Systems (NeurIPS 2024).

Consider the simple setting of an agent interacting directly with a Linux shell [59]. In practice, we find that LM agents can struggle to reliably take actions in this environment. For example, it fails to provide simple commands to edit a small file segment, and does not provide any feedback if the user makes an invalid edit. These deficits substantially hamper performance, motivating the need for an agent-computer interface (ACI), i.e., an abstraction layer between the LM agent and computer, to enhance the LM agent's abilities in computer environments (Figure 1).

From this effort, we introduce SWE-agent, an agent composed of an LM and ACI, that can interact with a computer to solve challenging real-world software engineering problems, such as those proposed in SWE-bench [20]. In contrast to the Linux Shell's granular, highly configurable action space, SWE-agent's ACI instead offers a small set of simple actions for viewing, searching through and editing files. The ACI uses guardrails to prevent common mistakes, and an agent receives specific, concise feedback about a command's effects at every turn. We show that ACIs tailored specifically for LMs outperform existing user interfaces (UIs) designed for human users, such as the Linux shell.

Using GPT-4 Turbo as a base LM, SWE-agent solves 12.47% of the 2,294 SWE-bench test tasks, substantially outperforming the previous best resolve rate of 3.8% by a non-interactive, retrieval-augmented system [20]. We perform an ablation study on a subset of 300 SWE-bench test instances (SWE-bench Lite) to analyze our ACI design choices. The results show that SWE-agent solves 10.7 percentage points more instances than the baseline agent, which uses only the default Linux shell. Although our ACI was developed for GPT-4 Turbo, we show that it is portable to a different LM; SWE-agent with Claude 3 Opus can solve 10.5% of the benchmark tasks.

Our contributions are twofold. First, we introduce the concept of the agent-computer interface (ACI) and demonstrate how careful ACI design can substantially improve LM agent performance without modifying the underlying LM's weights. Second, we build, evaluate, and open-source SWE-agent, a system that provides LMs an ACI for solving real-world software engineering tasks. Unlike prior works that independently explore the merits of tool use, prompting techniques, and code execution in interactive settings, our approach unifies these factors within the ACI framework. We show that crafting LM-centric interactive components has meaningful effects on downstream task performance.

References (65)

  • Program synthesis with large language models, 2021
  • Yee, Y. Zi, C. J. Anderson, M. Q. Feldman, A. Guha, M. Greenberg, and A. Jangda
  • Entropy guided spectrum based bug localization using statistical language model (opens arXiv in a new tab)
  • al. Evaluating large language models trained on code, 2021
  • About face 3: the essentials of interaction design
  • Crosscodeeval: A diverse and multilingual benchmark for cross-file code completion
  • Classeval: A manually-crafted benchmark for evaluating llms on class-level code generation, 2023
  • Automated repair of programs from large language models, 2023
  • Llm agents can autonomously hack websites, 2024
  • Middleware for llms: Tools are instrumental for language agents in complex environments, 2024
  • Deepseek-coder: When the large language model meets programming – the rise of code intelligence (opens arXiv in a new tab)
  • Measuring coding challenge competence with apps, 2021
  • L2MAC: Large language model automatic computer for unbounded code generation
  • Metagpt: Meta programming for a multi-agent collaborative framework, 2023
  • Mlagentbench: Evaluating language agents on machine learning experimentation, 2024
  • Li, F. Yan, T. Zhang, S. Wang, A. Solar-Lezama, K. Sen, and I. Stoica
  • SWE-bench: Can language models resolve real-world github issues? In The Twelfth International Conference on Learning Representations, 2024
  • Defects4J: A Database of existing faults to enable controlled testing studies for Java programs
  • Large language models are few-shot testers: Exploring llm-based general bug reproduction, 2023
  • Huang, G. Neubig, S. Zhou, R. Salakhutdinov, and D. Fried
  • Ds-1000: A natural and reliable benchmark for data science code generation, 2022
  • Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation
  • Lost in the middle: How language models use long contexts, 2023
  • Repobench: Benchmarking repository-level code auto-completion systems
  • MI-bench: Evaluating large language models for code generation in repository-level machine learning tasks, 2024
  • Codexglue: A machine learning benchmark dataset for code understanding and generation, 2021
  • Embers of autoregression: Understanding large language models through the problem they are trained to solve (opens arXiv in a new tab)
  • Octopack: Instruction tuning code large language models
  • Webgpt: Browser-assisted question-answering with human feedback, 2022
  • Memgpt: Towards llms as operating systems, 2024
  • Measuring and narrowing the compositionality gap in language models (opens the publisher in a new tab)
  • An empirical evaluation of llms for solving offensive security challenges, 2024
  • Ehragent: Code empowers large language models for few-shot complex tabular reasoning on electronic health records, 2024
  • Reflexion: Language agents with verbal reinforcement learning, 2023
  • An analysis of the automatic bug fixing performance of chatgpt, 2023
  • Hierarchical prompting assists large language model on web navigation, 2023
  • Cognitive architectures for language agents, 2023
  • Medagents: Large language models as collaborators for zero-shot medical reasoning, 2024
  • An in-context learning agent for formal theorem-proving, 2024
  • Cheng, A. Jin, T. Bos, L. Baker, Y. Du, Y. Li, H. Lee, H. S. Zheng, A. Ghafouri, M. Menegali, Y. Huang, M. Krikun, D. Lepikhin, J. Qin, D. Chen, Y. Xu, Z. Chen, A. Roberts, M. Bosma, V. Zhao, Y. Zhou, C.-C
  • Software testing with large language model: Survey, landscape, and vision, 2023
  • A survey on large language model based autonomous agents (opens the publisher in a new tab)
  • Executable code actions elicit better llm agents, 2024
  • Mconala: A benchmark for code generation from multiple natural languages, 2023
  • Execution-based evaluation for open-domain code generation, 2023
  • Trove: Inducing verifiable and efficient toolboxes for solving programmatic tasks, 2024
  • Automating the enterprise with foundation models, 2024
  • Os-copilot: Towards generalist computer agents with self-improvement, 2024
  • The rise and potential of large language model based agents: A survey, 2023
  • Less training, more repairing please: revisiting automated program repair via zero-shot learning
  • Universal fuzzing via large language models
  • Osworld: Benchmarking multimodal agents for open-ended tasks in real computer environments, 2024
  • Large language models for test-free fault localization (opens the publisher in a new tab)
  • Intercode: Standardizing and benchmarking interactive coding with execution feedback
  • Language agents as hackers: Evaluating cybersecurity skills with capture the flag
  • Webshop: Towards scalable real-world web interaction with grounded language agents, 2023
  • React: Synergizing reasoning and acting in language models
  • Li, K. Xiao, A. Rao, Y. Wen, K. Shi, J. Howland, P. Bailey, M. Catasta, H. Michalewski, A. Polozov, and C. Sutton
  • Codereval: A benchmark of pragmatic code generation with generative pre-trained models
  • Wavecoder: Widespread and versatile enhanced instruction tuning with refined data generation (opens arXiv in a new tab)
  • Parsel: Algorithmic reasoning with language models by composing decompositions, 2022 (opens arXiv in a new tab)
  • Self-taught optimizer (stop): Recursively self-improving code generation, 2024
  • Lou, and W. Chen
  • Training language model agents without modifying language models, 2024
  • Webarena: A realistic web environment for building autonomous agents, 2023

Cited by (148)