Bridging Functional Correctness and Runtime Efficiency Gaps in LLM-Based Code Translation

Longhui Zhang, Jiahao Wang, Chenhao Hu, Bingyu Liang, Jing Li +1 more
6/16/2026
cs.CLcs.PL

No confident code implementation found for this paper.

Abstract

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 SwiftTrans, 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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zhang2026bridging,
  title  = {Bridging Functional Correctness and Runtime Efficiency Gaps in LLM-Based Code Translation},
  author = {Longhui Zhang and Jiahao Wang and Chenhao Hu and Bingyu Liang and Jing Li and Min Zhang},
  year   = {2026},
  eprint = {2606.17683},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.17683v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.17683.svg)](https://codeofpaper.com/paper/2606.17683)

Discussion