TL;DR
ExeCoder is a novel large language model designed to fix a major flaw in automated code translation: generating code that looks correct textually but fails during execution. By training progressively on code structure, functional semantics, and variable dependencies, ExeCoder achieves state-of-the-art performance, even outperforming closed-source giants like GPT-4o.
What Problem Does This Paper Address?
Migrating code between programming languages (e.g., C++ to Python) is a costly, labor-intensive necessity in software engineering. While modern Large Language Models (LLMs) are excellent at capturing the textual semantics of code, they often fail to guarantee executability.
Because standard LLMs are trained primarily on raw text, they lack a deep understanding of the underlying execution states, syntax constraints, and variable dependencies unique to each language. This leads to translation errors where the output code looks plausible but throws runtime exceptions—such as naming a variable in a way that conflicts with a built-in function, or mishandling type conversions.
Methods
To bridge the gap between textual semantics and runtime execution, the authors introduce ExeCoder. The core innovation lies in extracting and explicitly teaching the model three types of "executability representations":
- Functional-semantic Representation: Natural language descriptions that explain exactly what the code does, helping align the intent between the source and target languages.
- Syntactic-structure Representation: Abstract Syntax Trees (ASTs) parsed via
tree-sitterthat capture strict grammatical rules. - Variable-dependency Representation: Data Flow Graphs (DFGs) that map how variables interact and change throughout execution.
Since LLMs process unstructured text rather than raw graphs, ExeCoder flattens ASTs and DFGs into natural language descriptions of nodes and edges.
Crucially, rather than dumping all this information into the model at once, the authors propose PERL (Progressive Executability Representation Learning). This is a four-stage, phased fine-tuning strategy that introduces representations sequentially, mimicking how human experts learn to program:
Datasets
The authors utilized and enhanced two primary datasets:
- XLCoST-Instruct: A specialized instruction fine-tuning dataset built by the authors from the public XLCoST benchmark. It contains roughly 55,000 cleaned and deduplicated instances across C++, Python, and Java.
- TransCoder-test-X: The standard benchmark for code translation, TransCoder-test, suffers from rigid unit test templates that fail if an LLM uses a slightly alternative (but valid) implementation. The authors manually overhauled this benchmark—aligning return types, fixing syntax errors, and updating test templates—to create a much more reliable evaluation dataset.
Key Insights and Ideas
- Structure Trumps Raw Semantics: Simply copying variable names and code patterns isn't enough for reliable translation. Explicitly feeding structural graphs (ASTs and DFGs) to the model drastically reduces runtime bugs like type errors and naming conflicts.
- Phased Learning Mimics Human Expertise: The ablation studies proved that training the model step-by-step (via PERL) yields significantly better results than mixing all representations into a single training phase. Staging the complexity helps the model build more robust internal representations.
- Rigid Benchmarks Mask True LLM Capability: By fixing the broken unit tests in the original TransCoder benchmark, the authors highlighted how brittle evaluation metrics can penalize perfectly functional code.
Key Results
Evaluated on TransCoder-test-X across C++, Python, and Java, ExeCoder achieved state-of-the-art status:
- Beating Closed-Source Models: ExeCoder achieved an average Test Computational Accuracy (TCA) of 83.035%, outperforming GPT-4 (81.558%) and GPT-4o (80.014%).
- Outperforming Open-Source Baselines: It surpassed its own base model (Deepseek-Coder-6.7b-instruct) by over 10.8% on execution metrics and showed massive leaps in match-based metrics like BLEU and CodeBLEU.
Limitations and Future Work
The primary limitation of ExeCoder is token overhead. Converting complex code graphs (ASTs and DFGs) into textual descriptions generates highly verbose prompts. While this data fits within modern LLM context windows, it significantly inflates fine-tuning and inference costs, which limits the model's scalability for massive codebases.
In the future, the authors plan to explore more compact, optimized code analysis representations to reduce this computational overhead.
Summary updated