Rectifier: Code Translation with Corrector via LLMs

Rectifier: Code Translation with Corrector via LLMs

July 2024 | XIN YIN, CHAO NI, TIEN N. NGUYEN, SHAOHUA WANG, XIAOHU YANG
This paper presents Rectifier, a micro and universal model for repairing translation errors in code translation using large language models (LLMs). Code translation is a complex task that requires LLMs to understand both code syntax and semantics. However, LLMs often produce errors during code translation, including compilation errors, runtime errors, functional errors, and non-terminating execution. These errors share similar root causes, such as failure to import packages, errors in loop boundaries, and operator errors. To address these issues, the authors propose Rectifier, a model that learns from errors generated by existing LLMs and can be applied to correct errors from any LLM. The model is fine-tuned on error data and can effectively repair errors generated by various LLMs, including ChatGPT, StarCoder, CodeGen, and CodeLlama. The experiments on the CodeNet and AVATAR datasets show that Rectifier has effective repair ability and robustness across different LLMs. The results demonstrate that the model can correct a significant portion of translation errors, highlighting the universal and LLM-agnostic nature of Rectifier. The paper also discusses the different categories of translation errors and the effectiveness of Rectifier in repairing them. The study shows that Rectifier can successfully repair errors generated by various LLMs, demonstrating its strong capability in error correction. The paper also presents case studies of translation errors and discusses the challenges in repairing certain types of errors, such as logic errors and model-specific errors. The study concludes that Rectifier is a promising solution for code translation error correction.This paper presents Rectifier, a micro and universal model for repairing translation errors in code translation using large language models (LLMs). Code translation is a complex task that requires LLMs to understand both code syntax and semantics. However, LLMs often produce errors during code translation, including compilation errors, runtime errors, functional errors, and non-terminating execution. These errors share similar root causes, such as failure to import packages, errors in loop boundaries, and operator errors. To address these issues, the authors propose Rectifier, a model that learns from errors generated by existing LLMs and can be applied to correct errors from any LLM. The model is fine-tuned on error data and can effectively repair errors generated by various LLMs, including ChatGPT, StarCoder, CodeGen, and CodeLlama. The experiments on the CodeNet and AVATAR datasets show that Rectifier has effective repair ability and robustness across different LLMs. The results demonstrate that the model can correct a significant portion of translation errors, highlighting the universal and LLM-agnostic nature of Rectifier. The paper also discusses the different categories of translation errors and the effectiveness of Rectifier in repairing them. The study shows that Rectifier can successfully repair errors generated by various LLMs, demonstrating its strong capability in error correction. The paper also presents case studies of translation errors and discusses the challenges in repairing certain types of errors, such as logic errors and model-specific errors. The study concludes that Rectifier is a promising solution for code translation error correction.
Reach us at info@study.space
[slides and audio] Rectifier%3A Code Translation with Corrector via LLMs