arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.17134cs.SEcs.AI
收藏

RepairAgent:一种自主的、基于LLM的程序修复智能体

RepairAgent: An Autonomous, LLM-Based Agent for Program Repair

University of Stuttgart(斯图加特大学);UC Davis(加利福尼亚大学戴维斯分校)

Islem Bouzenia, Premkumar Devanbu, Michael Pradel

AI总结:

本文提出RepairAgent,利用可动态调用工具、由有限状态机引导的LLM自主智能体完成缺陷信息收集、修复成分获取与修复验证,在Defects4J上自主修复164个缺陷。

摘要:

自动化程序修复已成为缓解软件缺陷对系统可靠性和用户体验影响的一项强大技术。本文介绍了RepairAgent,这是首个通过基于大型语言模型(LLM)的自主智能体来应对程序修复挑战的工作。不同于现有基于深度学习的方法以固定提示或固定反馈循环来提示模型,我们的工作将LLM视为一个能够通过调用合适工具来自主规划并执行修复缺陷操作的智能体。RepairAgent可自由交替进行收集缺陷相关信息、收集修复成分以及验证修复等活动,同时根据收集到的信息和此前修复尝试的反馈来决定调用哪些工具。使RepairAgent得以实现的关键贡献包括:一组对程序修复有用的工具、一种允许LLM与这些工具交互的动态更新提示格式,以及一个指导智能体调用工具的有限状态机。我们在广受欢迎的Defects4J数据集上的评估证明了RepairAgent的有效性:它自主修复了164个缺陷,其中包括39个此前技术未能修复的缺陷。与LLM交互给每个缺陷带来平均270000个token的成本,按照OpenAI GPT-3.5模型当前定价,这相当于每个缺陷14美分。据我们所知,本工作首次提出了一种自主的、基于LLM的程序修复智能体,为软件工程中未来基于智能体的技术铺平了道路。

英文摘要:

Automated program repair has emerged as a powerful technique to mitigate the impact of software bugs on system reliability and user experience. This paper introduces RepairAgent, the first work to address the program repair challenge through an autonomous agent based on a large language model (LLM). Unlike existing deep learning-based approaches, which prompt a model with a fixed prompt or in a fixed feedback loop, our work treats the LLM as an agent capable of autonomously planning and executing actions to fix bugs by invoking suitable tools. RepairAgent freely interleaves gathering information about the bug, gathering repair ingredients, and validating fixes, while deciding which tools to invoke based on the gathered information and feedback from previous fix attempts. Key contributions that enable RepairAgent include a set of tools that are useful for program repair, a dynamically updated prompt format that allows the LLM to interact with these tools, and a finite state machine that guides the agent in invoking the tools. Our evaluation on the popular Defects4J dataset demonstrates RepairAgent's effectiveness in autonomously repairing 164 bugs, including 39 bugs not fixed by prior techniques. Interacting with the LLM imposes an average cost of 270,000 tokens per bug, which, under the current pricing of OpenAI's GPT-3.5 model, translates to 14 cents of USD per bug. To the best of our knowledge, this work is the first to present an autonomous, LLM-based agent for program repair, paving the way for future agent-based techniques in software engineering.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑