论文标题

使用元学习的源代码模型即时改编

On-the-Fly Adaptation of Source Code Models using Meta-Learning

论文作者

Shrivastava, Disha, Larochelle, Hugo, Tarlow, Daniel

论文摘要

能够适应看不见的能力,本地环境是成功的源代码模型必须克服的重要挑战。适应此类模型的最流行的方法之一是动态评估。通过动态评估,当在看不见的文件上运行模型时,在观察到该文件中的每个令牌后立即更新模型。在这项工作中,我们建议将上下文适应的问题作为元学习问题。我们旨在培训一个最好的基本源代码模型,该模型最好能够从文件中的信息中学习,以提供改进的缺少令牌的预测。与动态评估不同,此公式使我们能够选择更多目标信息(支持令牌)进行适应,即文件中的目标孔之前和之后。我们考虑了我们调用线路级维护的评估设置,该设置旨在反映IDE中代码自动完成的下游任务。与包括动态评估在内的其他适应基线相比,利用一阶MAML和Reptile等元学习的最新发展,我们证明了大规模Java Github语料库的实验性能提高了,包括动态评估。此外,我们的分析表明,与非自适应基线相比,我们的方法分别提高了标识符和文字的性能,分别提高了44 \%和15 \%。

The ability to adapt to unseen, local contexts is an important challenge that successful models of source code must overcome. One of the most popular approaches for the adaptation of such models is dynamic evaluation. With dynamic evaluation, when running a model on an unseen file, the model is updated immediately after having observed each token in that file. In this work, we propose instead to frame the problem of context adaptation as a meta-learning problem. We aim to train a base source code model that is best able to learn from information in a file to deliver improved predictions of missing tokens. Unlike dynamic evaluation, this formulation allows us to select more targeted information (support tokens) for adaptation, that is both before and after a target hole in a file. We consider an evaluation setting that we call line-level maintenance, designed to reflect the downstream task of code auto-completion in an IDE. Leveraging recent developments in meta-learning such as first-order MAML and Reptile, we demonstrate improved performance in experiments on a large scale Java GitHub corpus, compared to other adaptation baselines including dynamic evaluation. Moreover, our analysis shows that, compared to a non-adaptive baseline, our approach improves performance on identifiers and literals by 44\% and 15\%, respectively.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源