Bridging Functional Correctness and Runtime Efficiency Gaps in LLM-Based Code Translation
Longhui Zhang, Jiahao Wang, Chenhao Hu, Bingyu Liang, Jing Li, Min zhang
摘要
While large language models (LLMs) have greatly advanced the functional correctness of automated code translation systems, the runtime efficiency of translated programs has received comparatively little attention. With the waning of Moore's law, runtime efficiency has become increasingly important for program quality, alongside functional correctness. Our preliminary study reveals that LLM-translated programs often run slower than human-written ones, and this issue cannot be remedied through prompt engineering alone. Therefore, our work proposes SWIFT-TRANS, a code translation framework comprising two key stages: (1) Multi-Perspective Exploration, where MpTranslator leverages parallel in-context learning (ICL) to generate diverse translation candidates; and (2) Difference-Aware Selection, where DiffSelector identifies the optimal candidate by explicitly comparing differences between translations. We further introduce Hierarchical Guidance for MpTranslator and Ordinal Guidance for DiffSelector, enabling LLMs to better adapt to these two core components. To support the evaluation of runtime efficiency in translated programs, we extend existing benchmarks, CodeNet and F2SBench, and introduce a new benchmark, SWIFTBENCH. Experimental results across all three benchmarks show that SWIFTTRANS achieves consistent improvements in both correctness and runtime efficiency.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- AlphaTrans: A Neuro-Symbolic Compositional Approach for Repository-Level Code Translation and Validation 引用了 Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code
- AlphaTrans: A Neuro-Symbolic Compositional Approach for Repository-Level Code Translation and Validation 引用了 Exploring and Unleashing the Power of Large Language Models in Automated Code Translation
- AlphaTrans: A Neuro-Symbolic Compositional Approach for Repository-Level Code Translation and Validation 引用了 CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation
它引用的 Paper8
- Learning Performance-Improving Code EditsAlexander Shypula, Aman Madaan, Yimeng Zeng, Uri Alon 等ICLR 2024 · 141 次引用
- Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating CodeRangeet Pan, Ali Reza Ibrahimzada, Rahul Krishna, Divya Sankar 等ICSE 2024 · 96 次引用
- Exploring and Unleashing the Power of Large Language Models in Automated Code TranslationZhen Yang, Fang Liu, Zhongxing Yu, Jacky Wai Keung 等FSE 2024 · 72 次引用
- CodeTransOcean: A Comprehensive Multilingual Benchmark for Code TranslationWeixiang Yan, Yuchen Tian, Yunzhe Li, Qian Chen 等EMNLP Findings 2023 · 32 次引用
- AlphaTrans: A Neuro-Symbolic Compositional Approach for Repository-Level Code Translation and ValidationAli Reza Ibrahimzada, Kaiyao Ke, Mrigank Pawagi, Muhammad Salman Abid 等FSE 2025 · 8 次引用
相关 Paper
- TRACE: Evaluating Execution Efficiency of LLM-Based Code TranslationZhihao Gong, Zeyu Sun, Dong Huang, Qingyuan Liang 等ACL 2026 · 5 次引用
- Function-to-Style Guidance of LLMs for Code TranslationLonghui Zhang, Bin Wang, Jiahao Wang, Xiaofeng Zhao 等ICML 2025
- INTERTRANS: Leveraging Transitive Intermediate Translations to Enhance LLM-Based Code TranslationMarcos Macedo, Yuan Tian, Pengyu Nie, Filipe Roseiro Côgo 等ICSE 2025 · 7 次引用
- ClassEval-T: Evaluating Large Language Models in Class-Level Code TranslationPengyu Xue, Linhao Wu, Zhen Yang, Chengyi Wang 等ISSTA 2025 · 5 次引用
- RustRepoTrans: Repository-level Context Code Translation Benchmark Targeting RustGuangsheng Ou, Mingwei Liu, Yuxuan Chen, Yanlin Wang 等ASE 2025 · 1 次引用
