一句话:提出 PingFL,用 LLM 智能体结合打印调试获取动态程序状态,显著提升方法级缺陷定位精度。
缺陷定位是软件调试中关键但耗时的环节。随着大语言模型代码能力增强,基于 LLM 的缺陷定位(LLMFL)研究日益增多,但现有技术大多仅分析静态代码,忽略程序运行时动态状态,导致 LLM 容易产生“幻觉”,把本无缺陷的代码误判为可疑。为此,本文提出 PingFL,一个融入程序动态信息的 LLMFL 系统,由缺陷定位(FL)智能体与打印调试(PD)智能体组成:FL 智能体借助一组可调用工具理解缺陷根因,当其提名某处为可疑位置时,便委托 PD 智能体通过多轮打印调试验证该怀疑;两个智能体通过 LLM 生成的文本思维链高效通信。在 Defects4J 基准的 812 个真实缺陷上评估,PingFL 能在 Top-1 内定位 450 个缺陷,比其它基于 LLM 的方法高出 41% 至 122%。进一步分析表明,即便没有显式指令,PingFL 也自发形成特定的定位策略与工具使用模式。其成本也较优,平均每个缺陷花费 0.23 美元、104.62 秒,其中打印调试机制仅占 0.07 美元与 48.14 秒。
Fault localization (FL) is a critical but time-consuming part of software debugging. With the improvement of the Large Language Models (LLMs) in their code capabilities, the increasing demand for automated software development has encouraged more research on building LLM-based Fault Localization (LLMFL) systems. However, existing LLMFL techniques are typically restricted to predicting bug locations by analyzing static code, while overlooking crucial dynamic program state of the software. This lack of context makes LLMs prone to generating "hallucinations", incorrectly identifying bug-free code as suspicious. To address this, this paper introduces PingFL, the LLMFL system that incorporates program dynamic information for more accurate automatic fault localization. PingFL comprises a Fault Localization (FL) agent and a Print Debugging (PD) agent. The FL agent is tasked with understanding the root cause through a set of callable tools. When the FL agent nominates a location as suspicious, it would entrust the PD agent to verify the suspected issue through multiple rounds of print debugging. In particular, these two agents communicate efficiently by conveying the textual thought generated by the LLM. The evaluation on 812 real-world bugs from the Defects4J benchmark shows that PingFL can localize 450 bugs within Top-1, which significantly outperforms other LLM-based approaches by 41% to 122%. A deeper dive into PingFL’s performance reveals that it exhibits specific FL strategies and tool usage patterns even without explicit instructions. Finally, PingFL proves to be cost-effective, spending an average of $0.23 and 104.62 seconds per bug, with the print debugging mechanism accounting for only $0.07 and 48.14 seconds.
DOI 原文 ·
@inproceedings{paperbot9436,
title = {Let the Code Speak: Incorporating Program Dynamic State for Better Method-Level Fault Localization},
author = {Yihao Qin and Shangwen Wang and Bo Lin and Xin Peng and Sheng Ouyang and Liqian Chen and Xiaoguang Mao},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00072}
}