SeTransformer: A Transformer-Based Code Semantic Parser for Code Comment Generation

Zheng Li, Yonghao Wu, Bin Peng, Xiang Chen, Zeyu Sun, Yong Liu, Doyle Paul

Research output: Contribution to journalArticlepeer-review

Abstract

Automated code comment generation technologies can help developers understand code intent, which can significantly reduce the cost of software maintenance and revision. The latest studies in this field mainly depend on deep neural networks, such as convolutional neural networks and recurrent neural network. However, these methods may not generate high-quality and readable code comments due to the long-Term dependence problem, which means that the code blocks used to summarize information are far from each other. Owing to the long-Term dependence problem, these methods forget the previous input data's feature information during the training process. In this article, to solve the long-Term dependence problem and extract both the text and structure information from the program code, we propose a novel improved-Transformer-based comment generation method, named SeTransformer. Specifically, the SeTransformer utilizes the code tokens and an abstract syntax tree (AST) of programs to extract information as the inputs, and then, it leverages the self-Attention mechanism to analyze the text and structural features of code simultaneously. Experimental results based on public corpus gathered from large-scale open-source projects show that our method can significantly outperform five state-of-The-Art baselines (such as Hybrid-DeepCom and AST-Attendgru). Furthermore, we also conduct a questionnaire survey for developers, and the results show that the SeTransformer can generate higher quality comments than those of other baselines.

Original languageEnglish
Pages (from-to)258-273
Number of pages16
JournalIEEE Transactions on Reliability
Volume72
Issue number1
DOIs
Publication statusPublished - 1 Mar 2023

Keywords

  • Code comment generation
  • convolutional neural network (CNN)
  • deep learning
  • program comprehension
  • Transformer

Fingerprint

Dive into the research topics of 'SeTransformer: A Transformer-Based Code Semantic Parser for Code Comment Generation'. Together they form a unique fingerprint.

Cite this