On Multi-Modal Learning of Editing Source Code
Authors:
- 1 November 2021
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 443-455
Abstract
In recent years, Neural Machine Translator (NMT) has shown promise in automatically editing source code. Typical NMT based code editor only considers the code that needs to be changed as input and suggests developers with a ranked list of patched code to choose from - where the correct one may not always be at the top of the list. While NMT based code editing systems generate a broad spectrum of plausible patches, the correct one depends on the developers’ requirement and often on the context where the patch is applied. Thus, if developers provide some hints, using natural language, or providing patch context, NMT models can benefit from them.As a proof of concept, in this research, we leverage three modalities of information: edit location, edit code context, commit messages (as a proxy of developers’ hint in natural language) to automatically generate edits with NMT models. To that end, we build Modit, a multi-modal NMT based code editing engine. With in-depth investigation and analysis, we show that developers’ hint as an input modality can narrow the search space for patches and outperform state-of-the-art models to generate correctly patched code in top-1 position.Keywords
All Related Versions
This publication has 39 references indexed in Scilit:
- On the "naturalness" of buggy code2016
- The Uniqueness of Changes: Characteristics and Applications2015
- Fine-grained and accurate source code differencing2014
- Defects4J: a database of existing faults to enable controlled testing studies for Java programs2014
- A study of repetitiveness of code changes in software evolution2013
- Lase: Locating and applying systematic edits by learning from examples2013
- Reconciling manual and automatic refactoring2012
- Systematic editingACM SIGPLAN Notices, 2011
- A graph-based approach to API usage adaptationACM SIGPLAN Notices, 2010
- Example-Based Program TransformationLecture Notes in Computer Science, 2008