当前位置: X-MOL 学术Empir. Software Eng. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Embedding API dependency graph for neural code generation
Empirical Software Engineering ( IF 3.5 ) Pub Date : 2021-04-21 , DOI: 10.1007/s10664-021-09968-2
Chen Lyu , Ruyun Wang , Hongyu Zhang , Hanwen Zhang , Songlin Hu

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. 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.



中文翻译:

嵌入API依赖图以生成神经代码

长期以来,从文本程序描述生成代码的问题一直被视为软件工程中的巨大挑战。近年来,已经提出了许多基于深度学习的方法,它们可以从一系列文本程序描述中生成一系列代码。但是,现有方法忽略了API方法之间的全局关系,这对于理解API的用法很重要。在本文中,我们建议将API方法之间的依赖性建模为API依赖性图(ADG),并将该图嵌入到序列到序列(Seq2Seq)模型中。除了现有的编解码器结构外,还引入了一个名为“嵌入式”的新模块。这样,解码器可以利用全局结构依赖性和文本程序描述两者来预测目标代码。我们对三种公共数据集和两种编程语言(Python和Java)进行了广泛的代码生成实验。我们提出的方法称为ADG-Seq2Seq,与现有的最新方法相比有了显着的改进,并且随着目标代码长度的增加而保持了其性能。广泛的消融测试表明,建议的ADG嵌入是有效的,并且性能优于基线。

更新日期:2021-04-21
down
wechat
bug