🤖 AI Summary
Existing code translation models often generate non-executable or semantically inaccurate code due to insufficient modeling of runtime logic. To address this, we propose the first executability-aware large language model, explicitly integrating three complementary executability representations—functional semantics, syntactic structure, and variable dependencies—into both pretraining and fine-tuning. Specifically, we construct variable dependency graphs via static analysis, augment token embeddings with syntax tree information, and enforce functional equivalence constraints during supervised fine-tuning. We introduce TransCoder-test-X, a new authoritative benchmark for rigorous evaluation. On this benchmark, our model substantially outperforms leading open-source code models (+10.88%–42.97% absolute improvement) and surpasses GPT-4o, establishing the first code translation paradigm fundamentally driven by executability.
📝 Abstract
Code translation is a crucial activity in the software development and maintenance process, and researchers have recently begun to focus on using pre-trained large language models (LLMs) for code translation. However, existing LLMs only learn the contextual semantics of code during pre-training, neglecting executability information closely related to the execution state of the code, which results in unguaranteed code executability and unreliable automated code translation. To address this issue, we propose ExeCoder, an LLM specifically designed for code translation, aimed at utilizing executability representations such as functional semantics, syntax structures, and variable dependencies to enhance the capabilities of LLMs in code translation. To evaluate the effectiveness of ExeCoder, we manually enhanced the widely used benchmark TransCoder-test, resulting in a benchmark called TransCoder-test-X that serves LLMs. Evaluation of TransCoder-test-X indicates that ExeCoder achieves state-of-the-art performance in code translation, surpassing existing open-source code LLMs by over 10.88% to 38.78% and over 27.44% to 42.97% on two metrics, and even outperforms the renowned closed-source LLM GPT-4o. Website: https://execoder4trans.github.io/