[论文解读] Dynamic Neural Program Embeddings for Program Repair
本文提出了一种动态神经程序嵌入方法,通过执行轨迹捕捉程序语义,将运行时的活跃变量状态建模为序列元组,从而在程序修复任务中提升性能。在学生编程作业和CodeHunt练习上的评估表明,该语义嵌入显著优于基于语法的嵌入方法,并提升了基于搜索的修复效率。
Neural program embeddings have shown much promise recently for a variety of program analysis tasks, including program synthesis, program repair, fault localization, etc. However, most existing program embeddings are based on syntactic features of programs, such as raw token sequences or abstract syntax trees. Unlike images and text, a program has an unambiguous semantic meaning that can be difficult to capture by only considering its syntax(i.e. syntactically similar programs can exhibit vastly different run-time behavior), which makes syntax-based program embeddings fundamentally limited. This paper proposes a novel semantic program embedding that is learned from program execution traces. Our key insight is that program states expressed as sequential tuples of live variable values not only captures program semantics more precisely, but also offer a more natural fit for Recurrent Neural Networks to model. We evaluate different syntactic and semantic program embeddings on predicting the types of errors that students make in their submissions to an introductory programming class and two exercises on the CodeHunt education platform. Evaluation results show that our new semantic program embedding significantly outperforms the syntactic program embeddings based on token sequences and abstract syntax trees. In addition, we augment a search-based program repair system with the predictions obtained from our semantic embedding, and show that search efficiency is also significantly improved.
研究动机与目标
- 为解决基于语法的程序嵌入在捕捉结构相似但语义不同的程序之间的差异方面的局限性。
- 探究执行轨迹——特别是活跃变量值的序列——是否可作为学习程序嵌入的更有效基础。
- 通过利用语义嵌入更高效地引导基于搜索的修复系统,从而改进程序修复。
- 在涉及学生提交代码的实际教育编程场景中,评估语义嵌入的有效性。
提出的方法
- 通过在运行时将程序执行轨迹建模为活跃变量值的序列元组,学习程序嵌入。
- 使用循环神经网络(RNNs)处理并编码这些序列化的程序状态,生成密集的语义嵌入。
- 在程序运行生成的执行轨迹上训练基于RNN的嵌入模型,以捕捉动态语义行为。
- 将所提出的语义嵌入与基于原始标记序列和抽象语法树的语法嵌入进行性能对比。
- 将语义嵌入预测结果集成到基于搜索的程序修复系统中,以引导搜索空间并提升效率。
- 通过真实学生编程提交和CodeHunt练习中的错误类型预测任务,评估嵌入质量。
实验结果
研究问题
- RQ1基于执行轨迹的程序嵌入是否比基于语法的嵌入更能有效捕捉程序语义?
- RQ2所提出的语义嵌入在预测学生编程作业中常见错误类型方面的表现如何?
- RQ3语义嵌入在多大程度上提升了基于搜索的程序修复系统的效率?
- RQ4语义嵌入在不同类型的编程任务和错误模式下的性能增益如何比较?
主要发现
- 所提出的语义程序嵌入在预测学生编程提交中的错误类型方面,显著优于基于标记序列和抽象语法树的语法嵌入。
- 语义嵌入提升了错误预测的准确性,证明其能够捕捉语法本身无法表达的有意义语义差异。
- 当集成到基于搜索的程序修复系统中时,语义嵌入可缩小搜索空间并提升修复效率。
- 该模型在多样化编程任务中表现稳定,涵盖CodeHunt教育平台和入门级编程作业。
- 作为RNN的输入,执行轨迹所表示的序列化活跃变量状态比静态语法结构更自然、更有效。
- 结果表明,语义感知的程序嵌入比纯粹的语法表示更具鲁棒性和信息量,适用于程序修复。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。