arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2009.09777cs.SEcs.AIcs.PL
收藏

TreeCaps:用于Source Code处理的基于树的胶囊网络

TreeCaps: Tree-Based Capsule Networks for Source Code Processing

School of Information Systems, Singapore Management University(新加坡管理大学信息系统学院);School of Computing & Communications, The Open University, UK(英国开放大学计算与通信学院)

Nghi D. Q. Bui, Yijun Yu, Lingxiao Jiang

摘要:

最近,已经提出了程序学习技术来基于语法结构(例如,抽象树)和/或语义信息(例如,依赖图)。虽然图可能比树更好地捕捉代码语义的各种观点,但从代码构建图输入需要静态代码语义分析,这可能不准确并在学习期间引入噪声。虽然语法树是根据语言语法精确定义的,并且比图更容易构造和处理,但以前的基于树的学习技术无法从树中学习语义信息以实现比基于图的技术更好的准确性。我们提出了一种新的学习技术,名为TreeCaps,通过融合胶囊网络与基于树的卷积神经网络,实现学习精度高于现有的基于图的技术,而它是只基于树。TreeCaps将新的变静态路由算法引入到胶囊网络中,以弥补以往路由算法的不足。除了准确性,我们还发现,TreeCaps是最强大的承受那些语义保持程序转换,改变代码语法,而不修改语义。在大量Java和C/C ++程序上进行评估后,TreeCaps模型在程序理解任务(如代码功能分类和函数名称预测)的准确性和鲁棒性方面优于程序源代码的先前深度学习模型

英文摘要:

Recently program learning techniques have been proposed to process source code based on syntactical structures (e.g., Abstract Syntax Trees) and/or semantic information (e.g., Dependency Graphs). Although graphs may be better at capturing various viewpoints of code semantics than trees, constructing graph inputs from code needs static code semantic analysis that may not be accurate and introduces noise during learning. Although syntax trees are precisely defined according to the language grammar and easier to construct and process than graphs, previous tree-based learning techniques have not been able to learn semantic information from trees to achieve better accuracy than graph-based techniques. We propose a new learning technique, named TreeCaps, by fusing together capsule networks with tree-based convolutional neural networks, to achieve learning accuracy higher than existing graph-based techniques while it is based only on trees. TreeCaps introduces novel variable-to-static routing algorithms into the capsule networks to compensate for the loss of previous routing algorithms. Aside from accuracy, we also find that TreeCaps is the most robust to withstand those semantic-preserving program transformations that change code syntax without modifying the semantics. Evaluated on a large number of Java and C/C++ programs, TreeCaps models outperform prior deep learning models of program source code, in terms of both accuracy and robustness for program comprehension tasks such as code functionality classification and function name prediction

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

↑