通过双向互训提升代码并行化翻译的准确性与功能等价性。
QiMeng-MuPa: Mutual-Supervised Learning for Sequential-to-Parallel Code Translation
- 构建翻译器与测试器协同进化框架,互相生成训练数据。
- 使基线模型Pass@1提升28.91%,测试器性能提升68.90%。
- 适合需要高可靠代码转换的编译器与AI编程研究者。
GPU高性能计算的兴起推动了CUDA等并行编程模型的广泛应用,但并行编程的复杂性催生了对自动化串行到并行代码转换的需求。然而,机器学习方法面临数据稀缺问题,现有回译方法仍无法保证转换后代码的功能等价性。本文提出一种新型互监督学习框架QiMeng-MuPa,由翻译器与测试器构成,通过协同验证与协同演化循环迭代,实现双方共同优化。测试器生成单元测试以验证并筛选功能等价的翻译代码,从而改进翻译器;翻译器则生成翻译代码作为增强输入,用于进化测试器。实验表明,该方法显著提升基线模型性能:应用于Qwen2.5-Coder时,Pass@1最高提升28.91%,测试器性能提升68.90%;在BLEU和CodeBLEU上分别超越CodeRosetta 1.56和6.92,性能接近DeepSeek-R1与GPT-4.1。代码已开源。
原文摘要 · Abstract (English)
The rise of GPU-based high-performance computing (HPC) has driven the widespread adoption of parallel programming models such as CUDA. Yet, the inherent complexity of parallel programming creates a demand for the automated sequential-to-parallel approaches. However, data scarcity poses a significant challenge for machine learning-based sequential-to-parallel code translation. Although recent back-translation methods show promise, they still fail to ensure functional equivalence in the translated code. In this paper, we propose \textbf{QiMeng-MuPa}, a novel \textbf{Mu}tual-Supervised Learning framework for Sequential-to-\textbf{Pa}rallel code translation, to address the functional equivalence issue. QiMeng-MuPa consists of two models, a Translator and a Tester. Through an iterative loop consisting of Co-verify and Co-evolve steps, the Translator and the Tester mutually generate data for each other and improve collectively. The Tester generates unit tests to verify and filter functionally equivalent translated code, thereby evolving the Translator, while the Translator generates translated code as augmented input to evolve the Tester. Experimental results demonstrate that QiMeng-MuPa significantly enhances the performance of the base models: when applied to Qwen2.5-Coder, it not only improves Pass@1 by up to 28.91% and boosts Tester performance by 68.90%, but also outperforms the previous state-of-the-art method CodeRosetta by 1.56 and 6.92 in BLEU and CodeBLEU scores, while achieving performance comparable to DeepSeek-R1 and GPT-4.1. Our code is available at https://github.com/kcxain/mupa.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。