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

大型语言模型时代的程序切片

Program Slicing in the Era of Large Language Models

Kimya Khakzad Shahandashti, Mohammad Mahdi Mohajer, Alvine Boaye Belle, Song Wang, Hadi Hemmati

AI总结:

本研究评估了四种大型语言模型在Java程序静态和动态切片上的性能,发现GPT-4o表现最佳但准确率有限,并通过提示设计等策略提升了准确率。

摘要:

程序切片是软件工程中的一项关键技术,使开发人员能够隔离代码的相关部分,用于错误检测、代码理解和调试等任务。在本研究中,我们探讨了大型语言模型(LLMs)在静态和动态程序切片中的应用,重点关注Java程序。我们评估了四种最先进的LLM——GPT-4o、GPT-3.5 Turbo、Llama-2和Gemma-7B——的性能,利用了先进的提示技术,包括少样本学习和思维链推理。使用一个由来自LeetCode问题的100个Java程序组成的数据集,我们的实验表明,GPT-4o在静态和动态切片方面均优于其他LLM,分别达到了60.84%和59.69%的准确率。我们的结果还显示,我们实验的LLM在静态切片或动态切片方面尚未达到合理的性能。通过严格的人工分析,我们开发了一个根因和失败位置的分类体系,以更深入地探索不成功的案例。我们确定复杂控制流是失败的最常见根因,大多数问题发生在变量声明和赋值位置。为了提高LLM的性能,我们进一步研究了两种基于我们分类体系的独立提示策略,包括提示设计(涉及改进提示以更好地引导LLM完成切片过程)和迭代提示(模型接收关于失败根因和位置的反馈并重新生成其响应)。我们的评估表明,这两种提示增强方法可以分别将准确率提高4%和3.9%。

英文摘要:

Program slicing is a critical technique in software engineering, enabling developers to isolate relevant portions of code for tasks such as bug detection, code comprehension, and debugging. In this study, we investigate the application of large language models (LLMs) to both static and dynamic program slicing, with a focus on Java programs. We evaluate the performance of four state-of-the-art LLMs- GPT-4o, GPT-3.5 Turbo, Llama-2, and Gemma-7B leveraging advanced prompting techniques, including few-shot learning and chain-of-thought reasoning. Using a dataset of 100 Java programs derived from LeetCode problems, our experiments reveal that GPT-4o performs the best in both static and dynamic slicing across other LLMs, achieving an accuracy of 60.84% and 59.69%, respectively. Our results also show that the LLMs we experimented with are yet to achieve reasonable performance for either static slicing or dynamic slicing. Through a rigorous manual analysis, we developed a taxonomy of root causes and failure locations to explore the unsuccessful cases in more depth. We identified Complex Control Flow as the most frequent root cause of failures, with the majority of issues occurring in Variable Declarations and Assignments locations. To improve the performance of LLMs, we further examined two independent strategies for prompting guided by our taxonomy, including prompt crafting, which involved refining the prompts to better guide the LLM through the slicing process, and iterative prompting, where the model receives feedback on the root cause and location of the failure and re-generates its responses. Our evaluation shows these two prompting enhancement approaches can improve accuracy by 4% and 3.9%, respectively.

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

↑