将全局和局部层次信息植入基于序列的代码表示模型
Implant Global and Local Hierarchy Information to Sequence based Code Representation Models
摘要:
利用深度学习技术进行源代码表示是一个重要的研究领域。已经有许多研究学习序列或结构信息的代码表示。但基于序列的模型和非序列模型都有其局限性。研究人员试图将结构信息整合到基于序列的模型中,但他们只挖掘了部分标记级别的分层结构信息。在本文中,我们分析了完整的分层结构如何影响代码序列中的令牌,并将这种影响抽象为代码令牌的一种属性,称为分层嵌入。层次嵌入进一步分为语句级全局层次和令牌级局部层次。此外,我们提出了层次Transformer(HiT),一个简单但有效的序列模型,将完整的分层嵌入的源代码到一个Transformer模型。我们证明了层次嵌入学习代码结构的有效性与可变范围检测任务的实验。进一步的评估表明,HiT优于SOTA基线模型,并在涉及8个不同数据集的分类和生成任务的三个源代码相关任务上显示出稳定的训练效率。
英文摘要:
Source code representation with deep learning techniques is an important research field. There have been many studies that learn sequential or structural information for code representation. But sequence-based models and non-sequence-models both have their limitations. Researchers attempt to incorporate structural information to sequence-based models, but they only mine part of token-level hierarchical structure information. In this paper, we analyze how the complete hierarchical structure influences the tokens in code sequences and abstract this influence as a property of code tokens called hierarchical embedding. The hierarchical embedding is further divided into statement-level global hierarchy and token-level local hierarchy. Furthermore, we propose the Hierarchy Transformer (HiT), a simple but effective sequence model to incorporate the complete hierarchical embeddings of source code into a Transformer model. We demonstrate the effectiveness of hierarchical embedding on learning code structure with an experiment on variable scope detection task. Further evaluation shows that HiT outperforms SOTA baseline models and show stable training efficiency on three source code-related tasks involving classification and generation tasks across 8 different datasets.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。