In plain words: A model trained on real code changes and reviews in nine languages learns to judge a change's quality, write review comments, and suggest fixes. It beat the best earlier code-trained models on all three tasks, helped by review-specific practice and mixed languages.
Abstract · Automating Code Review Activities by Large-Scale Pre-training
Code review is an essential part to software development lifecycle since it aims at guaranteeing the quality of codes. Modern code review activities necessitate developers viewing, understanding and even running the programs to assess logic, functionality, latency, style and other factors. It turns out that developers have to spend far too much time reviewing the code of their peers. Accordingly, it is in significant demand to automate the code review process. In this research, we focus on utilizing pre-training techniques for the tasks in the code review scenario. We collect a large-scale dataset of real-world code changes and code reviews from open-source projects in nine of the most popular programming languages. To better understand code diffs and reviews, we propose CodeReviewer, a pre-trained model that utilizes four pre-training tasks tailored specifically for the code review scenario. To evaluate our model, we focus on three key tasks related to code review activities, including code change quality estimation, review comment generation and code refinement. Furthermore, we establish a high-quality benchmark dataset based on our collected data for these three tasks and conduct comprehensive experiments on it. The experimental results demonstrate that our model outperforms the previous state-of-the-art pre-training approaches in all tasks. Further analysis show that our proposed pre-training tasks and the multilingual pre-training dataset benefit the model on the understanding of code changes and reviews.
Zhiyu Li, Shuai Lu, Daya Guo, Nan Duan, Shailesh Jannu, Grant Jenks, Deep Majumder, Jared Green, Alexey Svyatkovskiy, Shengyu Fu, Neel Sundaresan
arXiv:2203.09095 · cs.SE, cs.AI · submitted Mar 17, 2022 · updated Oct 11, 2022
abstract · pdf · html · ESEC/FSE 2022, camera-ready version
> Microsoft Research and LinkedIn researchers have open-sourced CodeReviewer, a pre-trained transformer model that can automatically assess code changes, generate review comments, and suggest fixes. Trained on 7.9M pull requests across 9 programming languages, it achieves a 71.5% F1 score in identifying problematic code changes and can generate relevant review comments with 3.6/5.0 informativeness rating from human evaluators.
> Unlike existing code models, CodeReviewer is specifically trained on code diffs and real-world review comments from high-quality GitHub repositories. The model outperforms previous approaches by learning to "think" like a code reviewer rather than just understanding source code.
Technical details and model available at: https://github.com/microsoft/CodeBERT/tree/master/CodeReview...
I'm thinking GitHub is gonna use some of this learning in Copilot?