arrow
Return

CoSS: Leveraging Statement Semantics for Code Summarization

delete2023-01-01
delete2
PRE
AI
C
Chaochen Shi
B
Borui Cai
Y
Yao Zhao
L
Longxiang Gao
K
Keshav Sood
Y
Yong Xiang *
DOI:10.1109/TSE.2023.3256362delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Automated code summarization tools allow generating descriptions for code snippets in natural language, which benefits software development and maintenance. Recent studies demonstrate that the quality of generated summaries can be improved by using additional code representations beyond token sequences. The majority of contemporary approaches mainly focus on extracting code syntactic and structural information from abstract syntax trees (ASTs). However, from the view of macro-structures, it is challenging to identify and capture semantically meaningful features due to fine-grained syntactic nodes involved in ASTs. To fill this gap, we investigate how to learn more code semantics and control flow features from the perspective of code statements. Accordingly, we propose a novel model entitled CoSS for code summarization. CoSS adopts a Transformer-based encoder and a graph attention network-based encoder to capture token-level and statement-level semantics from code token sequence and control flow graph, respectively. Then, after receiving two-level embeddings from encoders, a joint decoder with a multi-head attention mechanism predicts output sequences verbatim. Performance evaluations on Java, Python, and Solidity datasets validate that CoSS outperforms nine state-of-the-art (SOTA) neural code summarization models in effectiveness and is competitive in execution efficiency. Further, the ablation study reveals the contribution of each model component.
Keywords:
Attention mechanism
code summarization
control flow graph
graph neural network

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
2.8K
Citations:
1.1W

Organization

Q
Qilu University of Technology
Scholars:
1.1W
Papers: 8.9K
Citations: 16
D
Deakin University
Scholars:
2.0W
Papers: 2.1W
Citations: 2.8W