尋找者:朝向具有中介語言代理程式框架的例外安全碼生成

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

December 16, 2024
作者: Xuanming Zhang, Yuxuan Chen, Yiming Zheng, Zhexin Zhang, Yuan Yuan, Minlie Huang
cs.AI

摘要

在現實世界的軟體開發中,不當或缺失的異常處理可能嚴重影響程式碼的穩健性和可靠性。異常處理機制需要開發人員按照高標準偵測、捕捉和管理異常,但許多開發人員在這些任務上遇到困難,導致程式碼脆弱。這個問題在開源專案中尤為明顯,並影響軟體生態系統的整體品質。為應對這一挑戰,我們探索使用大型語言模型(LLMs)來改善程式碼中的異常處理。通過廣泛分析,我們確定了三個關鍵問題:對脆弱程式碼的偵測不敏感、對異常區塊的捕捉不準確,以及處理方案扭曲。這些問題在現實世界的存儲庫中普遍存在,表明穩健的異常處理實踐常被忽視或處理不當。為應對此問題,我們提出 Seeker,這是一個受到專家開發人員異常處理策略啟發的多代理框架。Seeker 使用代理:掃描器、偵測器、獵手、排名者和處理器,協助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 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.

Summary

AI-Generated Summary

PDF52December 18, 2024