🛤️ InterTrans: Leveraging Transitive Intermediate Translations to Enhance LLM-based Code Translation
Marcos Macedo1, Yuan Tian1, Pengyu Nie2, Filipe R. Cogo3, Bram Adams1
🚄 Try out InterTrans Engine and speed up your code translation workflows. Click on the documentation above for more information.

We introduce InterTrans, an LLM-based automated code translation approach that, in contrast to existing approaches, leverages intermediate translations across PLs to bridge the syntactic and semantic gaps between source and target PLs. InterTrans contains two stages. It first utilizes 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 (i.e., CodeNet, HumanEval-X, and TransCoder) involving six PLs. Results show an absolute improvement between 18.3% to 43.3% in Computation Accuracy (CA) for InterTrans over Direct Translation with 10 attempts. The best-performing variant of InterTrans (with Magicoder LLM) achieved an average CA of 87.3%-95.4% on three benchmarks.
Citation
If you use InterTrans in your research, please cite our paper:
@article{macedo2024intertrans, title={InterTrans: Leveraging Transitive Intermediate Translations to Enhance LLM-based Code Translation}, author={Macedo, Marcos and Tian, Yuan and Nie, Pengyu and Cogo, Filipe R and Adams, Bram}, journal={arXiv preprint arXiv:2411.01063}, year={2024} }