arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.12339cs.SEcs.AI
收藏

Treefix:利用前缀树实现代码执行

Treefix: Enabling Execution with a Tree of Prefixes

University of Stuttgart(斯图加特大学)

Beatriz Souza, Michael Pradel

AI总结:

Treefix利用大型语言模型迭代生成代码前缀树,通过执行反馈优化前缀,最大化代码执行覆盖率,在Python数据集上比现有方法提升25%和7%覆盖率。

摘要:

执行代码是各种动态程序分析的前提。学习引导执行被提出作为一种方法,通过让神经模型为任何缺失变量预测可能的值,从而实现对任意代码片段的执行。尽管最先进的学习引导执行方法(如LExecutor)能够执行相对较高比例的代码,但它们仅限于预测一组受限的可能值,并且不使用先前执行的反馈来执行更多代码。本文提出了Treefix,一种新颖的学习引导执行方法,利用大型语言模型(LLMs)迭代地创建代码前缀,以启用给定代码片段的执行。该方法以多步骤方式解决问题,每一步使用关于代码片段及其执行的反馈来指示LLM改进先前生成的前缀。此过程迭代地创建一棵前缀树,其中一部分前缀返回给用户,这些前缀最大化代码片段中执行的行数。在我们使用两个Python代码片段数据集的实验中,Treefix相对于当前最先进的学习引导执行方法,覆盖率分别提高了25%和7%,总共覆盖了代码片段中所有行的84%和82%。

英文摘要:

The ability to execute code is a prerequisite for various dynamic program analyses. Learning-guided execution has been proposed as an approach to enable the execution of arbitrary code snippets by letting a neural model predict likely values for any missing variables. Although state-of-the-art learning-guided execution approaches, such as LExecutor, can enable the execution of a relative high amount of code, they are limited to predicting a restricted set of possible values and do not use any feedback from previous executions to execute even more code. This paper presents Treefix, a novel learning-guided execution approach that leverages LLMs to iteratively create code prefixes that enable the execution of a given code snippet. The approach addresses the problem in a multi-step fashion, where each step uses feedback about the code snippet and its execution to instruct an LLM to improve a previously generated prefix. This process iteratively creates a tree of prefixes, a subset of which is returned to the user as prefixes that maximize the number of executed lines in the code snippet. In our experiments with two datasets of Python code snippets, Treefix achieves 25% and 7% more coverage relative to the current state of the art in learning-guided execution, covering a total of 84% and 82% of all lines in the code snippets.

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

↑