用合成数据和自适应训练提升开源代码翻译模型性能
ACT: Bridging the Gap in Code Translation through Synthetic Data Generation & Adaptive Training
- 构建合成数据集并结合单元测试保障翻译准确性
- 通过动态调参实现训练与数据生成的智能迭代优化
- 适合关注代码迁移安全与效率的开发者和企业
代码翻译是软件开发与迁移中的关键环节,可提升语言间互操作性与软件可持续性。传统方法依赖手工规则,灵活性与可扩展性差;而先进语言模型多为闭源API,存在数据安全与依赖风险。本文提出自动代码翻译微调框架ACT,支持在本地部署开源大模型。其核心为合成数据生成模块,基于初始代码样本构建高质量数据集,并引入单元测试确保功能正确性与多样性。评估采用执行级检查,全面衡量翻译质量。控制器模块动态调整超参数,根据实时反馈决定是否继续训练或生成新数据,实现智能优化。实验表明,ACT显著提升开源模型表现,提供安全可靠的替代方案。在工业级迁移项目中应用该数据生成流程后,开发效率明显提高。
原文摘要 · Abstract (English)
Code translation is a crucial process in software development and migration projects, enabling interoperability between different programming languages and enhancing software adaptability and thus longevity. Traditional automated translation methods rely heavily on handcrafted transformation rules, which often lack flexibility and scalability. Meanwhile, advanced language models present promising alternatives but are often limited by proprietary, API-based implementations that raise concerns over data security and reliance. In this paper, we present Auto-Train for Code Translation (ACT), an innovative framework that aims to improve code translation capabilities by enabling in-house finetuning of open-source Large Language Models (LLMs). ACT's automated pipeline significantly boosts the performance of these models, narrowing the gap between open-source accessibility and the high performance of closed-source solutions. Central to ACT is its synthetic data generation module, which builds extensive, high-quality datasets from initial code samples, incorporating unit tests to ensure functional accuracy and diversity. ACT's evaluation framework incorporates execution-level checks, offering a comprehensive assessment of translation quality. A key feature in ACT is its controller module, which manages the entire pipeline by dynamically adjusting hyperparameters, orchestrating iterative data generation, and finetuning based on real-time evaluations. This enables ACT to intelligently optimize when to continue training, generate additional targeted training data, or stop the process. Our results demonstrate that ACT consistently enhances the effectiveness of open-source models, offering businesses and developers a secure and reliable alternative. Additionally, applying our data generation pipeline to industry-scale migration projects has led to a notable increase in developer acceleration.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。