When using deep learning techniques to model program languages, neural networks with tree or graph structures are widely adopted to capture the rich structural information within program abstract syntax trees (AST). However, long-term/global dependencies widely exist in programs, and most of these neural architectures fail to capture these dependencies. In this paper, we propose Tree-Transformer, a novel recursive tree-structured neural network which aims to overcome the above limitations. Tree-Transformer leverages two multi-head attention units to model the dependency between siblings and parent-children node pairs. Moreover, we propose a bi-directional propagation strategy to allow node information passing in two directions: bottom-up and top-down along trees. By combining bottom-up and top-down propagation, Tree-Transformer can learn both global contexts and meaningful node features. The extensive experimental results show that our Tree-Transformer outperforms existing tree-based or graph-based neural networks in program-related tasks with tree-level and node-level prediction tasks, indicating that Tree-Transformer performs well on learning both tree-level and node-level representations.
翻译:当使用深层学习技术模拟程序语言时,广泛采用树状或图形结构的神经网络,以捕捉程序抽象语法树(AST)中丰富的结构信息。然而,长期/全球依赖性在方案中广泛存在,而这些神经结构大多未能捕捉这些依赖性。在本文件中,我们提议“植树-转变”是一个新颖的再生树结构神经网络,目的是克服上述局限性。“树-转变”利用两个多头关注单位来模拟兄弟姐妹和亲子节点对子之间的依赖性。此外,我们提议双向传播战略,允许节点信息沿着两个方向传递:自下而下和自上而下。通过将自下和自上而下的传播结合起来,树-转变者可以学习全球环境和有意义的节点特征。广泛的实验结果表明,我们的植-转变性网络在与树层和无层预测任务有关的方案任务中,超越了现有的基于树基或基于图形的神经网络,这表明树-转变者在学习树层和节层的表象时表现良好。