Improving Code Translation with Syntax-Guided and Semantic-aware Preference Optimization
Proceedings of the Thirty-Fifth International Joint Conference on Artificial Intelligence. Main Track. Pages 5973-5981.
https://doi.org/10.24963/ijcai.2026/665
Keywords
- Natural Language Processing: Machine translation and multilinguality
- Natural Language Processing: Applications
Abstract
LLMs have shown immense potential for code translation, yet they often struggle to ensure both syntactic correctness and semantic consistency. While preference-based learning offers a promising alignment strategy, it is hindered by unreliable semantic rewards derived from sparse test cases or restrictive reference translations. We argue that a robust semantic reward for code translation must be derived directly from the source code. In this paper, we propose CTO to improve code translation with syntax-guided and semantic-aware preference optimization.
Through contrastive learning, we train a cross-lingual semantic model to directly assess functional equivalence between source and translated code. By formulating code translation as a multi-objective optimization problem, this robust semantic signal is seamlessly unified with compiler-based syntactic feedback within the direct preference optimization framework. Extensive experiments on C++, Java, and Python translations demonstrate that CTO significantly outperforms existing baselines and alternative preference optimization strategies.
@inproceedings{ijcai2026p665,
title = {Improving Code Translation with Syntax-Guided and Semantic-aware Preference Optimization},
author = {Wu, Yuhan and Zhang, Huan and Cheng, Wei and Shen, Chen and Yang, Jingyue and Hu, Wei},
booktitle = {Proceedings of the Thirty-Fifth International Joint Conference on
Artificial Intelligence, {IJCAI-26}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {Diego Calvanese},
pages = {5973--5981},
year = {2026},
month = {8},
note = {Main Track},
doi = {10.24963/ijcai.2026/665},
url = {https://doi.org/10.24963/ijcai.2026/665},
}
TY - CPAPER TI - Improving Code Translation with Syntax-Guided and Semantic-aware Preference Optimization AU - Wu, Yuhan AU - Zhang, Huan AU - Cheng, Wei AU - Shen, Chen AU - Yang, Jingyue AU - Hu, Wei T2 - Proceedings of the Thirty-Fifth International Joint Conference on Artificial Intelligence, IJCAI-26 PB - International Joint Conferences on Artificial Intelligence Organization PY - 2026 SP - 5973 EP - 5981 DO - 10.24963/ijcai.2026/665 UR - https://doi.org/10.24963/ijcai.2026/665 ER -Copied
Machine-readable versions of this paper, for tools and AI agents: