TransAgent: Enhancing LLM-Based Code Translation via Fine-Grained Execution Alignment
Zhiqiang Yuan, W.Y. Chen, Hanlin Wang, Xin Peng, Zhenpeng Chen, Yiling Lou
Fudan University · Tsinghua University
Abstract
Code translation transforms code between programming languages while preserving functionality, which is critical in software development and maintenance. While traditional learning-based code translation methods have limited effectiveness due to the lack of sufficient parallel training data, Large Language Models (LLMs) have recently advanced this field with their strong code generation and comprehension capabilities. However, code translated by LLMs still suffers from diverse quality issues, such as syntax and semantic errors. In this work, we propose TransAGENT, a novel multi-agent system that eliminates the errors during LLM-based code translation. The main insight of TransAGENT is to localize error-prone code blocks via fine-grained execution alignment between source and target code. We evaluate TransAGENT on a newly constructed benchmark of recent programming tasks to mitigate data leakage. TransAGENT outperforms the latest UniTrans by up to 33.3% in translation accuracy and achieves an average improvement of 56.7% over Agentless in program repair performance. We also conduct an ablation study and evaluate TransAGENT across different LLMs, demonstrating its effectiveness and strong generalizability.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- CodeTransBenchmark: evaluating LLM-based code translation and repair across programming languagesEmpirical Software Engineering · 2026
- Code–Test Co-translation: Towards Practical and Effective Program Migration in the WildProceedings of the ACM on Programming Languages · 2026
- Hallucinations of Large Language Models in Cross-Language Code Translation: Phenomena and MitigationarXiv · 2026
- A Survey of Code-to-Code Translation: From Statistical Rule-Based Systems to LLM AgentsAlgorithms · 2026
- HELO-APR: Enhancing Low-Resource Program Repair through Cross-Lingual Knowledge TransferProceedings of the ACM on software engineering. · 2026
- CodeMeepo: A Multi-Agent Workflow for Repository-Level Code Migration and OptimizationarXiv · 2026