A Multi-Modal Transformer-based Code Summarization Approach for Smart Contracts
Research output: Chapters, Conference Papers, Creative and Literary Works › RGC 32 - Refereed conference paper (with host publication) › peer-review
Author(s)
Related Research Unit(s)
Detail(s)
Original language | English |
---|---|
Title of host publication | Proceedings - 2021 IEEE/ACM 29th International Conference on Program Comprehension |
Subtitle of host publication | ICPC 2021 |
Publisher | Institute of Electrical and Electronics Engineers, Inc. |
Pages | 1-12 |
Number of pages | 12 |
ISBN (electronic) | 9781665414036 |
ISBN (print) | 9781665414043 |
Publication status | Published - 2021 |
Publication series
Name | IEEE International Conference on Program Comprehension |
---|---|
ISSN (Print) | 2643-7147 |
ISSN (electronic) | 2643-7171 |
Conference
Title | 29th IEEE/ACM International Conference on Program Comprehension (ICPC 2021) |
---|---|
Location | Virtual |
Period | 18 - 22 May 2021 |
Link(s)
Abstract
Code comment has been an important part of computer programs, greatly facilitating the understanding and maintenance of source code. However, high-quality code comments are often unavailable in smart contracts, the increasingly popular programs that run on the blockchain. In this paper, we propose a Multi-Modal Transformer-based (MMTrans) code summarization approach for smart contracts. Specifically, the MMTrans learns the representation of source code from the two heterogeneous modalities of the Abstract Syntax Tree (AST), i.e., Structure-based Traversal (SBT) sequences and graphs. The SBT sequence provides the global semantic information of AST, while the graph convolution focuses on the local details. The MMTrans uses two encoders to extract both global and local semantic information from the two modalities respectively, and then uses a joint decoder to generate code comments. Both the encoders and the decoder employ the multi-head attention structure of the Transformer to enhance the ability to capture the long-range dependencies between code tokens. We build a dataset with over 300K pairs of smart contracts, and evaluate the MMTrans on it. The experimental results demonstrate that the MMTrans outperforms the state-of-the-art baselines in terms of four evaluation metrics by a substantial margin, and can generate higher quality comments.
Research Area(s)
- Smart Contracts, Code Summarization, Transformer, Graph Convolution, Structure-based Traversal
Citation Format(s)
A Multi-Modal Transformer-based Code Summarization Approach for Smart Contracts. / Yang, Zhen; Keung, Jacky; Yu, Xiao et al.
Proceedings - 2021 IEEE/ACM 29th International Conference on Program Comprehension: ICPC 2021. Institute of Electrical and Electronics Engineers, Inc., 2021. p. 1-12 9463060 (IEEE International Conference on Program Comprehension).
Proceedings - 2021 IEEE/ACM 29th International Conference on Program Comprehension: ICPC 2021. Institute of Electrical and Electronics Engineers, Inc., 2021. p. 1-12 9463060 (IEEE International Conference on Program Comprehension).
Research output: Chapters, Conference Papers, Creative and Literary Works › RGC 32 - Refereed conference paper (with host publication) › peer-review