信息工程大学学报2023,Vol.24Issue(5):586-592,7.DOI:10.3969/j.issn.1671-0673.2023.05.012
LATNN:基于自注意力机制的抽象语法树表示方法
LATNN:Abstract Syntax Tree Representation Method Based on Self-Attention
摘要
Abstract
Abstract syntax tree contains all information about source code,and the hierarchical rela-tionship in the tree structure contains the corresponding structural information about source code.As such,structural information extraction in the abstract syntax tree is key to source code representation learning.Current methods either destroy the key structural information in the complete abstract syn-tax tree,or are driven by recursive traversal operations,which delay the model efficiency.In re-sponse to these problems,a representation method which pay attention to parent-child relationship between nodes and the hierarchical relationship of the abstract syntax tree through the self-attention mechanism is proposed.This method can well express the tree structure and save multiple calcula-tions on same layers.Experimental results show that,compared with TBCNN,our model LATNN im-proves the precision and recall by 2.8%;compared with ASTNN,our model improves the F1 score by 1.3%while the time cost is only 13.9%.关键词
表示学习/自注意力机制/代码相似性Key words
representation learning/self-attention mechanism/code similarity分类
信息技术与安全科学引用本文复制引用
楚嘉玮,董卫宇,刘春玲..LATNN:基于自注意力机制的抽象语法树表示方法[J].信息工程大学学报,2023,24(5):586-592,7.