GypSum: Learning Hybrid Representations for Code Summarization

Yu Wang, Yu Dong, Xuesong Lu, Aoying Zhou
4/26/2022
cs.SEcs.LGcs.PL

Official code: ICPC2022-Gypsum/GypSum_Code (13 stars, Python, last commit 2022-01-20).

Abstract

Code summarization with deep learning has been widely studied in recent years. Current deep learning models for code summarization generally follow the principle in neural machine translation and adopt the encoder-decoder framework, where the encoder learns the semantic representations from source code and the decoder transforms the learnt representations into human-readable text that describes the functionality of code snippets.

Show full abstract

Despite they achieve the new state-of-the-art performance, we notice that current models often either generate less fluent summaries, or fail to capture the core functionality, since they usually focus on a single type of code representations. As such we propose GypSum, a new deep learning model that learns hybrid representations using graph attention neural networks and a pre-trained programming and natural language model. We introduce particular edges related to the control flow of a code snippet into the abstract syntax tree for graph construction, and design two encoders to learn from the graph and the token sequence of source code, respectively. We modify the encoder-decoder sublayer in the Transformer's decoder to fuse the representations and propose a dual-copy mechanism to facilitate summary generation. Experimental results demonstrate the superior performance of GypSum over existing code summarization models.

View on arXivView PDF

Code Implementations(1)

Official implementation of our work, 'GypSum: Learning Hybrid Representations for Code Summarization'.

130Python, Jupyter NotebookJan 19, 20224 years ago
code-summarizationdeep-learninggraph-attention-networksgraph-neural-networksmachine-learning

Similar Papers

Cite this paper

@article{wang2022gypsum,
  title  = {GypSum: Learning Hybrid Representations for Code Summarization},
  author = {Yu Wang and Yu Dong and Xuesong Lu and Aoying Zhou},
  year   = {2022},
  eprint = {2204.12916},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2204.12916}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2204.12916.svg)](https://codeofpaper.com/paper/2204.12916)

Discussion