arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2208.10091cs.SEcs.AI
收藏

前端JavaScript代码生成的任务扩充方法

Incorporating Domain Knowledge through Task Augmentation for Front-End JavaScript Code Generation

Peking University(北京大学);Alibaba Group(阿里巴巴集团)

Sijie Shen, Xiang Zhu, Yihong Dong, Qizhi Guo, Yankun Zhen, Ge Li

摘要:

代码生成的目的是从自然语言描述中自动生成代码片段。通常,主流的代码生成方法依赖于大量成对的训练数据,包括自然语言描述和代码。然而,在某些特定领域的场景中,构建如此大的用于代码生成的配对语料库是困难的,因为没有直接可用的配对数据,并且需要大量的努力来手动编写代码描述以构建高质量的训练数据集。由于有限的训练数据,生成模型不能很好地训练,并且很可能是过拟合的,使得模型的性能对于现实世界的使用不令人满意。为此,在本文中,我们提出了一种任务增强方法,将领域知识纳入代码生成模型,通过辅助任务和Subtoken-TranX模型,通过扩展原始的TranX模型,以支持subtoken级代码生成。为了验证我们提出的方法,我们收集了一个真实的代码生成数据集并进行了实验,实验结果表明,在我们的数据集上,Subtoken-TranX模型的性能优于原始的TranX模型和Transformer模型,在我们的任务增强方法的帮助下,Subtoken-TranX的精确匹配准确率显著提高了12.75%。模型在多个代码类别上的性能满足工业系统应用的要求。我们提出的方法已被阿里巴巴的BizCook平台采用。据我们所知,这是工业开发环境中采用的第一个域代码生成系统。

英文摘要:

Code generation aims to generate a code snippet automatically from natural language descriptions. Generally, the mainstream code generation methods rely on a large amount of paired training data, including both the natural language description and the code. However, in some domain-specific scenarios, building such a large paired corpus for code generation is difficult because there is no directly available pairing data, and a lot of effort is required to manually write the code descriptions to construct a high-quality training dataset. Due to the limited training data, the generation model cannot be well trained and is likely to be overfitting, making the model's performance unsatisfactory for real-world use. To this end, in this paper, we propose a task augmentation method that incorporates domain knowledge into code generation models through auxiliary tasks and a Subtoken-TranX model by extending the original TranX model to support subtoken-level code generation. To verify our proposed approach, we collect a real-world code generation dataset and conduct experiments on it. Our experimental results demonstrate that the subtoken-level TranX model outperforms the original TranX model and the Transformer model on our dataset, and the exact match accuracy of Subtoken-TranX improves significantly by 12.75% with the help of our task augmentation method. The model performance on several code categories has satisfied the requirements for application in industrial systems. Our proposed approach has been adopted by Alibaba's BizCook platform. To the best of our knowledge, this is the first domain code generation system adopted in industrial development environments.

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

↑