研究课题:利用基于LLM的多智能体方法增强代码中的异常处理
Seeker: Enhancing Exception Handling in Code with LLM-based Multi-Agent Approach
October 9, 2024
作者: Xuanming Zhang, Yuxuan Chen, Yuan Yuan, Minlie Huang
cs.AI
摘要
在现实世界的软件开发中,不当或缺失的异常处理可能严重影响代码的健壮性和可靠性。异常处理机制要求开发人员根据高标准检测、捕获和管理异常,但许多开发人员在这些任务上遇到困难,导致代码脆弱。这个问题在开源项目中尤为明显,并影响了软件生态系统的整体质量。为了解决这一挑战,我们探讨了使用大型语言模型(LLMs)来改善代码中的异常处理。通过广泛分析,我们确定了三个关键问题:对脆弱代码的不敏感检测、异常类型捕获不准确以及处理方案扭曲。这些问题在现实世界的代码库中普遍存在,表明健壮的异常处理实践经常被忽视或处理不当。作为回应,我们提出了Seeker,这是一个受到专业开发人员异常处理策略启发的多代理框架。Seeker 使用代理:Scanner、Detector、Predator、Ranker 和 Handler 来协助LLMs更有效地检测、捕获和解决异常。我们的工作是第一个系统研究如何利用LLMs来增强异常处理实践的研究,为未来改进代码可靠性提供了宝贵的见解。
English
In real world software development, improper or missing exception handling
can severely impact the robustness and reliability of code. Exception handling
mechanisms require developers to detect, capture, and manage exceptions
according to high standards, but many developers struggle with these tasks,
leading to fragile code. This problem is particularly evident in open source
projects and impacts the overall quality of the software ecosystem. To address
this challenge, we explore the use of large language models (LLMs) to improve
exception handling in code. Through extensive analysis, we identify three key
issues: Insensitive Detection of Fragile Code, Inaccurate Capture of Exception
Types, and Distorted Handling Solutions. These problems are widespread across
real world repositories, suggesting that robust exception handling practices
are often overlooked or mishandled. In response, we propose Seeker, a multi
agent framework inspired by expert developer strategies for exception handling.
Seeker uses agents: Scanner, Detector, Predator, Ranker, and Handler to assist
LLMs in detecting, capturing, and resolving exceptions more effectively. Our
work is the first systematic study on leveraging LLMs to enhance exception
handling practices, providing valuable insights for future improvements in code
reliability.Summary
AI-Generated Summary