面向代码大语言模型有效利用执行轨迹进行程序修复
Towards Effectively Leveraging Execution Traces for Program Repair with Code LLMs
AI总结:
本文研究如何利用程序执行轨迹增强代码大语言模型的自动程序修复能力,通过多种提示策略和实验证明LLM优化的轨迹提示能更稳定地提升修复效果,并优于小模型微调方法。
摘要:
大语言模型(LLMs)在包括自动程序修复(APR)在内的多种编程任务上展现出良好的性能。然而,大多数基于LLM的APR方法仅限于对程序进行静态分析,而忽略了其运行时行为。受知识增强自然语言处理(knowledge-augmented NLP)的启发,本文旨在通过将程序执行轨迹增强到标准APR提示中来弥补这一潜在盲点。我们使用GPT系列模型在三个流行的APR数据集上评估了所提出的方法。实验结果表明,仅在提示中简单加入执行轨迹相比无轨迹基线带来的性能提升有限,在6个测试的数据集/模型配置中仅有2个配置取得提升。我们进一步发现,执行轨迹对APR的有效性会随着其复杂度的增加而下降。我们探索了多种在提示中利用轨迹的策略,并证明经LLM优化的提示能够更一致地优于无轨迹提示。此外,我们表明基于轨迹的提示优于在小规模数据集上微调较小LLM的方法;同时进行的探测研究进一步强化了执行轨迹能够补充LLM推理能力的观点。
英文摘要:
Large Language Models (LLMs) show promising performance on various programming tasks, including Automatic Program Repair (APR). However, most approaches to LLM-based APR are limited to the static analysis of the programs, while disregarding their runtime behavior. Inspired by knowledge-augmented NLP, in this work, we aim to remedy this potential blind spot by augmenting standard APR prompts with program execution traces. We evaluate our approach using the GPT family of models on three popular APR datasets. Our findings suggest that simply incorporating execution traces into the prompt provides a limited performance improvement over trace-free baselines, in only 2 out of 6 tested dataset / model configurations. We further find that the effectiveness of execution traces for APR diminishes as their complexity increases. We explore several strategies for leveraging traces in prompts and demonstrate that LLM-optimized prompts help outperform trace-free prompts more consistently. Additionally, we show trace-based prompting to be superior to finetuning a smaller LLM on a small-scale dataset; and conduct probing studies reinforcing the notion that execution traces can complement the reasoning abilities of the LLMs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。