arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.06902cs.SEcs.AI
收藏

BabelCoder: 基于规范对齐的代理代码翻译

BabelCoder: Agentic Code Translation with Specification Alignment

Concordia University(康科迪亚大学);York University(约克大学)

Fazle Rabbi, Soumit Kanti Saha, Tri Minh Triet Pham, Song Wang, Jinqiu Yang

AI总结:

BabelCoder通过代理协作框架提升代码翻译准确性,实现94.16%的平均准确率。

摘要:

随着软件系统的发展,开发者越来越多地在多种编程语言之间工作,并经常面临将代码从一种语言迁移到另一种语言的需要。尽管自动代码翻译提供了一个有前途的解决方案,但这一任务长期以来一直是个挑战。最近大型语言模型(LLMs)的进步显示出在该任务上的潜力,但现有方法在准确性上仍然有限,并未能有效利用代码中的上下文和结构线索。先前的工作探讨了翻译和修复机制,但缺乏一个结构化的、代理化的框架,其中多个专门的代理协作提高翻译质量。在本工作中,我们介绍了BabelCoder,一个代理框架,通过将任务分解为专门的代理进行翻译、测试和细化,每个代理负责特定方面,如生成代码、验证正确性或修复错误。我们对四个基准数据集进行了评估,并将其与四个最先进的基线进行比较。BabelCoder在94%的情况下优于现有方法,提高了0.5%-13.5%,平均准确率为94.16%。

英文摘要:

As software systems evolve, developers increasingly work across multiple programming languages and often face the need to migrate code from one language to another. While automatic code translation offers a promising solution, it has long remained a challenging task. Recent advancements in Large Language Models (LLMs) have shown potential for this task, yet existing approaches remain limited in accuracy and fail to effectively leverage contextual and structural cues within the code. Prior work has explored translation and repair mechanisms, but lacks a structured, agentic framework where multiple specialized agents collaboratively improve translation quality. In this work, we introduce BabelCoder, an agentic framework that performs code translation by decomposing the task into specialized agents for translation, testing, and refinement, each responsible for a specific aspect such as generating code, validating correctness, or repairing errors. We evaluate BabelCoder on four benchmark datasets and compare it against four state-of-the-art baselines. BabelCoder outperforms existing methods by 0.5%-13.5% in 94% of cases, achieving an average accuracy of 94.16%.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑