SpecTra: Enhancing the Code Translation Ability of Language Models by Generating Multi-Modal Specifications
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) are increasingly being used for the task of automated code translation, which has important real-world applications. However, most existing approaches use only the source code of a program as an input to an LLM, and do not consider the different kinds of specifications that can be extracted from a program. In this paper, we propose SpecTra, a multi-stage approach that uses a novel self-consistency filter to first generate high-quality static specifications, test cases, and natural language descriptions from a given program, and then uses these along with the source code to improve the quality of LLM-generated translations. We evaluate SpecTra on three code translation tasks - C to Rust, C to Go, and JavaScript to TypeScript - and show that it can enhance the performance of six popular LLMs on these tasks by up to a relative improvement of 46%. We also present a case study on extending this approach to handle translation of a full C project to Rust. Our research suggests that generating high-quality specifications could be a promising and efficient way to improve the performance of LLMs for code translation.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). First posted on arXiv 28 May 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 1.
1 paper.
- 2025EffiReasonTrans: RL-Optimized Reasoning for Code Translation21 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2026Enhancing LLM-Based Code Translation with Verified Multi-Semantic Representations ↗
- 2025REMODEL-LLM: Transforming C code to Java using LLMs
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation
- 2025ACT: Bridging the Gap in Code Translation through Synthetic Data Generation & Adaptive Training
- 2026CangjieBench: Benchmarking LLMs on a Low-Resource General-Purpose Programming Language
- 2025TransLibEval: Demystify Large Language Models' Capability in Third-party Library-targeted Code Translation
- 2024RustRepoTrans: Repository-level Code Translation Benchmark Targeting Rust
- 2025When Code Crosses Borders: A Security-Centric Study of LLM-based Code Translation ↗