CoChat

Exploring and Unleashing the Power of Large Language Models in Automated Code Translation

Open access
Yang, Zhen, Liu, Fang, Yu, Zhongxing, Keung, Jacky Wai, Li, Jia, Liu, Shuo, Hong, Yifan, Ma, Xiaoxue, Jin, Zhi, Li, Ge · 2024 · Proceedings of the ACM on Software Engineering

The DOI matches its Crossref record; 66 of the 67 references it cites were found in a registry or an index, and 1 are not checked yet.

Abstract

Code translation tools, namely transpilers, are developed for automatic source-to-source translation. Latest learning-based transpilers have shown impressive enhancement against rule-based counterparts in both translation accuracy and readability, owing to their task-specific pre-training on extensive monolingual corpora. Nevertheless, their current performance still remains unsatisfactory for practical deployment, and the associated training resources are also prohibitively expensive. Large Language Models (LLMs), pre-trained on huge amounts of human-written code/text, have shown remarkable performance in many code intelligence tasks due to their powerful generality, even without task-specific re-training/fine-tuning. Thus, LLMs can potentially circumvent the above limitations, but they have not been exhaustively explored yet. This paper investigates diverse LLMs and learning-based transpilers for automated code translation tasks, finding that: although certain LLMs have outperformed current transpilers, they still have some accuracy issues, where most of the failures are induced by a lack of comprehension of source programs (38.51%), missing clear instructions on I/O types in translation (14.94%), and ignoring discrepancies between source and target programs (41.38%). Enlightened by the above findings, we further propose UniTrans , a Unified code Translation framework, applicable to various LLMs, for unleashing their power in this field. Specifically, UniTrans first crafts a series of test cases for target programs with the assistance of source programs. Next, it harnesses the above auto-generated test cases to augment the code translation and then evaluate their correctness via execution. Afterward, UniTrans further (iteratively) repairs incorrectly translated programs prompted by test case execution results. Extensive experiments are conducted on six settings of translation datasets between Python, Java, and C++. Three recent LLMs of diverse sizes, including GPT-3.5 and LLaMA-13B/7B, are tested with UniTrans , and all achieve substantial improvements in terms of computational accuracy and exact match accuracy among almost all translation settings, showing the universal effectiveness of UniTrans in practice.

Overview

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

Crossref · 10.1145/3660778

Cites

66 of 67 references verified0 citation errors · 0 not checkable

Statistics

Figures

Fig. 1 Frequencies of Failed Cases in Each Translation Dataset
Fig. 1 Frequencies of Failed Cases in Each Translation DatasetCC-BY · From the PDF
Fig. 2 UniTrans
Fig. 2 UniTransCC-BY · From the PDF
Fig. 3 An Example of Input Generation Prompt
Fig. 3 An Example of Input Generation PromptCC-BY · From the PDF
Fig. 4 An Example of Translation Augmentation Prompt
Fig. 4 An Example of Translation Augmentation PromptCC-BY · From the PDF
Fig. 5 An Example of Repair Prompt
Fig. 5 An Example of Repair PromptCC-BY · From the PDF
Fig. 6 An Execution Result Example
Fig. 6 An Execution Result ExampleCC-BY · From the PDF
Fig. 7 Basic Prompt
Fig. 7 Basic PromptCC-BY · From the PDF

Verification

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

Citations

Cites

Research works printed but not linked: 3

  1. JWKJW Kotrlik and CCHCC Higgins. 2001. Organizational research: Determining appropriate sample size in survey research appropriate sample size in survey research. Information technology, learning, and performance journal 19, 1 (2001), 43.
  2. Jia Li, Yunfei Zhao, Yongmin Li, Ge Li, and Zhi Jin. 2023. Towards Enhancing In-Context Learning for Code Generation. arXiv preprint arXiv:2303.17780 (2023). · DOI · Paper page
  3. Anh Tuan Nguyen, Tung Thanh Nguyen, and Tien N Nguyen. 2015. Divide-and-conquer approach for multi-phase statistical migration for source code (t). In 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 585-596. · DOI · Paper page

Cited by

See all 241

Metadata

Authors
Yang, Z., Liu, F., Yu, Z., Keung, J. W., Li, J., Liu, S., Hong, Y., Ma, X., Jin, Z., & Li, G.
Affiliations
  • Shandong University (CN)
  • Beihang University (CN)
  • City University of Hong Kong (HK)
  • Peking University (CN)
Venue
Proceedings of the ACM on Software Engineering
Published
2024-07-12
Volume
1
Issue
FSE
Pages
1585-1608
ISSN
2994-970X (ISSN-L)
OpenAlex
W4400582609
Cited by
104
References
55
Citations by year
2026: 46 · 2025: 45 · 2024: 13
FWCI
39.10
Type
journal article
Language
en
Open access
Locations
  • Proceedings of the ACM on software engineering. (publishedVersion)
  • arXiv (Cornell University) (submittedVersion, cc-by)
  • arXiv (Cornell University)
Funders
  • National Key R&D Program (2023YFB4503801)
  • National Natural Science Foundation of China (62102233, 62302021, 62192731, 62192730, 62072007, 62192733, 61832009)
  • Shandong Province Overseas Outstanding Youth Fund (2022HWYQ-043)
  • City University of Hong Kong (7005217,9220097,9220103,9229029,9229098,9678149)
  • Key Program of Hubei (JD2023008)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Artificial Intelligence › Natural Language Processing Techniques
  • Physical Sciences › Computer Science › Software › Software Testing and Debugging Techniques
Keywords
transpiler, large language models, test case generation, program repair, source-to-source translation

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.