LLM code translation can pass tests and still hand you software nobody chose. In an experiment, the same model translated the same RPG application into Java three times and produced three different designs. One run came out at 14,500 lines of Java and another at 26,300, and on ordinary inputs they mostly behaved alike.
The question matters because the people who maintain the code for the next 15 to 20 years inherit every decision the model made silently. Many Java programs can match an RPG original, and they differ in how concise, idiomatic, fast or maintainable they are.
The three experiments behind the finding
The team ran three setups. In the first, five programs from a large application were translated three times, each run independent of the others. In the second, a whole small application was translated three times. In the third, one large application of more than half a million lines was translated once, to see whether similar programs inside it come out alike.
No run received another run’s output. That isolation is what makes the differences meaningful: the model was given the same job each time and left free to decide how to do it. The team also had no running IBM i, so claims about the original’s behavior come from reading the RPG source.

How similar were the three translations?
The team measured the three translations of the smaller application, program by program. They read and wrote the same files in the same order using the same fields. Less than half of their Java was the same.
All runs used Claude Code with Opus 5.5 and the prompt “organize the project as you see fit”. The agent ran headless, so it couldn’t stop to ask a client anything.
Where the designs split
The folder trees alone differ. One run keeps CL programs separate and splits its runtime into database, job and RPG packages. Another adds generated record classes under db/record. The third puts record formats under db/fmt and field objects in the runtime.
The deeper splits involve machinery:
- File definitions: one run parses the DDS source while the application runs, while the other two generate Java or a compact schema beforehand.
- Field types: one stores values in named slots, one uses plain Java ints and strings, and one uses field objects carrying width and decimal information.
- Where record handling lives, and who commits a transaction.
None of these is forced by RPG. A client might want definitions supplied at runtime, or Java classes developers can navigate. Nobody asked.
One variable, three behaviors
The field-type choice changes behavior. A program counts open orders in a three-digit field. With 999 orders, all three translations act the same. With 1,000, the first stops with an overflow error, the second writes a supply row with quantity 1000, and the third silently turns the count into 0 and writes no row.
A run-hours calculation showed the same thing. With a quantity of 40,000 and an intermediate four-digit field, the three versions returned an overflow error, 66.73 hours and 0.07 hours. In another overflow case, the answers were an error, 7325.33 and 658.67. Judging by the RPG, stopping with an error is correct, because the inputs are valid and only the intermediate total overflows.
There were successes. In a division-and-remainder calculation, every run kept the truncation of the remainder into a field without decimals and reproduced the specified rounding. So no run simply understood RPG or failed to. Wrapping fields in objects doesn’t guarantee correct behavior, since width, overflow and rounding rules still have to be implemented somewhere.
The same choices in every run
Some decisions repeated across all runs, and they weren’t the ones the team would have made: no application framework such as Spring Boot, a hand-built runtime, and CSV files or H2 instead of a database like PostgreSQL.
What to do before translating
The takeaway for teams is practical. Write down target framework, database, field representation, transaction ownership and error handling before any run, and give them to the model as instructions. Otherwise you get an architecture by accident, and a second run can produce a different one, which makes translating a part again risky for how it fits with the rest.
Source: Federico Tomassetti