Embedding API Dependency Graph for Neural Code Generation

Chen Lyu, Ruyun Wang, Hongyu Zhang, Hanwen Zhang, Songlin Hu
3/29/2021
cs.SEcs.AI

Official code: RuYunW/ADG-Seq2Seq (12 stars, Python, last commit 2021-06-06).

Abstract

The problem of code generation from textual program descriptions has long been viewed as a grand challenge in software engineering. In recent years, many deep learning based approaches have been proposed, which can generate a sequence of code from a sequence of textual program description.

Show full abstract

However, the existing approaches ignore the global relationships among API methods, which are important for understanding the usage of APIs. In this paper, we propose to model the dependencies among API methods as an API dependency graph (ADG) and incorporate the graph embedding into a sequence-to-sequence (Seq2Seq) model. In addition to the existing encoder-decoder structure, a new module named ``embedder" is introduced. In this way, the decoder can utilize both global structural dependencies and textual program description to predict the target code. We conduct extensive code generation experiments on three public datasets and in two programming languages (Python and Java). Our proposed approach, called ADG-Seq2Seq, yields significant improvements over existing state-of-the-art methods and maintains its performance as the length of the target code increases. Extensive ablation tests show that the proposed ADG embedding is effective and outperforms the baselines.

View on arXivView PDF

Code Implementations(1)

RuYunW/ADG-Seq2SeqOfficial100%

the implementation of Embedding API Dependency Graph for Neural Code Generation

121PythonMay 14, 20205 years ago

Similar Papers

Cite this paper

@article{lyu2021embedding,
  title  = {Embedding API Dependency Graph for Neural Code Generation},
  author = {Chen Lyu and Ruyun Wang and Hongyu Zhang and Hanwen Zhang and Songlin Hu},
  year   = {2021},
  eprint = {2103.15361},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2103.15361}
}

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

Discussion