arrow
Return

Modeling Structural Features with Structure Position-Aware Attention for Code Summarization

delete2025-12-01
delete0
PRE
AI
J
Jian Luo
Z
Zhiheng Qu
蔡波 cover
蔡波 (Bo Cai) *
DOI:10.1142/S0218194025500512delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
The automatic generation of code comments is a crucial aspect in software engineering as it allows the description of source code functions in natural language. In recent years, researchers have utilized advanced machine translation models, particularly transformer-based models, to achieve remarkable results in the task of code summarization. Despite these advancements, current methods still face some challenges. First, existing models fail to incorporate the rich structural information of the code well, resulting in inadequate summary statements. Second, most generative models are too sensitive to the editing of code text, which results in insufficient generalization ability of the model. To address these issues, we proposed a new model named SPA-Trans(Structure Position-aware Attention Transformer-based model). SPA-Trans uses a distance matrix based on the relative distance of nodes in the AST (Abstract Syntax Tree) to represent the structural correlation between each token, enhancing the model's ability to capture structural information of the source code. Additionally, in order to reduce the sensitivity of the model to code editing, we used the adversarial training method in the embedding layer to simulate code editing, which improves the generalization of the model. Our experiments on real-world datasets in Java and Python validate the effectiveness of our proposed method.
Keywords:
Code summarization
programming language
text generation
deep learning

Journal

I
International Journal of Software Engineering and Knowledge Engineering
IF:
0.6
Papers:
107
Citations:
543

Organization

W
wuhan university
Scholars:
8.1W
Papers: 5.8W
Citations: 70
Cited Papers

Cited Papers

errShare
errSave
Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation
err2014-01-01
err0
errOAAI
errKyunghyun Cho; Bart van Merrienboer; Caglar Gulcehre; Dzmitry Bahdanau; Fethi Bougares; Holger Schwenk; Yoshua Bengio
errShare
errSave
errShare
errSave
Deep code comment generation
err2018-05-28
err0
errOAAI
errXing Hu; Ge Li; Xin Xia; David Lo; Zhi Jin
errShare
errSave
researcher View more