计算机科学
重构代码
人工智能
源代码
源代码行
变压器
机器学习
编码(集合论)
机器翻译
数据挖掘
程序设计语言
软件
物理
集合(抽象数据类型)
量子力学
电压
作者
Shiyi Qi,Yaoxian Li,Cuiyun Gao,Xiaohong Su,Shuzheng Gao,Zibin Zheng,Chuanyi Liu
标识
DOI:10.1109/tr.2022.3194370
摘要
Adapting deep learning (DL) techniques to automate nontrivial coding activities, such as code documentation and defect detection, has been intensively studied recently. Learning to predict code changes is one of the popular and essential investigations. Prior studies have shown that DL techniques, such as neural machine translation (NMT), can benefit meaningful code changes, including bug fixing and code refactoring. However, NMT models may encounter bottleneck when modeling long sequences; thus, they are limited in accurately predicting code changes. In this article, we design a Transformer-based approach, considering that the Transformer has proven effective in capturing long-term dependencies. Specifically, we propose a novel model named DTrans. For better incorporating the local structure of code, i.e., statement-level information in this article, DTrans is designed with dynamically relative position encoding in the multihead attention of the Transformer. Experiments on benchmark datasets demonstrate that DTrans can more accurately generate patches than the state-of-the-art methods, increasing the performance by at least 5.45–46.57% in terms of the exact match metric on different datasets. Moreover, DTrans can locate the lines to change with 1.75–24.21% higher accuracy than the existing methods.
科研通智能强力驱动
Strongly Powered by AbleSci AI