arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1903.00884cs.NEcs.SE
收藏

CodeGRU:用于Source Code建模的具有门控递归单元的上下文感知深度学习

CodeGRU: Context-aware Deep Learning with Gated Recurrent Unit for Source Code Modeling

Yasir Hussain, Zhiqiu Huang, Yu Zhou, Senzhang Wang

摘要:

最近,基于深度学习的自然语言处理(NLP)模型在源代码建模方面显示出巨大的潜力。然而,这些方法的一个主要局限性是,它们将源代码视为文本的简单标记,而忽略了其上下文、语法和结构依赖性。在这项工作中,我们提出了CodeGRU,门循环单元为基础的源代码语言模型,能够捕捉源代码的上下文,语法和结构的依赖关系。我们介绍了一种新的方法,可以捕获源代码上下文,利用源代码令牌类型。此外,我们采用了一种新的方法,可以学习可变大小的上下文,考虑到源代码的语法,和结构信息。我们用真实世界的数据集对CodeGRU进行了评估,结果表明CodeGRU的性能优于最先进的语言模型,并有助于减少词汇量高达24.93%。与以前的工作不同,我们用一个独立的测试集测试了CodeGRU,这表明我们的方法不需要源代码来自与训练数据相同的域,同时提供建议。我们进一步评估CodeGRU与两个软件工程应用程序:源代码建议,和源代码完成。我们的实验证实,源代码的上下文信息可以是至关重要的,可以帮助改善软件语言模型。CodeGRU的广泛评估表明,它优于最先进的模型。结果进一步表明,所提出的方法可以帮助减少词汇量的大小,并为软件开发人员的实际使用。

英文摘要:

Recently deep learning based Natural Language Processing (NLP) models have shown great potential in the modeling of source code. However, a major limitation of these approaches is that they take source code as simple tokens of text and ignore its contextual, syntactical and structural dependencies. In this work, we present CodeGRU, a gated recurrent unit based source code language model that is capable of capturing source code's contextual, syntactical and structural dependencies. We introduce a novel approach which can capture the source code context by leveraging the source code token types. Further, we adopt a novel approach which can learn variable size context by taking into account source code's syntax, and structural information. We evaluate CodeGRU with real-world data set and it shows that CodeGRU outperforms the state-of-the-art language models and help reduce the vocabulary size up to 24.93\%. Unlike previous works, we tested CodeGRU with an independent test set which suggests that our methodology does not requisite the source code comes from the same domain as training data while providing suggestions. We further evaluate CodeGRU with two software engineering applications: source code suggestion, and source code completion. Our experiment confirms that the source code's contextual information can be vital and can help improve the software language models. The extensive evaluation of CodeGRU shows that it outperforms the state-of-the-art models. The results further suggest that the proposed approach can help reduce the vocabulary size and is of practical use for software developers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑