arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2307.14991cs.SEcs.AI
收藏

使用大型语言模型的多语言代码协同演化

Multilingual Code Co-Evolution Using Large Language Models

UT Austin(德克萨斯大学奥斯汀分校)

Jiyang Zhang, Pengyu Nie, Junyi Jessy Li, Milos Gligoric

AI总结:

本文提出使用大型语言模型Codeditor将代码更改从一种编程语言翻译到另一种编程语言的新任务,该模型将代码更改建模为编辑序列并学习跨语言关联,在6613个对齐代码更改语料库上大幅优于现有方法。

摘要:

许多软件项目以多种编程语言实现API和算法。维护此类项目非常繁琐,因为开发者必须确保任何更改(例如错误修复或新功能)都能及时且无错误地传播到其他编程语言的实现中。在不断变化的软件世界中,使用基于规则的翻译工具(即转译器)或机器学习模型将代码从一种语言翻译到另一种语言提供的价值有限。每次都将整个代码库从一种语言翻译到另一种语言并不是开发者的工作方式。在本文中,我们针对一项新任务:使用大型语言模型(LLMs)将代码更改从一种编程语言翻译到另一种编程语言。我们设计并实现了第一个LLM,称为Codeditor,来解决这一任务。Codeditor明确地将代码更改建模为编辑序列,并学习关联跨编程语言的更改。为了评估Codeditor,我们收集了来自8对开源软件项目的6,613个对齐的代码更改语料库,这些项目在两种编程语言(Java和C#)中实现了相似的功能。结果表明,Codeditor在所有常用的自动指标上均大幅优于最先进的方法。我们的工作还表明,Codeditor与现有的基于生成的模型互补,它们的组合确保了更高的性能。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑