Function-to-Style Guidance of LLMs for Code Translation
Longhui Zhang, Bin Wang, Jiahao Wang, Xiaofeng Zhao, Min Zhang, Hao Yang, Meishan Zhang, Yu Li, Jing Li, Jun Yu, Min Zhang

TL;DR
F2STrans is a two-stage guiding paradigm for LLM-based code translation that enhances correctness and readability by combining functional and style learning, supported by a new comprehensive benchmark.
Contribution
The paper introduces F2STrans, a novel function-to-style guiding approach for LLMs in code translation, along with a new benchmark for evaluation.
Findings
F2STrans significantly improves code translation quality.
Qwen-1.5B outperforms larger models like GPT-4 on the benchmark.
The approach effectively balances correctness and readability in translated code.
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques
