BatFix: Repairing language model-based transpilation

Author:

Ramos Daniel123ORCID,Lynce Inês43ORCID,Manquinho Vasco43ORCID,Martins Ruben1ORCID,Le Goues Claire1ORCID

Affiliation:

1. Carnegie Mellon University, Pittsburgh, United States

2. INESC-ID, Lisbon, Portugal

3. Instituto Superior Técnico - Universidade de Lisboa, Lisbon Portugal

4. INESC-ID, Lisbon Portugal

Abstract

To keep up with changes in requirements, frameworks, and coding practices, software organizations might need to migrate code from one language to another. Source-to-source migration, or transpilation, is often a complex, manual process. Transpilation requires expertise both in the source and target language, making it highly laborious and costly. Languages models for code generation and transpilation are becoming increasingly popular. However, despite capturing code-structure well, code generated by language models is often spurious and contains subtle problems. We propose BatFix , a novel approach that augments language models for transpilation by leveraging program repair and synthesis to fix the code generated by these models. BatFix takes as input both the original program, the target program generated by the machine translation model, and a set of test cases and outputs a repaired program that passes all test cases. Experimental results show that our approach is agnostic to language models and programming languages. BatFix can locate bugs spawning multiple lines and synthesize patches for syntax and semantic bugs for programs migrated from Java to C++ and Python to C++ from multiple language models, including, OpenAI’s Codex .

Funder

National Science Foundation

Portuguese national funds through FCT

Fundação para a Ciência e a Tecnologia

Publisher

Association for Computing Machinery (ACM)

Reference77 articles.

1. On the Accuracy of Spectrum-based Fault Localization

2. Spectrum-Based Multiple Fault Localization

3. Massively Multilingual Neural Machine Translation

4. Program synthesis with large language models;Austin Jacob;CoRR,2021

5. Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. In Proceedings of the 3rd International Conference on Learning Representations (ICLR’15), Yoshua Bengio and Yann LeCun (Eds.). Retrieved from DOI:http://arxiv.org/abs/1409.0473

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3