Skeleton-Guided-Translation:一个具有细粒度质量评估的代码仓库翻译基准测试框架
Skeleton-Guided-Translation: A Benchmarking Framework for Code Repository Translation with Fine-Grained Quality Evaluation
AI总结:
针对现有代码翻译基准忽略仓库级复杂性的问题,提出基于骨架引导的Java到C#仓库翻译框架及细粒度评估基准TRANSREPO-BENCH,通过两步翻译和测试用例级指标提升评估准确性与自动化。
摘要:
大型语言模型的发展加剧了企业应用现代化以及将遗留系统迁移至安全、多功能语言的需求。然而,现有的代码翻译基准主要关注单个函数,忽略了翻译整个仓库的复杂性,例如维护模块间的一致性和管理依赖关系。尽管近期一些仓库级翻译基准试图应对这些挑战,但它们仍面临局限性,包括可维护性差和评估粒度过粗,使其对开发者不够友好。我们引入了 Skeleton-Guided-Translation,这是一个具有细粒度质量评估的仓库级 Java 到 C# 代码翻译框架。它采用两步流程:首先翻译仓库的结构“骨架”,然后在这些骨架的引导下翻译完整仓库。在此基础上,我们提出了 TRANSREPO-BENCH,这是一个包含高质量开源 Java 仓库及其对应 C# 骨架的基准,包括匹配的单元测试和构建配置。我们的单元测试是固定的,可应用于多次或增量翻译而无需手动调整,从而增强了评估中的自动化和可扩展性。此外,我们开发了细粒度评估指标,在单个测试用例级别评估翻译质量,解决了传统二元指标在构建失败导致所有测试失败时无法进行区分的问题。使用 TRANSREPO-BENCH 进行的评估突出了关键挑战,并推动了更准确的仓库级代码翻译。
英文摘要:
The advancement of large language models has intensified the need to modernize enterprise applications and migrate legacy systems to secure, versatile languages. However, existing code translation benchmarks primarily focus on individual functions, overlooking the complexities involved in translating entire repositories, such as maintaining inter-module coherence and managing dependencies. While some recent repository-level translation benchmarks attempt to address these challenges, they still face limitations, including poor maintainability and overly coarse evaluation granularity, which make them less developer-friendly. We introduce Skeleton-Guided-Translation, a framework for repository-level Java to C# code translation with fine-grained quality evaluation. It uses a two-step process: first translating the repository's structural "skeletons", then translating the full repository guided by these skeletons. Building on this, we present TRANSREPO-BENCH, a benchmark of high quality open-source Java repositories and their corresponding C# skeletons, including matching unit tests and build configurations. Our unit tests are fixed and can be applied across multiple or incremental translations without manual adjustments, enhancing automation and scalability in evaluations. Additionally, we develop fine-grained evaluation metrics that assess translation quality at the individual test case level, addressing traditional binary metrics' inability to distinguish when build failures cause all tests to fail. Evaluations using TRANSREPO-BENCH highlight key challenges and advance more accurate repository level code translation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。