paperbot · PL 论文追踪

全部论文 待读 收藏

P2 On Learning Meaningful Code Changes Via Neural Machine Translation

基于神经机器翻译学习有意义的代码改动
ICSE 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE)2019匹配度 2/10 · 该论文研究神经机器翻译在代码改动(pull request)上的学习与复现,属于深度学习用于程序语言任务,但未涉及静态分析、Agentic/LLM 程序分析、浮点程序分析或贝叶斯程序分析,与用户核心研究方向距离较远。引用 254 inbox
Michele Tufano, Jevgenija Pantiuchina, Cody Watson, Gabriele Bavota, Denys Poshyvanyk
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:首次系统评估神经机器翻译模型能否从 pull request 的代码改动中学习并自动复现开发者的修改。

近年来深度学习被广泛用于源代码相关任务,但学界仍缺乏关于「哪些代码改动可以被学习并自动施加」的实证证据。本文以 pull request 中开发者实际提交的改动为学习目标,构建了 236k 对改动前/后的代码组件,训练并评估一个神经机器翻译(NMT)模型来直接生成修改后的代码。定量结果显示:在足够窄的上下文(即改动前后成对的小/中型方法)下,NMT 能自动复现开发者改动的情形最高达 36%。进一步的定性分析表明,模型能够学习并复现多种有意义的代码改动,尤其是重构与缺陷修复。该工作为「深度学习用于代码」方向开辟了新议题,例如重构的自动学习与应用。

问题
将深度学习应用于源代码时,尚不清楚哪些类型的代码改动可以被模型学习并自动施加。
方法
把 pull request 中改动前后的代码组件视为平行语料,用 236k 对样本训练神经机器翻译(NMT)模型来学习并生成代码改动。
评估
在改动前后成对的小/中型方法上量化模型复现开发者改动的比例(最高 36%),并定性分析模型学到的改动类型。
原文摘要(Abstract)

Recent years have seen the rise of Deep Learning (DL) techniques applied to source code. Researchers have exploited DL to automate several development and maintenance tasks, such as writing commit messages, generating comments and detecting vulnerabilities among others. One of the long lasting dreams of applying DL to source code is the possibility to automate non-trivial coding activities. While some steps in this direction have been taken (e.g., learning how to fix bugs), there is still a glaring lack of empirical evidence on the types of code changes that can be learned and automatically applied by DL. Our goal is to make this first important step by quantitatively and qualitatively investigating the ability of a Neural Machine Translation (NMT) model to learn how to automatically apply code changes implemented by developers during pull requests. We train and experiment with the NMT model on a set of 236k pairs of code components before and after the implementation of the changes provided in the pull requests. We show that, when applied in a narrow enough context (i.e., small/medium-sized pairs of methods before/after the pull request changes), NMT can automatically replicate the changes implemented by developers during pull requests in up to 36% of the cases. Moreover, our qualitative analysis shows that the model is capable of learning and replicating a wide variety of meaningful code changes, especially refactorings and bug-fixing activities. Our results pave the way for novel research in the area of DL on code, such as the automatic learning and applications of refactoring.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-1901-09102,
  title = {On Learning Meaningful Code Changes Via Neural Machine Translation},
  author = {Michele Tufano and Jevgenija Pantiuchina and Cody Watson and Gabriele Bavota and Denys Poshyvanyk},
  booktitle = {ICSE},
  year = {2019},
  doi = {10.1109/icse.2019.00021}
}