Skip to main content
QUICK REVIEW

[论文解读] A Hybrid Approach for Learning Program Representations

Ke Wang, Zhendong Su|arXiv (Cornell University)|Jul 3, 2019
Software Engineering Research被引用 1
一句话总结

该论文提出 Liger,一种混合深度神经网络,通过结合符号执行和实际执行轨迹来学习程序表示,在程序语义分类和方法名预测任务中达到最先进性能。Liger 在性能上优于基于语法的模型(如门控图神经网络和 code2vec),同时相比动态模型(如 DyPro)将执行需求降低了 10 倍,且覆盖的路径减少了 74%。

ABSTRACT

Learning neural program embeddings is key to utilizing deep neural networks in program languages research --- precise and efficient program representations enable the application of deep models to a wide range of program analysis tasks. Existing approaches predominately learn to embed programs from their source code, and, as a result, they do not capture deep, precise program semantics. On the other hand, models learned from runtime information critically depend on the quality of program executions, thus leading to trained models with highly variant quality. This paper tackles these inherent weaknesses of prior approaches by introducing a new deep neural network, \liger, which learns program representations from a mixture of symbolic and concrete execution traces. We have evaluated \liger on \coset, a recently proposed benchmark suite for evaluating neural program embeddings. Results show \liger (1) is significantly more accurate than the state-of-the-art syntax-based models Gated Graph Neural Network and code2vec in classifying program semantics, and (2) requires on average 10x fewer executions covering 74\% fewer paths than the state-of-the-art dynamic model \dypro. Furthermore, we extend \liger to predict the name for a method from its body's vector representation. Learning on the same set of functions (more than 170K in total), \liger significantly outperforms code2seq, the previous state-of-the-art for method name prediction.

研究动机与目标

  • 解决现有程序嵌入模型仅依赖源代码或运行时执行所带来的局限性。
  • 通过结合符号执行和实际执行轨迹,提升神经程序嵌入的准确性和鲁棒性。
  • 在保持或提升模型性能的同时,减少训练所需的程序执行次数。
  • 通过统一的表示框架,实现从程序代码嵌入中有效进行方法名预测。

提出的方法

  • Liger 整合符号执行以提取高层次的程序语义,同时利用实际执行轨迹捕捉动态行为。
  • 该模型使用图神经网络编码源自符号分析的控制流和数据依赖结构。
  • 实际执行轨迹通过序列编码器处理,以建模在多种输入下的运行时行为。
  • 通过可学习的注意力机制将符号表示与动态表示融合,生成统一的程序嵌入。
  • 最终嵌入通过在程序语义分类和方法名预测任务上使用对比学习进行端到端优化。
  • 该模型在包含超过 17 万函数的大规模数据集上,对程序语义分类和方法名预测任务进行训练。

实验结果

研究问题

  • RQ1与纯语法或纯动态方法相比,结合符号执行和实际执行轨迹是否能提升神经程序嵌入的准确性?
  • RQ2Liger 在保持或提升模型性能的前提下,能在多大程度上减少所需程序执行的次数?
  • RQ3与现有最先进模型相比,Liger 在下游任务(如方法名预测)中的泛化能力如何?
  • RQ4符号与动态程序表示的融合是否能产生更鲁棒且语义更精确的嵌入?

主要发现

  • 在 CoSeT 基准测试中,Liger 在程序语义分类任务上的准确率显著高于门控图神经网络和 code2vec。
  • 为达到相当的性能,Liger 所需的程序执行次数平均仅为最先进动态模型 DyPro 的 1/10。
  • Liger 覆盖的执行路径比 DyPro 少 74%,同时保持高准确率,表明其样本效率更高。
  • 在方法名预测任务中,Liger 显著优于此前最先进模型 code2seq,在相同包含超过 17 万函数的数据集上表现更优。
  • 该混合方法使 Liger 能够捕捉比仅依赖语法的模型更深层次的语义信息,同时比仅依赖执行的模型表现出更一致的行为。
  • 该模型的统一表示框架使其在多种程序分析任务中均展现出强大的零样本泛化能力。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。