Skip to yearly menu bar Skip to main content


Poster
in
Workshop: The 3rd DL4C Workshop: Emergent Possibilities and Challenges in Deep Learning for Code

InterTrans: Leveraging Transitive Intermediate Translations to Enhance LLM-based Code Translation

Marcos Macedo · Yuan Tian · Pengyu Nie · Filipe Cogo · Bram Adams


Abstract:

Code translation, the process of converting code between programming languages (PLs), is essential for modernizing legacy systems and ensuring cross-platform compatibility. Despite recent advancements, automated code translation, including methods based on large language models (LLMs), still encounters challenges due to syntactic and semantic mismatches between PLs. In this paper, we introduce InterTrans, an LLM-based automated code translation approach that, unlike existing methods, leverages intermediate translations to bridge the syntactic and semantic gaps between source and target PLs. InterTrans uses a novel Tree of Code Translation (ToCT) algorithm to plan transitive intermediate translation sequences between a given source and target PL, then validates them in a specific order.We evaluate InterTrans with three open LLMs on three benchmarks involving six PLs. Results demonstrate an absolute improvement of 18.3% to 43.3% in Computation Accuracy (CA) for InterTrans compared to Direct Translation with 10 attempts. The best-performing variant of InterTrans (using the Magicoder LLM) achieved an average CA of 87.3%-95.4% across three benchmarks.

Chat is not available.