A Transformer-based Approach for Source Code Summarization

Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang
5/1/2020
476 citations
cs.SEcs.AIcs.LG
transformer-attention

Official code: wasiahmad/NeuralCodeSum (192 stars, Python, MIT, last commit 2022-05-28).

Abstract

Generating a readable summary that describes the functionality of a program is known as source code summarization. In this task, learning code representation by modeling the pairwise relationship between code tokens to capture their long-range dependencies is crucial.

Show full abstract

To learn code representation for summarization, we explore the Transformer model that uses a self-attention mechanism and has shown to be effective in capturing long-range dependencies. In this work, we show that despite the approach is simple, it outperforms the state-of-the-art techniques by a significant margin. We perform extensive analysis and ablation studies that reveal several important findings, e.g., the absolute encoding of source code tokens' position hinders, while relative encoding significantly improves the summarization performance. We have made our code publicly available to facilitate future research.

View on arXivView PDF

Code Implementations(1)

MIT

Official implementation of our work, A Transformer-based Approach for Source Code Summarization [ACL 2020].

19281Python, ShellApr 22, 20204 years agoMIT

Similar Papers

Cite this paper

@article{ahmad2020transformerbased,
  title  = {A Transformer-based Approach for Source Code Summarization},
  author = {Wasi Uddin Ahmad and Saikat Chakraborty and Baishakhi Ray and Kai-Wei Chang},
  year   = {2020},
  eprint = {2005.00653},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2005.00653}
}

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/2005.00653.svg)](https://codeofpaper.com/paper/2005.00653)

Discussion