Rectifier: Code Translation with Corrector via LLMs

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Yin, Xin, Ni, Chao, Nguyen, Tien N., Wang, Shaohua, Yang, Xiaohu
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866929416057126912
author Yin, Xin
Ni, Chao
Nguyen, Tien N.
Wang, Shaohua
Yang, Xiaohu
author_facet Yin, Xin
Ni, Chao
Nguyen, Tien N.
Wang, Shaohua
Yang, Xiaohu
contents Software migration is garnering increasing attention with the evolution of software and society. Early studies mainly relied on handcrafted translation rules to translate between two languages, the translation process is error-prone and time-consuming. In recent years, researchers have begun to explore the use of pre-trained large language models (LLMs) in code translation. However, code translation is a complex task that LLMs would generate mistakes during code translation, they all produce certain types of errors when performing code translation tasks, which include (1) compilation error, (2) runtime error, (3) functional error, and (4) non-terminating execution. We found that the root causes of these errors are very similar (e.g. failure to import packages, errors in loop boundaries, operator errors, and more). In this paper, we propose a general corrector, namely Rectifier, which is a micro and universal model for repairing translation errors. It learns from errors generated by existing LLMs and can be widely applied to correct errors generated by any LLM. The experimental results on translation tasks between C++, Java, and Python show that our model has effective repair ability, and cross experiments also demonstrate the robustness of our method.
format Preprint
id arxiv_https___arxiv_org_abs_2407_07472
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Rectifier: Code Translation with Corrector via LLMs
Yin, Xin
Ni, Chao
Nguyen, Tien N.
Wang, Shaohua
Yang, Xiaohu
Software Engineering
Artificial Intelligence
Software migration is garnering increasing attention with the evolution of software and society. Early studies mainly relied on handcrafted translation rules to translate between two languages, the translation process is error-prone and time-consuming. In recent years, researchers have begun to explore the use of pre-trained large language models (LLMs) in code translation. However, code translation is a complex task that LLMs would generate mistakes during code translation, they all produce certain types of errors when performing code translation tasks, which include (1) compilation error, (2) runtime error, (3) functional error, and (4) non-terminating execution. We found that the root causes of these errors are very similar (e.g. failure to import packages, errors in loop boundaries, operator errors, and more). In this paper, we propose a general corrector, namely Rectifier, which is a micro and universal model for repairing translation errors. It learns from errors generated by existing LLMs and can be widely applied to correct errors generated by any LLM. The experimental results on translation tasks between C++, Java, and Python show that our model has effective repair ability, and cross experiments also demonstrate the robustness of our method.
title Rectifier: Code Translation with Corrector via LLMs
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2407.07472