Multilingual Code Co-evolution using Large Language Models
Open Access
- 30 November 2023
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 695-707
Abstract
Many software projects implement APIs and algorithms in multiple programming languages. Maintaining such projects is tiresome, as developers have to ensure that any change (e.g., a bug fix or a new feature) is being propagated, timely and without errors, to implementations in other programming languages. In the world of ever-changing software, using rule-based translation tools (i.e., transpilers) or machine learning models for translating code from one language to another provides limited value. Translating each time the entire codebase from one language to another is not the way developers work. In this paper, we target a novel task: translating code changes from one programming language to another using large language models (LLMs). We design and implement the first LLM, dubbed Codeditor, to tackle this task. Codeditor explicitly models code changes as edit sequences and learns to correlate changes across programming languages. To evaluate Codeditor, we collect a corpus of 6,613 aligned code changes from 8 pairs of open-source software projects implementing similar functionalities in two programming languages (Java and C#). Results show that Codeditor outperforms the state-of-the-art approaches by a large margin on all commonly used automatic metrics. Our work also reveals that Codeditor is complementary to the existing generation-based models, and their combination ensures even greater performance.Keywords
All Related Versions
Funding Information
- NSF (National Science Foundation) (CCF-2107291, IIS-2107524, IIS-2145479, CCF-2217696, CCF-2313027)
This publication has 21 references indexed in Scilit:
- On Multi-Modal Learning of Editing Source Code2021
- Automating the removal of obsolete TODO comments2021
- Automated Comment Update: How Far are We?2021
- CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation2021
- Seq2Edits: Sequence Transduction Using Span-level Edit Operations2020
- Learning to Update Natural Language Comments Based on Code Changes2020
- On Learning Meaningful Code Changes Via Neural Machine Translation2019
- Optimizing Statistical Machine Translation for Text SimplificationTransactions of the Association for Computational Linguistics, 2016
- ANTLR: A predicated‐LL(k) parser generatorSoftware: Practice and Experience, 1995
- THE DISTRIBUTION OF THE FLORA IN THE ALPINE ZONE.1New Phytologist, 1912