Automatic Code Summarization via Multi-dimensional Semantic Fusing in GNN.
Year: 2020
Type: preprint
Abstract: Source code summarization aims to generate natural language summaries from structured code snippets for better understanding code functionalities. Recent works attempt to encode programs into graphs for learning program semantics and yield promising results. However, these methods only use simple code representations (e.g., AST), which limits the capability of learning the rich semantics for complex programs. Furthermore, these models primarily rely on graph-based message passing, which only captures local neighborhood relations. To this end, in this paper, we combine diverse representations of the source code (i.e., AST, CFG and PDG) into a joint code property graph. To better learn semantics from the joint graph, we propose a retrieval-augmented mechanism to augment source code semantics with external knowledge. Furthermore, we propose a novel attention-based dynamic graph to capture global interactions among nodes in the static graph and followed a hybrid message passing GNN to incorporate both static and dynamic graph. To evaluate our proposed approach, we release a new challenging benchmark, crawled from 200+ diversified large-scale open-source C projects. Our method achieves the state-of-the-art performance, improving existing methods by 1.66, 2.38 and 2.22 in terms of BLEU-4, ROUGE-L and METEOR metrics.
Source: arXiv (Cornell University)
Authors: Shangqing Liu, Yu Chen, Xiaofei Xie, Jing Kai Siow, Yang Liu
Language: English
Subfield: Information Systems
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W3034372013
