paperbot · PL 论文追踪

全部论文 待读 收藏

P2 SelfPiCo: Self-Guided Partial Code Execution with LLMs

SelfPiCo:基于LLM的自引导式部分代码执行
ISSTA Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis2024匹配度 3/10 · 该工作用 LLM(Code Llama)辅助部分代码执行与运行时错误检测,属于“LLM 作为工具改进程序分析/调试”的大方向,与 AI→PL 有部分重叠;但其目标是动态执行与类型推断补全,并非静态分析或形式化验证,也不涉及 Agentic 程序、浮点分析或贝叶斯程序分析,且建立在较旧的 Code Llama 之上而非当前强模型。引用 9 inbox
Zhipeng Xue, Zhipeng Gao, Shaohua Wang, Xing Hu, Xin Xia, Shanping Li
crossref: 2026-09-12

AI 速览

一句话:提出 SelfPiCo,用 Code Llama 在交互循环中自引导执行部分代码,显著提升可执行率并检测运行时错误。

部分或任意代码执行对软件调试与测试至关重要,但常因缺少定义和复杂第三方依赖而难以执行。现有方法用机器学习预测未定义元素类型并注入预定义 dummy 值,但受限于简单 dummy 值和无法持续学习。本文设计并实现 SelfPiCo,将开源 LLM(Code Llama)嵌入交互循环来动态引导部分代码执行。它利用 few-shot in-context learning 和 chain-of-thought 推理,并基于微调 Code Llama 持续从执行结果中学习、逐步修正预测。评估表明,SelfPiCo 在开源代码和 Stack Overflow 片段中分别可执行 72.7% 和 83.3% 的代码行,比最新 Lexecutor 高出 37.9% 和 33.5%;并在八个 GitHub 软件项目和 43 个 Stack Overflow 帖子中分别检测到 18 和 33 个运行时类型错误问题。

问题
部分代码或任意代码常因缺少定义和复杂第三方依赖而无法执行,现有机器学习方法通过预测未定义元素类型并注入预定义 dummy 值来支持执行,但其简单 dummy 值和无法持续学习限制了性能。
方法
设计 SelfPiCo,在交互循环中集成开源 LLM Code Llama,采用 few-shot in-context learning 和 chain-of-thought 推理,并基于微调 Code Llama 从代码执行结果中持续学习,逐步细化对未定义元素的预测。
评估
在开源代码和 Stack Overflow 代码片段上评估,SelfPiCo 分别可执行 72.7% 和 83.3% 的代码行,较 Lexecutor 提升 37.9% 和 33.5%;并通过执行八个 GitHub 项目和 43 个 Stack Overflow 帖子中的部分代码,分别检测到 18 和 33 个运行时类型错误问题。
原文摘要(Abstract)

Code executability plays a vital role in software debugging and testing (e.g., detecting runtime exceptions or assertion violations). However, code execution, especially partial or arbitrary code execution, is a non-trivial task due to missing definitions and complex third-party dependencies. To make partial code (such as code snippets posted on the web or code fragments deep inside complex software projects) executable, the existing study has proposed a machine learning model to predict the undefined element types and inject the pre-defined dummy values into execution. However, the performance of their tool is limited due to its simply designed dummy values and the inability to continue learning. In this paper, we design and implement a novel framework, named SelfPiCo (Self-Guided Partial Code Executor), to dynamically guide partial code execution by incorporating the open-source LLM (i.e., Code Llama) within an interactive loop. Particularly, SelfPiCo leverages few-shot in-context learning and chain-of-thought reasoning to elicit human knowledge and logical reasoning based on fine-tuning the Code Llama model. SelfPiCo continuously learns from code execution results and refines its predictions step after step. Our evaluations demonstrate that SelfPiCo can execute 72.7% and 83.3% of all lines in the open-source code and Stack Overflow snippets, outperforming the most recent state-of-the-art Lexecutor by 37.9% and 33.5%, respectively. Moreover, SelfPiCo successfully detected 18 and 33 runtime type error issues by executing the partial code from eight GitHub software projects and 43 Stack Overflow posts, demonstrating the practical usage and potential application of our framework in practice.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8459,
  title = {SelfPiCo: Self-Guided Partial Code Execution with LLMs},
  author = {Zhipeng Xue and Zhipeng Gao and Shaohua Wang and Xing Hu and Xin Xia and Shanping Li},
  booktitle = {ISSTA},
  year = {2024},
  doi = {10.1145/3650212.3680368}
}