← Latest papers
💬 NLP

Fine-tuned LLM-based Code Migration Framework

This paper presents a fine-tuned Large Language Model framework that effectively automates the migration of SQL-based systems from Oracle PL/SQL to PostgreSQL by integrating traditional engineering techniques, iterative error analysis, and expert feedback to significantly reduce syntax errors and optimize database logic.

Original authors: Oleg Grynets, Vasyl Lyashkevych, Dmytro Baran, Maksym Orliansky, Taras Zelenyy, Markiian Leshchyshyn

Published 2026-02-06
📖 4 min read☕ Coffee break read

Original authors: Oleg Grynets, Vasyl Lyashkevych, Dmytro Baran, Maksym Orliansky, Taras Zelenyy, Markiian Leshchyshyn

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a massive library of instruction manuals written in an old, complex language (Oracle SQL). Your company wants to switch to a new, modern language (PostgreSQL) to save money and run faster. The problem? The old manuals are huge, full of thousands of files, and the two languages don't just have different words; they have completely different grammar, logic, and rules.

This paper describes a smart, automated system built by researchers at EPAM Systems to translate these old manuals into the new language without breaking anything. Here is how they did it, explained simply:

1. The Problem: It's Not Just a "Find and Replace"

You can't just use a simple dictionary to translate this because the "sentences" in the old system (Oracle) often mean something totally different in the new system (PostgreSQL). Traditional tools (like a standard translator app) try to follow strict rules, but they often get stuck on complex stories, missing huge chunks of the manual or writing nonsense.

2. The Solution: A "Super-Translator" Robot

The team built a custom AI robot (a Large Language Model) and taught it specifically for this job. They didn't just ask it to "translate"; they trained it using a special two-step method:

  • Step 1: Learning the Rules (The Classroom): First, they taught the AI to understand the grammar and structure of both languages separately. They gave it examples of how a specific Oracle command looks and how it should be described in plain English. This helped the AI understand the "vibe" and structure of the code before trying to translate it.
  • Step 2: Learning to Translate (The Practice): Once the AI understood the rules, they gave it direct pairs: "Here is an Oracle sentence, here is the correct PostgreSQL sentence." This is where it learned the actual conversion.

3. The "Human-in-the-Loop" Safety Net

Even smart robots make mistakes. So, the system has a built-in quality control team:

  • The Auto-Checker: The system automatically scans the new code for grammar errors (syntax) and logic errors.
  • The Expert Reviewers: When the system finds something it's unsure about (like a very rare or complex instruction), it flags it for a human expert. The expert fixes it, and the system learns from that correction to do better next time. It's like a student getting a grade and a comment, then studying that specific topic before the next test.

4. The "Cheat Sheet" (RAG)

Sometimes, the AI needs to look up specific rules while it's working. The researchers built two types of "cheat sheets" (Knowledge Bases):

  • Strategy A (The Encyclopedia): The AI can look up the original code, the new language's official rules, and expert-written translation guides all at once.
  • Strategy B (The Example Book): The AI just looks at a book of "Before and After" examples to guess the best translation.
    They found that having the "Encyclopedia" (Strategy A) helped the AI understand context better, especially for tricky parts.

5. The "Gap Meter" (Knowing What to Study)

One of the coolest parts of their system is how it knows what to study next. After every round of translation, the system calculates a "Gap Score" for different types of code:

  • "We are great at translating basic math commands."
  • "But we are terrible at translating backup scripts."
    The system uses this score to tell the human team: "Don't waste time studying math; go find us 50 more examples of backup scripts." This ensures the AI gets better exactly where it is weakest, rather than just guessing.

6. The Results: A Massive Time Saver

When they tested their new AI system against the old, rule-based tools:

  • Accuracy: The AI made far fewer mistakes and translated much more of the code correctly.
  • Completeness: The old tools often gave up on complex sentences, leaving them blank. The AI tried to translate them and usually succeeded.
  • Money & Time: The researchers calculated that for a project with 100,000 files, their AI could successfully translate about 27,000 more files than the old tool.
    • The Analogy: If a human expert can translate 150 files a day, the old tool would leave a pile of work that takes a human 9 months to finish manually. The AI did that work automatically in a fraction of the time.

Summary

The paper proves that by combining a smart AI, a two-step training method, human experts for tricky cases, and a system that constantly figures out what it needs to learn next, you can migrate huge, complex computer systems from one language to another much faster, cheaper, and more accurately than ever before. It turns a nightmare of manual rewriting into a manageable, automated process.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →