用测试用例自动扩增代码翻译数据,提升多语言转换效果
Bootstrapping Code Translation with Weighted Multilanguage Exploration
- 利用测试用例作为通用验证器,自动生成多语言训练数据
- 在HumanEval-X和TransCoder-Test上超越基线模型,全方向提升
- 动态加权难翻译方向,缓解不同语言对间的训练不平衡
跨多种编程语言的代码翻译至关重要但面临两大挑战:缺乏带有可执行测试用例的并行数据,以及处理多样语言对时的优化失衡。我们提出BootTrans,一种自举方法,同时解决这两个问题。其核心思想是利用测试套件的功能不变性与跨语言可移植性,将丰富的中间语言单元测试适配为多语言强化学习训练的通用验证器。方法引入双池架构,包含种子池与探索池,通过执行引导的经验收集逐步扩展训练数据。此外,设计语言感知加权机制,根据同级语言间相对性能动态优先处理更难的翻译方向,缓解优化失衡。在HumanEval-X和TransCoder-Test基准上的大量实验表明,相比基线大模型,所有翻译方向均有显著提升;消融实验验证了自举与加权组件的有效性。
原文摘要 · Abstract (English)
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 reinforcement learning (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 ablation studies validating the effectiveness of both bootstrapping and weighting components.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。