← Latest papers
🤖 AI

Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolution

This paper proposes a specification-based Code2Text2Code reengineering framework that mitigates semantic drift and behavioral inconsistencies in LLM-mediated software evolution by transforming source code into a neutral textual specification for iterative verification before regenerating the target code.

Original authors: Oleg Grynets, Vasyl Lyashkevych, Arsen Dolichnyi, Roman Piznak, Taras Zelenyy, Volodymyr Morozov

Published 2026-05-26
📖 5 min read🧠 Deep dive

Original authors: Oleg Grynets, Vasyl Lyashkevych, Arsen Dolichnyi, Roman Piznak, Taras Zelenyy, Volodymyr Morozov

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 trying to translate a complex, handwritten recipe from a grandparent's kitchen in 1950s Ukraine into a modern, digital recipe app for a smart oven in 2024.

If you just ask a translator (an AI) to "turn this old recipe into a new one," they might get the words right but mess up the cooking. They might keep using a "wooden spoon" instruction when the new oven needs a "digital sensor," or they might accidentally add a "secret ingredient" that wasn't in the original. The result looks like a recipe, but it might burn your cake.

This paper proposes a smarter way to do this translation, not just for recipes, but for computer software. They call it Code–Text–Code Reengineering.

Here is how it works, broken down into simple steps:

1. The Problem: The "Direct Translation" Trap

Usually, when people use AI to change software from one language to another (like moving from Python to Java), they do a Code-to-Code translation.

  • The Risk: The AI might copy the style of the old code instead of the meaning. It's like translating a poem word-for-word and losing the emotion. The new code might look correct but behave differently, or it might miss hidden rules that the old code relied on.

2. The Solution: The "Neutral Translator" (The Middleman)

Instead of jumping straight from Old Code to New Code, the authors insert a middle step: The Neutral Text Specification.

Think of this as a detailed, plain-English blueprint that describes what the software does, without mentioning how it was built in the old language.

  • Step 1 (Code to Text): The AI reads the old code and writes a neutral description. It says things like, "This function takes a list of numbers, adds them up, and saves the result to a database." It ignores the specific programming tricks used in the old code.
  • Step 2 (The Check): Humans or other tools check this description to make sure it matches the original perfectly. Did we miss a step? Did we invent a new one?
  • Step 3 (Text to Code): The AI reads this clean, neutral description and writes the new code in the target language. Because the AI isn't looking at the old code anymore, it doesn't accidentally copy the old style. It builds the new code exactly as the blueprint describes.

3. The "Safety Net" Tools

The paper explains that this isn't just about writing text; it's about building a safety system around the process:

  • The "Fact-Checker" (Retrieval): Before the AI writes anything, it looks up facts in a library of documents, diagrams, and code snippets to make sure it's not guessing. It's like a chef checking a cookbook before adding salt.
  • The "Chunking" Strategy: You can't read a whole library of books in one bite. The system breaks the code into small, logical "chunks" (like chapters) so the AI doesn't get confused or miss connections.
  • The "Blueprint" (Graphs & Ontology): The system builds a map (a graph) showing how different parts of the software connect. If the old software had a bridge between two islands, the new software must have that same bridge. This map helps measure if the translation was successful.

4. Measuring Success: Did We Lose Anything?

How do you know the new software is the same as the old one? The authors created a "Loss Calculator."
Imagine you are moving furniture from an old house to a new one.

  • Structural Preservation: Did you move all the rooms? (Yes/No)
  • Interface Stability: Can you still open the front door the same way? (Yes/No)
  • Total Similarity: A score that tells you how much of the original "house" survived the move.

5. What They Found

The researchers tested this method on many different types of code (SQL databases, web scripts, general programming).

  • The Result: Using the "Neutral Text" middleman worked better than trying to translate code directly. It reduced errors and made the new code behave more like the original intent.
  • The Catch: Sometimes, the AI needs a human to step in and clarify a confusing part of the old code. It's not fully automatic yet; it's a "human-in-the-loop" process.

The Big Picture

This paper argues that we shouldn't treat software updates as a simple "copy-paste" job. Instead, we should treat it as re-engineering.

  • Old Way: "Here is the old code; give me the new code." (Risky, opaque).
  • New Way: "Here is the old code. First, explain what it does in plain English. Check that explanation. Then, build the new code based on that explanation." (Safe, transparent, and controllable).

In short, they are teaching AI to stop translating words and start translating meaning, using a clear, neutral blueprint to ensure nothing gets lost in the shuffle.

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 →