Function-to-Style Guidance of LLMs for Code Translation

Longhui Zhang, Bin Wang, Jiahao Wang, Xiaofeng Zhao, Min Zhang +5 more
2/14/2026

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Large language models (LLMs) have made significant strides in code translation tasks. However, ensuring both the correctness and readability of translated code remains a challenge, limiting their effective adoption in real-world software development. In this work, we propose F2STrans, a function-to-style guiding paradigm designed to progressively improve the performance of LLMs in code translation. Our approach comprises two key stages: (1) Functional learning, which optimizes translation correctness using high-quality source-target code pairs mined from online programming platforms, and (2) Style learning, which improves translation readability by incorporating both positive and negative style examples. Additionally, we introduce a novel code translation benchmark that includes up-to-date source code, extensive test cases, and manually annotated ground-truth translations, enabling comprehensive functional and stylistic evaluations. Experiments on both our new benchmark and existing datasets demonstrate that our approach significantly improves code translation performance. Notably, our approach enables Qwen-1.5B to outperform prompt-enhanced Qwen-32B and GPT-4 on average across 20 diverse code translation scenarios.

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. 1 weaker match is hidden by default — 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{zhang2026functiontostyle,
  title  = {Function-to-Style Guidance of LLMs for Code Translation},
  author = {Longhui Zhang and Bin Wang and Jiahao Wang and Xiaofeng Zhao and Min Zhang and Hao Yang and Meishan Zhang and Yu Li and Jing Li and Jun Yu},
  year   = {2026},
  eprint = {2507.11083},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2507.11083},
  journal = {ICML 2025 2025}
}

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/2507.11083.svg)](https://codeofpaper.com/paper/2507.11083)

Discussion