← Latest papers
💻 computer science

LegacyTranslate: LLM-based Multi-Agent Method for Legacy Code Translation

This paper introduces LegacyTranslate, a multi-agent framework that leverages specialized LLMs for initial translation, API grounding, and iterative refinement to successfully modernize 2.5 million lines of PL/SQL to Java with significantly improved compilation and test-pass rates in a financial enterprise setting.

Original authors: Zahra Moti, Heydar Soudani, Jonck van der Kogel

Published 2026-03-17
📖 4 min read☕ Coffee break read

Original authors: Zahra Moti, Heydar Soudani, Jonck van der Kogel

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 are the head of a massive, ancient library. Inside, millions of books are written in a forgotten, complex language called PL/SQL. These books contain the secret recipes for how a giant bank runs its daily business.

The problem? The library is crumbling, the librarians who speak that old language are retiring, and the new building they are moving into only accepts books written in Java.

You could try to hire a super-smart robot (an LLM) to read the old books and rewrite them in the new language. But here's the catch: The new building has very strict rules. Every book must fit into specific shelves, use specific stamps, and follow a rigid filing system. If the robot just guesses, it might write a book that looks like English (or Java) but doesn't fit the shelves, so the new building rejects it immediately.

This is the problem LegacyTranslate solves. Instead of relying on one robot to do the whole job, the authors created a team of three specialized robots that work together like a high-end translation agency.

The Three-Robot Team

1. The First Draft Robot (Initial Translation Agent)

  • What it does: This robot reads the old PL/SQL book and writes a first draft in Java.
  • How it works: It doesn't just guess. It looks at a "cheat sheet" of 3 similar old books that have already been successfully translated. It says, "Oh, this old sentence looks like that one I saw before, so I'll write the new sentence like that."
  • The result: It produces a draft that looks good, but it's often missing the specific "stamps" and "shelf labels" required by the new building. It's like writing a letter in perfect English but forgetting to put the correct return address on the envelope.

2. The Rulebook Specialist (API Grounding Agent)

  • What it does: This robot is the building inspector. It knows the new building's strict rules (the APIs and shared libraries).
  • How it works: When the First Draft Robot sends over its work, this specialist checks the new building's "Rulebook." It says, "Hey, you used a generic stamp, but this specific section of the bank requires a Gold Star stamp. Also, you need to use the Internal Filing System API, not the public one." It pulls the exact instructions from the company's database.
  • The result: It gives the First Draft Robot a list of the specific tools and rules needed to fix the mistakes.

3. The Editor (Refinement Agent)

  • What it does: This robot is the tireless editor who keeps fixing the book until it's perfect.
  • How it works: It takes the draft, adds the specific stamps and rules from the Rulebook Specialist, and tries to "compile" the book (put it on the shelf). If the shelf rejects it (an error), the robot reads the rejection note, fixes the specific line, and tries again. It loops through this process until the book fits perfectly and passes all the quality checks.

Why This Matters

The paper tested this team on 2.5 million lines of code at a real financial institution. Here is what they found:

  • The "Lone Robot" Approach: If you just ask one smart robot to do the whole job without help, it produces code that looks nice but never works in the real system. It's like writing a beautiful poem that doesn't rhyme with the rest of the song.
  • The Team Approach: By using the three-step team, they managed to get 53% of the code to compile and work correctly.
    • The First Draft Robot got it to 45% working.
    • Adding the Rulebook Specialist and the Editor pushed it up to 53%.

The Big Takeaway

The most important lesson from this paper is that context is king.

In the past, people thought AI could just translate code like it translates French to Spanish. But in the real world, code is like a puzzle piece. It doesn't matter if the piece looks right; if it doesn't fit the specific hole in your company's unique puzzle, it's useless.

LegacyTranslate proves that to modernize old systems, you can't just rely on a "smart" AI. You need a system that:

  1. Learns from past examples.
  2. Consults the specific rulebook of the new system.
  3. Iteratively fixes errors until it fits.

It's the difference between asking a tourist to translate a menu (they might get the words right but miss the cultural context) and hiring a local chef who knows exactly how to adapt the recipe for your specific kitchen.

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 →