尋找者:利用基於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