paper-with-me

홈 › Papers

Improving Code Translation with Syntax-Guided and Semantic-aware Preference Optimization

2026-05-13 · Yuhan Wu, Huan Zhang, Wei Cheng, Chen Shen, Jingyue Yang, Wei Hu arxiv

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.

📄 PDF Abstract BibTeX arXiv:2605.13229

Code (0)

등록된 구현이 없습니다.

Tasks

Contrastive LearningCode Translation

Similar Papers 제목 키워드 기반

SASST: Leveraging Syntax-Aware Chunking and LLMs for Simultaneous Speech Translation

2025-08-11 · Zeyu Yang, Lai Wei, Roman Koshkin, Xi Chen 외 arxiv

This work proposes a grammar-based chunking strategy that segments input streams into semantically complete units by parsing dependency relations (e.g., noun phrase boundaries, verb-object structures) and punctuation fea…

NL2LOGIC: AST-Guided Translation of Natural Language into First-Order Logic with Large Language Models

2026-01-29 · Rizky Ramadhana Putra, Raihan Sultan Pasha Basuki, Yutong Cheng, Peng Gao arxiv

Automated reasoning is critical in domains such as law and governance, where verifying claims against facts in documents requires both accuracy and interpretability. Recent work adopts structured reasoning pipelines that…

Code Generation

Semantics-aware Attention Improves Neural Machine Translation

2021-08-17 · ACL ARR August 2021 8 · Anonymous

The integration of syntactic structure into Transformer machine translation has shown positive results, but to our knowledge, no work has attempted to do so with semantic structures. In this work we propose two novel par…

DecoderMachine TranslationTranslation

Semantics-aware Attention Improves Neural Machine Translation

2021-10-13 · *SEM (NAACL) 2022 7 · Aviv Slobodkin, Leshem Choshen, Omri Abend

The integration of syntactic structures into Transformer machine translation has shown positive results, but to our knowledge, no work has attempted to do so with semantic structures. In this work we propose two novel pa…

DecoderMachine TranslationTranslation

Exploiting Semantics in Neural Machine Translation with Graph Convolutional Networks

2018-04-23 · NAACL 2018 6 · Diego Marcheggiani, Jasmijn Bastings, Ivan Titov

Semantic representations have long been argued as potentially useful for enforcing meaning preservation and improving generalization performance of machine translation methods. In this work, we are the first to incorpora…

Machine TranslationSentenceTranslation