A Multi-Perspective Investigation into Code Migration for Large Language Models

Yuqi WangApplied and Computational Engineering 2026 · DOI

TL;DR

This paper surveys the rapidly evolving field of code migration using Large Language Models (LLMs). It highlights how LLMs are improving migration efficiency and accuracy, moving beyond simple code snippets to complex industrial scenarios, but also points out critical limitations in handling non-functional aspects like security and performance, and the need for better evaluation systems.

What Problem Does This Paper Address?

Automated code migration, the process of converting source code from one language or framework to another while preserving functionality, is crucial for software evolution and maintenance. Traditionally, this has been a labor-intensive and error-prone human task. The advent of LLMs has opened new avenues for automating this process, making it a hot research area. However, the field is fragmented, with a lack of systematic collation of existing work. This makes it difficult for practitioners to understand the current state-of-the-art, assess the adaptability of different approaches to various tasks, and identify the most effective technical routes for large-scale, high-reliability industrial migrations.

Methods

The paper presents a comprehensive survey and multi-perspective analysis of 20 key LLM-based code migration works from the past five years. The analysis is structured around two core dimensions: Task Orientation and Methodology.

Under Task Orientation, the authors examine research progress in areas like:

  • Datasets and Benchmark Suites: How researchers are addressing data scarcity and creating standardized environments for evaluation.
  • Evaluation Dimensions and Quality Analysis: The shift from simple syntactic similarity to more robust functional and property-based testing.
  • Model Improvement and Tool Development: Techniques to enhance LLM performance and build practical migration tools.
  • Empirical Research and Human-AI Collaboration: Understanding developer interaction with AI for migration.

Under Methodology, the paper categorizes approaches into three main paths:

  • LLM-based Approaches: Direct application of LLMs, prompt engineering, and iterative feedback mechanisms for repair.
  • NMT-based Approaches: Leveraging Neural Machine Translation, often with architectural innovations or intermediate representations.
  • Traditional Non-learning-based Analysis: Approaches that rely on program analysis, mutation testing, and empirical research for quality assurance.

The paper emphasizes that current dominant approaches are increasingly integrated, combining LLM generation with traditional verification techniques.

Datasets

The paper discusses several datasets and benchmarks relevant to code migration:

  • CoST dataset: Contains 42 language pairs, addressing data scarcity for low-resource migration scenarios.
  • CodeXGLUE: A comprehensive benchmark dataset covering 10 tasks for code understanding and generation, providing a standardized comparison platform.
  • CodeTransOcean: Focuses on multilingual and niche programming languages.
  • CodeMEnv: Expands the benchmarking environment to more challenging cross-library version and dynamic adaptation scenarios.
  • PyMigBench-2.0 and PyMigTax taxonomy: Specifically for characterizing Python library migrations.

Key Insights and Ideas

  • Feedback Loops are Game-Changers: Iterative feedback mechanisms and multi-step repair, as seen in UniTrans and PyCraft, are significantly improving the functional correctness of LLM-generated code, moving LLMs beyond simple translators to tools with preliminary repair capabilities.
  • Evaluation is Getting Smarter: The field is moving beyond superficial metrics like BLEU scores to more rigorous methods like functional property testing and mutation analysis, which better reveal model vulnerabilities to minor code changes.
  • Industrial Adoption is Happening: Google's internal use of LLM + AST hybrid workflows demonstrates the practical value and feasibility of these technologies for large-scale, industrial-grade code migration.
  • LLMs as "Teammates": Research is exploring human-AI collaboration, viewing LLMs as partners in the migration process, with a strong emphasis on the need for robust testing to build trust.
  • The "Syntactic Mapping" Era is Over: The focus has shifted from simple code translation to achieving semantic equivalence, requiring deeper understanding and more sophisticated verification.

Key Results

The paper doesn't present new experimental results but synthesizes findings from 20 surveyed works. Key qualitative findings include:

  • LLMs have significantly improved the efficiency and accuracy of code migration.
  • Existing works have advanced from simple snippet translation to complex industrial-grade scenarios.
  • LLMs can replicate typical code smells in target languages, and iterative repair can sometimes harm functional correctness.
  • Unsupervised translation models have shown high accuracy for common language pairs without parallel data.
  • LLMs can struggle with deep logic contradictions, complex I/O types, and cross-file dependencies.
  • A significant portion of migrations involve non-function mappings, challenging the "function-to-function" assumption.
  • Models can introduce security vulnerabilities even while ensuring functionality.
  • Models are often dependent on training data and struggle with rapidly iterated APIs or private code ecosystems.

Limitations and Future Work

The paper identifies several key limitations in current LLM-based code migration research:

  • Over-reliance on Test Suites: Verification often depends on existing unit tests, which are frequently absent in legacy systems, hindering reliable migration.
  • Limited Granularity: Research is largely confined to the function level, lacking an in-depth understanding of project-level global architectural dependencies (inter-file calls, global state).
  • Neglect of Non-functional Attributes: There's a significant gap in addressing performance, memory overhead, and security of migrated code.
  • Data Dependency: Models struggle with rapidly evolving APIs and private codebases due to a lack of up-to-date training data.

Based on these limitations, the authors propose several future directions:

  • Verification without Test Suites: Develop automated differential testing tools that generate random inputs to compare old and new code outputs.
  • Project-Level Granularity: Build models with a global perspective to understand and process cross-file dependencies and architectural designs.
  • Incorporate Non-functional Goals: Treat operational efficiency, memory usage, and security as critical constraints during migration.
  • Knowledge-Enhanced Architectures: Develop models that accurately capture behavioral differences between source and target interfaces, especially for rapidly iterated libraries.
  • Standardized Evaluation Systems: Establish more comprehensive and reliable evaluation frameworks.
  • Real-time Synchronization: Focus on adapting to the latest API changes and evolving technical frameworks.

Summary updated

Abstract

With the rise of large language models (LLMs), their powerful capabilities in code understanding and generation have paved a new technical path for automated code migration, making LLM-based code migration a growing research hotspot. Despite the surging number of relevant studies, there is still a lack of systematic collation, resulting in an unclear overall picture of its technical paths and task adaptability. To address this issue, this paper conducts a comprehensive survey of typical works related to LLM-based code migration in recent years and a systematic multi-perspective investigation of the important ones, focusing on two core dimensions: Methods and Tasks. Centering on different methodological paths such as LLM feedback and traditional analysis, as well as task scenarios including data resources, quality analysis, and tool development and improvement, the paper systematically summarizes their highlights and limitations. The study finds that methodologically, the generation and understanding capabilities of LLMs have improved the efficiency and accuracy of code migration; in terms of tasks, existing works have realized the leap from simple snippet translation to complex industrial-grade scenarios. However, current research still has obvious common limitations in handling non-functional attributes such as in-depth semantic understanding, cross-file global dependencies, and performance and security assurance. Based on the survey results, this paper points out that the lack of technical reliability and evaluation testing dimensions is the key bottleneck at present, and proposes future development directions including constructing a knowledge-enhanced migration framework, establishing a standardized evaluation system, and processing full project associations.
BibTeX
@inproceedings{wang2026multi,
  author = {Yuqi Wang},
  title = {{A Multi-Perspective Investigation into Code Migration for Large Language Models}},
  booktitle = {Applied and Computational Engineering},
  year = {2026},
  doi = {10.54254/2755-2721/2026.as32228},
}
Figure