Organizations: National Institute of Technology, Numazu College, Japan · Seikei University, Japan · Osaka Metropolitan University, Japan · Recruit Co., Ltd., Japan · The University of Tokyo, Japan · Tokyo University of Science, Japan · Studio Ousia, Japan
Code translation must preserve executable behavior across many programming languages, yet neural code translation has largely focused on a few popular languages such as C++, Java, and Python. This leaves a niche, many-to-many setting where parallel supervision is sparse, producing plausible but non-executable translations. We address this setting with preference-based reinforcement learning driven by execution-based supervision. Our pipeline firstly expands verifiable seed Python programs into a multilingual pool of execution-validated codes. Using the pool, a base LLM generates translation candidates across language pairs, which we label by their execution outcomes. The resulting preferences are used to train a reward model that scores cross-language translation quality. Finally, we optimize our base LLMs with GRPO over 600 directed language pairs (25 x 24) using the reward model as a signal. To evaluate the niche translation capability, we introduce HumanEval-X++, an execution-based benchmark that extends HumanEval-X to a broad many-to-many language space. We evaluate our approach using Qwen-3.5 4B and 9B models. On HumanEval-X++ and existing benchmarks, it yields consistent gains over the untrained baselines. In particular, the 4B model achieves an average improvement of 13% across all languages on HumanEval-X++, with a gain of 21% on mid-tier languages. Our study establishes a reliable approach of data generation, training, and benchmarking, paving the way toward further bootstrapping the quality of many-to-many translation for programming languages.
Figures & tables
Model
Code Translation
Utilize Execution-Based Verification
Training Method
# of Source
# of Target
TransCoder ( Lachaux et al. 2020 )
3
3
×
Back-Translation
TransCoder-ST ( Roziere et al. 2021 )
3
3
✓
Self-Training
CoTran ( Jana et al. 2023 )
2
2
✓
SFT + RL (PPO)
CodeGeeX ( Zheng et al. 2023 )
7
7
×
SFT
ExeCoder ( He et al. 2025 )
3
3
×
SFT
Table 1: Related work of bootstrapping many-to-many code translation by model training. Language counts (‘# of Source’, ‘# of Target’) refer to the languages covered by each method’s training pipeline. ‘Utilize Execution-Based Verification’ indicates whether actual unit-test execution is used to verify and reward translations during training.
Figure 1: Overview of our pipeline. Data Generation: Stage1 synthesizes assertions for each KodCode Python seed with sandboxed execution-based filtering, followed by type inference. Stage2 exports the code and assertion pairs to 24 further languages. Only candidates passing all transpiled tests are admitted, yielding execution-verified source programs in 25 languages. Stage3 builds the labeled pair data by translating each source into the other 24 languages, and sandboxed execution labels every candidate positive or negative, covering 25×24=600 directions. Training: Stage1 trains a reward model on these execution-verified labels. A single model scores all translation directions. Stage2 optimizes the policy with GRPO over the verified source pool. The learned reward replaces per-language sandboxes at rollout time: RL stably and efficiently scales to 600 directions. Evaluation: HumanEval-X is extended to HumanEval-X++ by the same rule-based transpilation, broadening the target from 6 to 25 languages. The models are evaluated by executing the generated code against the transpiled test suites.
Figure 2: HumanEval-X++ benchmark pipeline. The benchmark is constructed by translating HumanEval problems into multiple target languages via rule-based transpilation. Models generate target-language solutions conditioned on the source declaration and reference solution, along with the target declaration. The generated code is evaluated by executing unit tests in a sandbox environment.
Stage 2
Stage 3
Language
Seed
Verified
Rate
Positive
Negative
Pos. %
Popular
JavaScript
11,070
10,103
91.3
324,036
68,268
77.1
Python
11,124
11,124
100.0
327,777
35,899
86.5
TypeScript
10,267
8,836
86.1
267,149
110,880
66.4
Shell
10,726
6,171
57.5
152,165
241,170
33.3
Table 2: Statistics of Stage 2 and 3 at Data Generation.
Model
Non-Thinking
Thinking
Qwen3.5-4B
14.58
11.74
Qwen3.5-4B + GRPO
15.52
17.30
Qwen3.5-9B
26.76
23.08
Qwen3.5-9B + GRPO
28.78
29.70
Table 4: CodeScope executable pass@1 accuracy (%) over 5,317 translations. Maximum generation length is 8,192.
Figure 3: An example of C++ to Julia translation. Without RL, the output fails to compile because the body of the solution is missing and the end closing the function is omitted. After GRPO, the model emits the same algorithm in conformance with Julia’s conventions and passes the tests.
Code translation converts programs between languages, frameworks, and representations while aiming to preserve behavior and sometimes improve safety or performance.
Transpilation, or code translation, aims to convert source code from one programming language (PL) to another. It is beneficial for many downstream applications, from modernizing large legacy codebases to augmenting data for low-resource PLs. Recent large language model (LLM)-based approaches have demonstrated immense potential for code translation. Among these approaches, training-based methods are particularly important because LLMs currently do not effectively adapt to domain-specific settings that suffer from a lack of knowledge without targeted training. This limitation is evident in transpilation tasks involving low-resource PLs. However, existing training-based approaches rely on a pairwise transpilation paradigm, making it impractical to support a diverse range of PLs. This limitation is particularly prominent for low-resource PLs due to a scarcity of training data. Furthermore, these methods suffer from suboptimal reinforcement learning (RL) reward formulations. To address these limitations, we propose CodePivot, a training framework that leverages Python as an intermediate representation (IR), augmented by a novel RL reward mechanism, Aggressive-Partial-Functional reward, to bootstrap the model's multilingual transpilation ability without requiring parallel corpora. Experiments involving 10 PLs show that the resulting 7B model, trained on Python-to-Others tasks, consistently improves performance across both general and low-resource PL-related transpilation tasks. It outperforms substantially larger mainstream models with hundreds of billions more parameters, such as Deepseek-R1 and Qwen3-235B-A22B-Instruct-2507, on Python-to-Others tasks and Others-to-All tasks, respectively. In addition, it outperforms its counterpart trained directly on Any-to-Any tasks on general transpilation tasks. The code and data are available at https://github.com/lishangyu-hkust/CodePivot.
Shangyu Li, Juyong Jiang, Meibo Ren +7
The Hong Kong University of Science and Technology · The Hong Kong University of Science and Technology (Guangzhou) · Monash University +1
Large language models for code generation often fail on execution, multilingual coverage, and contamination control, especially under frozen backbone constraints. We present CodeForge-MA, a unified framework that improves code synthesis through a multi-agent data forge, execution verified reinforced instruction tuning, and a language conditioned mixture of LoRA adapters. Four specialized agents, Composer, Reviewer, Executor, and Curator, iteratively refine instruction code pairs, validate them with tests, and filter duplicates and benchmark leakage. During training, we combine masked supervised fine tuning with a test driven reinforcement objective to align generations with executable correctness. For the larger model, we use sparse expert routing over low rank adapters to improve cross language transfer while keeping the base model unchanged at inference. Experiments show that joint data, objective, and adapter design yields robust gains across programming languages.
Zhizhou Gu, Xianting Wu, Siyu Gu +2
Northeastern University Bellevue, USA · Columbia University New York, USA · University of Pennsylvania Philadelphia, USA +2
Modern language models demonstrate impressive coding capabilities in common programming languages (PLs), such as C++ and Python, but their performance in lower-resource PLs is often limited by training data availability. In principle, however, most programming skills are universal across PLs, so the capability acquired in one PL should transfer to others. In this work, we propose the task of zero-shot cross-programming-language transfer for code RL. We find that, for Llama-3.1, RL training for code generation in a source PL fails to improve, and sometimes even degrades, the performance on other target PLs. To address this, we hypothesize that effective RL transfer requires a generalizable SFT initialization before RL. We thus propose Parallel-SFT, an SFT strategy that incorporates "parallel programs" -- functionally equivalent code implemented in multiple PLs -- into the data mixture. We demonstrate that this improves transferability: when we subsequently perform RL on our Parallel-SFT model, we observe better generalization to unseen PLs. Analysis of the model internal representations reveals that Parallel-SFT leads to a more functionality-centric latent space, where equivalent programs across PLs are more tightly clustered, which we hypothesize to contribute to the improved transferability.