Multilingual Code Co-Evolution Using Large Language Models

  • 2023-09-11 20:37:27
  • Jiyang Zhang, Pengyu Nie, Junyi Jessy Li, Milos Gligoric
  • 0

Abstract

Many software projects implement APIs and algorithms in multiple programminglanguages. Maintaining such projects is tiresome, as developers have to ensurethat any change (e.g., a bug fix or a new feature) is being propagated, timelyand without errors, to implementations in other programming languages. In theworld of ever-changing software, using rule-based translation tools (i.e.,transpilers) or machine learning models for translating code from one languageto another provides limited value. Translating each time the entire codebasefrom one language to another is not the way developers work. In this paper, wetarget a novel task: translating code changes from one programming language toanother using large language models (LLMs). We design and implement the firstLLM, dubbed Codeditor, to tackle this task. Codeditor explicitly models codechanges as edit sequences and learns to correlate changes across programminglanguages. To evaluate Codeditor, we collect a corpus of 6,613 aligned codechanges from 8 pairs of open-source software projects implementing similarfunctionalities in two programming languages (Java and C#). Results show thatCodeditor outperforms the state-of-the-art approaches by a large margin on allcommonly used automatic metrics. Our work also reveals that Codeditor iscomplementary to the existing generation-based models, and their combinationensures even greater performance.

 

Quick Read (beta)

loading the full paper ...