CODIT: Code Editing with Tree-Based NeuralMachine Translation
Preprint
Abstract
The way developers edit day-to-day code tends to be repetitive, often using existing code elements. Many researchers have tried to automate repetitive code changes by learning from specific change templates which are applied to limited scope. The advancement of Neural Machine Translation (NMT) and the availability of vast open-source evolutionary data opens up the possibility of automatically learning those templates from the wild. However, unlike natural languages, for which NMT techniques were originally devised, source code and its changes have certain properties. For instance, compared to natural language, source code vocabulary can be significantly larger. Further, good changes in code do not break its syntactic structure. Thus, deploying state-of-the-art NMT models without adapting the methods to the source code domain yields sub-optimal results. To this end, we propose a novel Tree based NMT system to model source code changes and learn code change patterns from the wild. We realize our model with a change suggestion engine: CODIT and train the model with more than 30k real-world changes and evaluate it on 6k patches. Our evaluation shows the effectiveness of CODIT in learning and suggesting patches.CODIT also shows promise generating bug fix patches.Keywords
All Related Versions
This publication has 15 references indexed in Scilit:
- SEQUENCER: Sequence-to-Sequence Learning for End-to-End Program RepairIEEE Transactions on Software Engineering, 2019
- On Learning Meaningful Code Changes Via Neural Machine Translation2019
- code2vec: learning distributed representations of codeProceedings of the ACM on Programming Languages, 2019
- A Survey of Machine Learning for Big Code and NaturalnessACM Computing Surveys, 2018
- GenProg: A Generic Method for Automatic Software RepairIEEE Transactions on Software Engineering, 2011
- Recurring bug fixes in object-oriented programs2010
- A novel co-evolutionary approach to automatic software bug fixing2008
- Logic Program Synthesis from Incomplete Information1995
- A faster algorithm computing string edit distancesJournal of Computer and System Sciences, 1980
- Three models for the description of languageIEEE Transactions on Information Theory, 1956