Escalating LLM-based Code Translation Benchmarking into the Class-level Era

Authors:
  • PXPengyu Xue
    Pengyu Xue
  • LWLinhao Wu
    Linhao Wu
  • CWChengyi Wang
    Chengyi Wang
  • XLXiang Li
    Xiang Li
  • ZYZhen Yang
    Zhen Yang
  • RJRuikai Jin
    Ruikai Jin
  • YZYuxiang Zhang
    Yuxiang Zhang
  • JLJia Li
    Jia Li
  • YPYifei Pei
    Yifei Pei
  • ZSZhaoyan Shen
    Zhaoyan Shen
  • XLXiran Lyu
    Xiran Lyu

Abstract
In recent years, Large Language Models (LLMs) have significantly improved automated code translation, often achieving over 80% accuracy on existing benchmarks. However, most of these benchmarks consist of short, standalone, algorithmic samples that do not reflect practical coding tasks. To address this gap, we introduce ClassEval-T, a class-level code translation benchmark designed to assess LLM performance on real-world coding scenarios. Built upon ClassEval, a class-level Python code generation benchmark covering topics such as database operations and game design, ClassEval-T extends into Java and C++ with complete code samples and test suites, requiring 360 person-hours for manual migration. We propose three translation strategies (holistic, min-dependency, and standalone) and evaluate six recent LLMs across various families and sizes on ClassEval-T. Results reveal a significant performance drop compared to method-level benchmarks, highlighting discrepancies among LLMs and demonstrating ClassEval-T's effectiveness. We further analyze LLMs' dependency awareness in translating class samples and categorize 1,397 failure cases by the best-performing LLM for practical insights and future improvement.

This publication has 10 references indexed in Scilit: