arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.11713cs.CLcs.SE

Seeker:面向异常安全代码生成的中间语言智能体框架

Seeker: Towards Exception Safety Code Generation with Intermediate Language Agents Framework

Tsinghua University(清华大学);Lingxin AI(灵心人工智能);Beihang University(北京航空航天大学);ByteDance(字节跳动)

Xuanming Zhang, Yuxuan Chen, Yiming Zheng, Zhexin Zhang, Yuan Yuan, Minlie Huang

AI总结:

针对代码异常处理不当导致软件脆弱的问题,提出多智能体框架Seeker,利用LLMs检测、捕获和解决异常,提升代码健壮性。

摘要:

在现实世界的软件开发中,不当或缺失的异常处理会严重影响代码的健壮性和可靠性。异常处理机制要求开发者按照高标准检测、捕获和管理异常,但许多开发者难以胜任这些任务,导致代码脆弱。这一问题在开源项目中尤为明显,并影响了整个软件生态系统的质量。为应对这一挑战,我们探索使用大型语言模型(LLMs)来改进代码中的异常处理。通过广泛分析,我们识别出三个关键问题:对脆弱代码的检测不敏感(Insensitive Detection of Fragile Code)、异常块捕获不准确(Inaccurate Capture of Exception Block)以及处理方案失真(Distorted Handling Solution)。这些问题在真实世界的代码库中普遍存在,表明健壮的异常处理实践常常被忽视或处理不当。为此,我们提出Seeker,一个受专家开发者异常处理策略启发的多智能体框架。Seeker使用多个智能体:Scanner(扫描器)、Detector(检测器)、Predator(捕食者)、Ranker(排序器)和Handler(处理器),以协助LLMs更有效地检测、捕获和解决异常。我们的工作是首个关于利用LLMs在真实开发场景中增强异常处理实践的系统性研究,为未来代码可靠性的改进提供了宝贵见解。

英文摘要:

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 Block, and Distorted Handling Solution. 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 in real development scenarios, providing valuable insights for future improvements in code reliability.

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

↑