ExeCoder: Empowering Large Language Models with Executability Representation for Code Translation

Minghua He, Ye Chen, Fangkai Yang, Pu Zhao, Wenjie Yin, Yu Kang, Qingwei Lin, Saravan Rajmohan, Dongmei Zhang2025 · DOI

Introduction

Automated code translation—the process of migrating source code from one programming language to another—remains a significant challenge in software engineering. While Large Language Models (LLMs) have demonstrated remarkable proficiency in code generation, they often struggle with translation tasks. This difficulty arises because standard LLMs primarily learn "contextual semantics" (the textual patterns of code) while neglecting "executability information" (the underlying logic, syntax rules, and data flow). Consequently, translated code may appear correct to a human reader but fail to compile or execute due to subtle syntax errors or variable scope mismatches.

To address this, the authors introduce ExeCoder, a model specifically engineered to bridge the gap between textual representation and executable logic. By integrating structured executability representations into the training process, ExeCoder achieves state-of-the-art performance, surpassing even leading closed-source models like GPT-4o.

The ExeCoder Framework

ExeCoder is built upon the DeepSeek-Coder-6.7b base model and is enhanced through the injection of three distinct types of executability representations extracted via static analysis tools like tree-sitter:

  1. Functional Semantics: Natural language descriptions that define the high-level intent and purpose of the code block.
  2. Syntactic Structure: Abstract Syntax Trees (ASTs) that provide a formal mapping of the code's grammatical structure.
  3. Variable Dependencies: Data Flow Graphs (DFGs) that track the relationships and state changes of variables throughout the execution path.

Because LLMs are optimized for sequential text rather than graph structures, the authors developed a method to "flatten" ASTs and DFGs into natural language descriptions. For example, a graph connection is represented as a descriptive string: "Node 3 represents variable x and is connected to Node 4."

Progressive Executability Representation Learning (PERL)

To effectively teach the model these complex structures, the authors proposed a novel training strategy called Progressive Executability Representation Learning (PERL). Rather than exposing the model to all data types simultaneously, PERL employs a staged fine-tuning approach:

  • Stage 1: Focuses on basic source code.
  • Stage 2: Introduces high-level functional semantics.
  • Stage 3: Incorporates syntactic structures (ASTs).
  • Stage 4: Integrates low-level variable dependencies (DFGs).

This staged progression mimics the human learning process, moving from general intent to granular execution logic, which the authors found to be significantly more effective than mixed-data training.

Datasets and Benchmarking

XLCoST-Instruct

The model was trained on XLCoST-Instruct, a custom instruction-tuning dataset derived from the XLCoST benchmark. It contains approximately 55,000 instances of parallel code in C++, Python, and Java, each paired with its corresponding flattened executability representations.

TransCoder-test-X

During evaluation, the authors identified flaws in the standard TransCoder-test benchmark, where rigid unit tests often failed valid translations due to minor differences in parameter passing or return types. To ensure a fair assessment, they developed TransCoder-test-X, a refined version of the benchmark with manually corrected test cases that accurately reflect the functional correctness of the generated code.

Key Results and Insights

ExeCoder demonstrates a significant leap in code translation accuracy across several metrics:

  • Superiority over Open-Source Models: ExeCoder outperformed leading models such as CodeLlama, Magicoder, and Qwen2.5-Coder by 10.88% to 38.78% in execution-based metrics (Test Computational Accuracy) and 27.44% to 42.97% in match-based metrics (BLEU).
  • Outperforming Closed-Source Giants: Most notably, ExeCoder exceeded the performance of GPT-4o and GPT-4. It surpassed GPT-4 by approximately 2% in execution metrics and achieved a staggering 58% improvement in BLEU scores, indicating much higher fidelity to the source code's structure.
  • Ablation Success: Studies confirmed that each of the three executability representations contributed incrementally to the model's overall success, validating the multi-faceted approach to code representation.

Conclusion and Future Work

The success of ExeCoder highlights a fundamental truth in AI-driven software engineering: code is more than just text. By treating executability as a first-class citizen in the training process, ExeCoder provides a more reliable tool for complex migration tasks.

However, the approach is not without limitations. The process of flattening graphs into text significantly increases the token count, leading to higher computational costs and potential context window constraints for large-scale codebases. Future research will focus on optimizing these representations and exploring even richer forms of code analysis to further enhance the model's understanding of execution state.

Summary updated

BibTeX
@misc{he2025execoder,
  author = {Minghua He and Ye Chen and Fangkai Yang and Pu Zhao and Wenjie Yin and Yu Kang and Qingwei Lin and Saravan Rajmohan and Dongmei Zhang},
  title = {{ExeCoder: Empowering Large Language Models with Executability Representation for Code Translation}},
  year = {2025},
  doi = {10.18653/v1/2025.emnlp-main.362},
}
Figure