返回
Efficient transformer with code token learner for code clone detection
DOI:10.1016/j.jss.2022.111557.png)
摘要
En 中文
Deep learning techniques have achieved promising results in code clone detection in the past decade. Unfortunately, current deep learning-based methods rarely explicitly consider the modeling of long codes. Worse, the code length is increasing due to the increasing requirement of complex functions. Thus, modeling the relationship between code tokens to catch their long-range dependencies is crucial to comprehensively capture the information of the code fragment. In this work, we resort to the Transformer to capture long-range dependencies within a code, which however requires huge computational cost for long code fragments. To make it possible to apply Transformer efficiently, we propose a code token learner to largely reduce the number of feature tokens in an automatic way. Besides, considering the tree structure of the abstract syntax tree, we present a tree-based position embedding to encode the position of each token in the input. Apart from the Transformer that captures the dependency within a code, we further leverage a cross-code attention module to capture the similarities between two code fragments. Our method significantly reduces the computational cost of using Transformer by 97% while achieves superior performance with state-of-the-art methods. Our code is available at https://github.com/ArcticHare105/Code-Token-Learner.(c) 2022 Elsevier Inc. All rights reserved.
Keyword:
Code clone detection
Code token learner
Efficient transformer
期刊
IF:
4.1
论文数:
5.4K
被引数:
8.4K
机构
暂无机构信息
引用论文
What are the most important factors determining different vegetation types in the Chapada Diamantina, Brazil?决定巴西Chapada Diamantina不同植被类型的最重要因素是什么?
Global Research on Hereditary Hearing Impairment Over the Last 40 Years: A Bibliometric Study过去40年遗传性听力障碍的全球研究: 文献计量研究
Developing Wind and/or Solar Powered Crop Irrigation Systems for the Great Plains为大平原开发风能和/或太阳能作物灌溉系统
The association of the UHRF1BP1 gene with systemic lupus erythematosus was replicated in a Han Chinese population from mainland China在中国大陆汉族人群中复制了 UHRF1BP1 基因与系统性红斑狼疮的关联

