Source-linked AI summary

Bootstrapping Niche Multilingual Code Translation via Reinforcement Learning with Execution-Based Verifiable Supervision

Kouki Yuki, Jie Zeng, Kyoko Ogawa, Ryunosuke Ikeda, Yohei Kobashi, Takeshi Kojima, Ikuya Yamada, Yusuke Iwasawa, Yutaka Matsuo

arXiv:2608.13854v1cs.CL

TL;DR

Many-to-many code translation lacks scalable supervision for preserving executable behavior across niche languages. The paper bootstraps execution-validated multilingual data, trains a reward model, and optimizes translation with GRPO, yielding consistent gains, including 13% average improvement for the 4B model across HumanEval-X++ languages.

  • Problem

    Many-to-many code translation remains underexplored because supervision is sparse for less-represented languages, despite the need to preserve executable behavior across diverse language pairs.

  • Method

    NicheCodeTranslator bootstraps execution-validated multilingual code, trains a reward model from execution-labeled preferences, and optimizes translations with GRPO across 600 directed language pairs.

  • Results

    13% average improvement across all languages was achieved by the 4B model on HumanEval-X++, with a 21% gain on mid-tier languages over the untrained baseline.

  • Takeaways & Limitations

    Learned execution-outcome rewards enable the training pipeline to scale stably to 25 target languages without per-language execution infrastructure.

Abstract

from arXiv · show

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.

1 Introduction

The paper targets reliable many-to-many code translation for underrepresented languages, where sparse supervision increases the risk of plausible but non-executable outputs. It introduces an execution-validated reinforcement-learning pipeline, a broader benchmark, and evaluations showing gains over non-trained baselines.

  • Motivation: Many-to-many translation must preserve executable behavior across diverse language pairs despite sparse supervision and weaker language-specific knowledge.These conditions increase the risk of plausible-looking but incorrect translations.
  • Problem: Prior efforts mainly cover popular languages and individual directions, leaving less-represented languages underexplored and scalable execution-derived supervision unresolved.The introduction identifies this gap as the motivation for bootstrapping niche many-to-many translation with reinforcement learning.
  • Approach: NicheCodeTranslator bootstraps reward-model supervision by expanding verifiable Python seeds into execution-validated multilingual code and labeling generated translation candidates by execution outcomes.The pipeline then uses these preferences to support reinforcement-learning optimization across many language pairs.
  • Benchmark: HumanEval-X++ extends HumanEval-X from source: 6 languages -> target: 6 languages to source: 6 languages -> target: 25 languages for broader many-to-many evaluation.It is designed as an execution-based benchmark covering popular and less-represented translation directions.
  • Results: 13% average improvement across all languages on HumanEval-X++ is achieved by the 4B model, including a 21% gain on mid-tier languages over non-trained baselines.Experiments use Qwen-3.5 4B and 9B on HumanEval-X++ and CodeScope, with consistent gains reported over the non-trained baselines.

2 Related Work

Prior code-translation research has progressed from unsupervised multilingual translation and large-scale pretraining toward execution-aware training, but coverage remains concentrated in a few languages. Reinforcement learning with execution verification is promising yet difficult to scale because it requires language-specific compilation, runtimes, and test harnesses during rollout.

  • Code translation prioritizes functional equivalence over surface similarity, making compilability, executability, and unit-test pass rate central evaluation criteria.
  • TransCoder demonstrated unsupervised many-to-many translation among C++, Java, and Python without parallel data, but did not use executability signals and covered only three languages.
  • CodeGeeX pretrained on 23 individual languages using roughly 850 billion tokens, then fine-tuned on translation pairs spanning 7 languages and introduced HumanEval-X.
  • Execution-related representations such as function semantics, ASTs, and variable dependencies improved translation accuracy, but the target-language scope remained limited to C++, Java, and Python.
  • Prior reinforcement-learning approaches used unit-test or intermediate-representation rewards, while other work distilled reasoning-augmented translation data; neither automatically synthesized tests nor augmented training data.
  • RL with execution-based verification requires a compiler, runtime, and test harness for every language during rollout, hindering practical expansion to niche and long-tail languages.

3 NicheCodeTranslator

NicheCodeTranslator propagates execution-based verification from Python to 25 languages, then uses verified multilingual programs to create preference data for reward-model training and GRPO across 25×24 translation directions.

  • Verification propagation: Execution-verified literal assertions provide the scarce tests needed to supervise functionally equivalent translations across languages.Assertions are restricted to single literal-based checks and retained only after sandboxed execution against reference solutions.
  • Pipeline overview: The pipeline has three stages: synthesize valid assertions for Python seeds, export verified artifacts to 24 other languages, and generate multilingual translation data.The stages establish cross-lingual verifiability before reward-model training.
  • Seed preparation: AST analysis recovers concrete parameter and return types from verified assertion literals, while regenerated sandbox tests yield typed seeds with cross-lingual verifiability.Multiple typed variants may be emitted when an instance exhibits multiple observed type combinations.
  • Multilingual expansion: Deterministic transpilers convert each typed Python signature and test independently into target-language forms, dropping untranslatable items and preserving the original verification basis.Verified source programs are produced for every language.
  • Preference data generation: For each verified source and 24 alternative targets, sampled candidates are executed and labeled positive, negative, or discarded according to pass-rate thresholds.Candidates passing all tests are positive; candidates below a fixed threshold are negative; intermediate cases are discarded.
  • Reward modeling and policy optimization: A reward model learns execution-grounded graded scores, and GRPO optimizes the policy across 25×24 directed language pairs without running 25 sandboxes at every RL step.The reward model replaces direct execution outcomes during reinforcement learning while retaining execution-based supervision.

4 HumanEval-X++

HumanEval-X++ is an execution-based many-to-many translation benchmark designed to evaluate a shared set of problems across long-tail target languages. It extends six HumanEval-X source languages to 25 MultiPL-E-supported targets and validates generated translations by executing unit tests.

  • Benchmark construction: HumanEval-X++ extends six HumanEval-X source languages to 25 target languages through MultiPL-E rule-based transformation.The benchmark converts declarations, docstrings, and test suites into the target languages.
  • Benchmark construction: 164 HumanEval problems provide the benchmark seeds, each containing a declaration, docstring, reference solution, and unit tests.These components support conditioning and functional-correctness verification.
  • Generation pipeline: Models generate target-language solution code from source declarations and reference solutions, conditioned on the target declaration.Docstrings may optionally accompany both source and target declarations.
  • Evaluation pipeline: Generated translations are validated by executing the target declaration, solution, and test suite in the MultiPL-E sandbox.This provides execution-based correctness evaluation over the same problem subset across target languages.
  • Language categories: The 25 target languages are partitioned into Popular, Mid-tier, and Long-tail categories using GitHub Innovation Graph usage rankings.The ranking uses distinct pushers in the most recent available quarter, 2026 Q1, aggregated across countries and excluding the aggregate EU entry.

5 Experiment

The experiments construct execution-verified multilingual data, train reward-guided policies, and evaluate them on docstring-free HumanEval-X++ and CodeScope. GRPO consistently improves translation accuracy, especially for mid-tier languages, while gains remain limited for some syntactically distant long-tail languages and results reflect a single run.

  • Data generation: Stage 1 produced 11,124 programs from 10,000 seed Python problems, retaining 11.4 verified assertions per program on average.Assertions were synthesized, type-annotated, filtered by sandboxed execution, and required to execute successfully, with at least five valid assertions retained per program.
  • Data generation: Stage 2 generated 184,626 execution-verified source programs, while Stage 3 produced 717,083 preference pairs from 10,724,077 translation rollouts across 25×24 directions.Stage 3 included 3,734,461 positive and 6,284,293 negative samples across four model conditions.
  • Evaluation: HumanEval-X++ evaluates docstring-free translation across language pairs using execution correctness, with up to 164 successfully transformed samples per pair.CodeScope provides a second evaluation set containing 5,317 examples over 182 directions among 14 languages.
  • HumanEval-X++ results: 13.21 points: GRPO raises 4B Non-Thinking average accuracy from 45.08 to 58.29, while 9B rises from 52.42 to 66.04.Under Thinking mode, the corresponding gains are 4B: 44.59 →59.15 and 9B: 52.31 →63.11.
  • HumanEval-X++ results: 21.54 points: the largest Non-Thinking GRPO improvement occurs for 4B Mid-tier languages, compared with +20.55 for 9B and only +6.33 for 4B Long-tail languages.Per-language analysis shows especially large recoveries for Perl, Ruby, Lua, Julia, and D, whose base-model scores were very low.
  • Additional results and limitations: GRPO also improves CodeScope performance, reaching 29.70 for the 9B model in Thinking mode, while some functional and declarative long-tail languages show small or negative gains.For C++→Julia, compilation errors fall from 62.7% (99 cases) to 22.2% (35 cases), and test-passing samples rise from 36.7% (58 cases) to 77.8% (123 cases). All results come from a single run without statistical measures.

6 Conclusion

NicheCodeTranslator bootstraps multilingual code translation by combining execution-validated data, preference-based reward modeling, and GRPO optimization. The study also introduces HumanEval-X++, an execution-based benchmark spanning 25 target languages.

  • Method: NicheCodeTranslator expands verifiable Python seeds into an execution-validated multilingual pool and trains a reward model on execution-labeled preferences.The policy is optimized with GRPO using the learned reward instead of per-language sandboxes.
  • Method: 600 directions across 25 languages are supported with stable scaling using the learned reward rather than per-language sandboxes.
  • Benchmark: HumanEval-X++ extends HumanEval-X with execution-based evaluation across 25 target languages.
  • Results: The method consistently improves over baselines on HumanEval-X++.
Loading 2608.13854v1…