Code translation across multiple programming languages is essential yet challenging due to two vital obstacles: scarcity of parallel data paired with executable test oracles, and optimization imbalance when handling diverse language pairs. We propose BootTrans, a bootstrapping method that resolves both obstacles. Its key idea is to leverage the functional invariance and cross-lingual portability of test suites, adapting abundant pivot-language unit tests to serve as universal verification oracles for multilingual RL training. Our method introduces a dual-pool architecture with seed and exploration pools to progressively expand training data via execution-guided experience collection. Furthermore, we design a language-aware weighting mechanism that dynamically prioritizes harder translation directions based on relative performance across sibling languages, mitigating optimization imbalance. Extensive experiments on the HumanEval-X and TransCoder-Test benchmarks demonstrate substantial improvements over baseline LLMs across all translation directions, with ablations validating the effectiveness of both bootstrapping and weighting components.
翻译:跨多编程语言的代码翻译至关重要,但由于两大障碍而极具挑战性:一是兼具可执行测试预言功能的并行数据稀缺,二是处理多样语言对时存在的优化不平衡问题。我们提出了BootTrans,一种能同时解决这两个障碍的自举方法。其核心思想是利用测试套件的功能不变性与跨语言可移植性,将丰富的枢轴语言单元测试适配为多语言强化学习训练的通用验证预言。我们的方法引入了一个包含种子池和探索池的双池架构,通过执行引导的经验收集逐步扩展训练数据。此外,我们设计了一种语言感知的加权机制,该机制基于兄弟语言间的相对性能动态地优先处理更困难的翻译方向,从而缓解优化不平衡问题。在HumanEval-X和TransCoder-Test基准上的大量实验表明,该方法在所有翻译方向上均显著优于基线大语言模型,消融实验也验证了自举与加权组件的有效性。