arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2308.15276cs.SE
收藏

大型语言模型在故障定位中的应用

Large Language Models in Fault Localisation

Yonghao Wu, Zheng Li, Jie M. Zhang, Mike Papadakis, Mark Harman, Yong Liu

AI总结:

本文在 Defects4J 上评估 ChatGPT-3.5/4 的故障定位能力,发现函数级上下文配合错误日志时可显著超越 SmartFL,但类级上下文会导致性能明显下降。

摘要:

大型语言模型(LLM)已在代码生成、程序修复、代码摘要和测试生成等多个软件工程任务中展现出潜力。故障定位对于实现程序的自动化调试和修复至关重要,并在 ChatGPT-4 发布活动中作为亮点被重点展示。尽管如此,与最先进方法相比,LLM 的性能,以及提示设计和上下文长度对其效果的影响,仍不清楚。为填补这一空白,本文深入研究了 ChatGPT-3.5 和 ChatGPT-4 这两个最先进 LLM 在故障定位方面的能力。利用被广泛采用的大规模 Defects4J 数据集,我们将这两个 LLM 与现有故障定位技术进行了比较。我们还研究了 LLM 在故障定位中的一致性,以及提示工程和代码上下文长度如何影响故障定位效果。我们的研究结果表明,在函数级上下文内,ChatGPT-4 优于所有现有故障定位方法。额外的错误日志可以进一步提高 ChatGPT 模型的定位准确性和一致性,在 Defects4J 数据集上,按 TOP-1 指标衡量,其准确率比最先进基线 SmartFL 平均高 46.9%。然而,当 Defects4J 数据集的代码上下文扩展到类级时,ChatGPT-4 的性能显著下降,在 TOP-1 指标下准确率比 SmartFL 低 49.9%。这些观察结果表明,尽管 ChatGPT 能够在特定条件下有效定位故障,但其局限性也很明显。若要充分挖掘 ChatGPT 等 LLM 在实际故障定位应用中的潜力,还需要进一步研究。

英文摘要:

Large Language Models (LLMs) have shown promise in multiple software engineering tasks including code generation, program repair, code summarisation, and test generation. Fault localisation is instrumental in enabling automated debugging and repair of programs and was prominently featured as a highlight during the launch event of ChatGPT-4. Nevertheless, the performance of LLMs compared to state-of-the-art methods, as well as the impact of prompt design and context length on their efficacy, remains unclear. To fill this gap, this paper presents an in-depth investigation into the capability of ChatGPT-3.5 and ChatGPT-4, the two state-of-the-art LLMs, on fault localisation. Using the widely-adopted large-scale Defects4J dataset, we compare the two LLMs with the existing fault localisation techniques. We also investigate the consistency of LLMs in fault localisation, as well as how prompt engineering and the length of code context affect the fault localisation effectiveness. Our findings demonstrate that within function-level context, ChatGPT-4 outperforms all the existing fault localisation methods. Additional error logs can further improve ChatGPT models' localisation accuracy and consistency, with an average 46.9% higher accuracy over the state-of-the-art baseline SmartFL on the Defects4J dataset in terms of TOP-1 metric. However, when the code context of the Defects4J dataset expands to the class-level, ChatGPT-4's performance suffers a significant drop, with 49.9% lower accuracy than SmartFL under TOP-1 metric. These observations indicate that although ChatGPT can effectively localise faults under specific conditions, limitations are evident. Further research is needed to fully harness the potential of LLMs like ChatGPT for practical fault localisation applications.

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

↑