Skeleton-Guided-Translation: A Benchmarking Framework for Code Repository Translation with Fine-Grained Quality Evaluation

Xing Zhang, Jiaheng Wen, Fangkai Yang, Pu Zhao, Yu Kang, Junhao Wang, Maoquan Wang, Yufan Huang, Elsie Nallipogu, Qingwei Lin, Yingnong Dang, Saravan Rajmohan, Dongmei Zhang, Qi ZhangarXiv 2025 · DOI

TL;DR

This paper introduces Skeleton-Guided-Translation, a novel framework and benchmark (TRANSREPO-BENCH) for translating entire code repositories, addressing limitations of existing methods that focus on individual functions or use coarse evaluation. It achieves this by first translating a repository's structural "skeleton" to guide the full translation and employing fine-grained, test-case-level evaluation for more accurate quality assessment.

What Problem Does This Paper Address?

Modernizing enterprise applications and migrating legacy code to newer, more secure languages is a growing need, often driven by advancements in large language models (LLMs). However, current code translation benchmarks often fall short. They typically focus on translating individual functions or small code snippets, failing to capture the complexities of translating entire software repositories. These complexities include maintaining inter-module coherence, managing dependencies between different parts of the codebase, and ensuring overall structural integrity. Existing repository-level benchmarks also suffer from issues like poor maintainability and overly coarse evaluation metrics (e.g., just checking if the code compiles), which don't provide developers with actionable insights into where translations went wrong. This makes it difficult to reliably assess and improve LLM performance for real-world code migration tasks.

Methods

The core of the proposed solution is the Skeleton-Guided-Translation framework. It employs a two-step process:

  1. Skeleton Translation: First, the framework extracts and translates the structural "skeleton" of the target repository. This skeleton is a simplified version of the repository that preserves the file structure, dependencies, and interfaces but replaces function bodies with trivial return statements. This skeleton acts as a contract, guiding the LLM to focus on accurate dependency and interface translation.
  2. Guided Translation: The full repository translation then proceeds, guided by this translated skeleton. This approach aims to ensure consistency and address repository-level challenges.

For evaluation, the paper introduces fine-grained evaluation metrics. Instead of a binary "compiles or not" metric, it assesses translation quality at the individual unit test case level. This allows for the recognition of partial successes even if some parts of the translated repository fail to compile. The framework also leverages translated unit tests to systematically validate the functionality of the translated code.

Datasets

The paper introduces TRANSREPO-BENCH, a new benchmark for repository-level code translation. It consists of:

  • High-quality open-source Java repositories.
  • Corresponding C# "target repository skeletons."
  • Matching unit tests for the translated code.
  • Build configuration files for evaluation.

The benchmark currently focuses on Java to C# translation and includes 13 diverse repository tasks, ranging from small projects with few classes to larger ones with extensive code coverage. This benchmark is designed to overcome the limitations of previous ones by providing a more structured approach for both translation and evaluation.

Key Insights and Ideas

  • Skeletons are Crucial for Repository-Level Translation: The paper strongly argues that translating a structural "skeleton" of the target repository is essential. This skeleton acts as a blueprint, guiding LLMs to correctly handle inter-file dependencies and interfaces, which are critical for repository-level coherence.
  • Fine-Grained Evaluation is Key to Uncovering True Quality: Relying solely on build success or failure is insufficient. The ability to evaluate at the individual unit test level allows for the identification of partial successes and provides more actionable feedback to developers, moving beyond a simple pass/fail scenario.
  • Iterative Refinement Doesn't Always Guarantee Improvement: The study observed that while iterative refinement can reduce errors, it doesn't always lead to better overall performance, suggesting that error propagation can be a significant issue.
  • Repository Structure Heavily Influences Translation Success: The performance of LLMs varies significantly across different repositories, indicating that certain coding patterns and structural complexities pose greater challenges for translation.

Key Results

  • TRANSREPO-BENCH Effectiveness: The proposed Skeleton-Guided-Translation framework, when evaluated on TRANSREPO-BENCH, showed significant improvements in evaluation capabilities compared to existing methods like RepoTransBench. For instance, RepoTransBench often scored 0 for most tasks, while the new method could assign scores even when overall compilation failed, recognizing partial successes.
  • Model Performance: Among the evaluated LLMs, DeepSeek-v3 demonstrated the most consistent performance, achieving the highest average build rate (71.14%) and a competitive unit test pass rate (22.32%). GPT-4-turbo and Qwen-plus also showed strong build rates.
  • Failure Analysis: The study identified common failure patterns, including static variable misalignment, unresolved dependencies, and namespace conflicts. Runtime errors were a significant category, though their proportion decreased with iterative refinement.
  • Necessity of Skeletons: Experiments showed that omitting skeletons substantially degraded both build success and unit test pass rates, underscoring their importance for dependency resolution and accurate evaluation.

Limitations and Future Work

  • Limitations:
    • The current benchmark focuses solely on Java to C# translation, and future work aims to extend this to other language pairs.
  • The manual effort required for fixing translated skeletons and unit tests was significant, indicating room for further automation.
  • The study noted that iterative refinement doesn't always guarantee improvement, suggesting that LLMs can struggle with differentiating constructive feedback from noise.
  • Future Work:
    • Expanding the benchmark to include more language pairs.
  • Developing more automated tools for fixing translated skeletons and unit tests.
  • Investigating strategies to mitigate error propagation during iterative refinement.
  • Further exploring how LLMs handle complex code structures and niche language features.

Summary updated

BibTeX
@misc{zhang2025skeleton,
  author = {Xing Zhang and Jiaheng Wen and Fangkai Yang and Pu Zhao and Yu Kang and Junhao Wang and Maoquan Wang and Yufan Huang and Elsie Nallipogu and Qingwei Lin and Yingnong Dang and Saravan Rajmohan and Dongmei Zhang and Qi Zhang},
  title = {{Skeleton-Guided-Translation: A Benchmarking Framework for Code Repository Translation with Fine-Grained Quality Evaluation}},
  year = {2025},
  eprint = {2501.16050},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.16050},
}
Figure