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

通过相互学习改进用于代码生成的树结构解码器训练

Improving Tree-Structured Decoder Training for Code Generation via Mutual Learning

Xiamen University(厦门大学);Peng Cheng Laboratory(鹏城实验室);University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Xiaomi AI Lab(小米人工智能实验室)

Binbin Xie, Jinsong Su, Yubin Ge, Xiang Li, Jianwei Cui, Junfeng Yao, Bin Wang

摘要:

代码生成的目标是在给定输入自然语言话语的情况下自动生成一段代码。目前,在主流模型中,它被视为序列到树任务,其中解码器输出对应于抽象树的前序遍历的动作序列。然而,这样的解码器仅利用基于前序遍历的先前动作,这不足以确保正确的动作预测。在本文中,我们首先深入分析了上下文建模不同的神经代码生成模型与基于不同的遍历解码(前序遍历与广度优先遍历)之间的差异,然后提出引入一个相互学习的框架,共同训练这些模型。在这个框架下,我们通过相互升华不断增强这两个模型,这涉及到在每个训练步骤中同步执行两个一对一的知识转移。更具体地说,我们交替地选择一个模型作为学生,另一个模型作为其教师,并要求学生拟合其教师的训练数据和动作预测分布。通过这样做,两个模型可以充分吸收彼此的知识,从而可以同时改进。在多个基准数据集上的实验结果和深入分析证明了该方法的有效性。我们在https://github.com/DeepLearnXMU/CGML上发布代码。

英文摘要:

Code generation aims to automatically generate a piece of code given an input natural language utterance. Currently, among dominant models, it is treated as a sequence-to-tree task, where a decoder outputs a sequence of actions corresponding to the pre-order traversal of an Abstract Syntax Tree. However, such a decoder only exploits the preorder traversal based preceding actions, which are insufficient to ensure correct action predictions. In this paper, we first throughly analyze the context modeling difference between neural code generation models with different traversals based decodings (preorder traversal vs breadth-first traversal), and then propose to introduce a mutual learning framework to jointly train these models. Under this framework, we continuously enhance both two models via mutual distillation, which involves synchronous executions of two one-to-one knowledge transfers at each training step. More specifically, we alternately choose one model as the student and the other as its teacher, and require the student to fit the training data and the action prediction distributions of its teacher. By doing so, both models can fully absorb the knowledge from each other and thus could be improved simultaneously. Experimental results and in-depth analysis on several benchmark datasets demonstrate the effectiveness of our approach. We release our code at https://github.com/DeepLearnXMU/CGML.

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

↑