Could UML help in AI-assisted coding?

Going through selected studies to explore possible way of writing code with UML and AI

This article was written in October 2026, and can become outdated

Could UML help in AI-assisted coding?

Artifical Intelligence (AI) is changing software engineering and how engineers adapt to the new approach to writing software (Sauvola et al., 2024). Modern Large Language Models (LLM) accept both text and image inputs (OpenAI, 2026), so engineers can supply Unified Modeling Language (UML) diagrams as an image or as text.

Different approaches are taken to make best use of the new technology, without losing touch with the craft and the necessary skills to provide added value to an application. During the adaptation there are possible risks of losing architectural control or unpredictable problems causing lower quality of a produced software due to reduced oversight (Sauvola et al. 2024). Although AI-generated is comparable to humans in readability (based on highest rated output, like Claude 4.6 on LeetCode tasks), it suffers from excessive complexity, unknown API usage, and redundant comments (Ye et al., 2026).

The following article explores possible way of modifying of software through UML and AI, by going through selected studies. Current shift in the software engineering field - followed by modelling languages, together can connect different approaches and control over direction of a architecture might be kept.

Text to diagram

There are many studies on using LLMs with UML. AI goes from partial or full generation of diagrams based on natural language, extraction of model elements, reverse engineering from code, conversion to artifacts, to quality checks of diagram, support, documentation, and feedback. Text as input for LLM is being used for most of the studies, whereas images are in the minority (Rahmanian et al., 2026).

Across the 64 studies, UML class diagrams are the most frequent type (44%). Thirty studies address diagram generation (27 complete, 3 partial), and 12 address extraction from images or source code, or conversion to other formats.

Such a topic raises the possibility of creating a round-trip engineering of human-assisted code-diagram generation in real-world scenarios. This possibility is even more relevant because another study shows that current research heavily focuses on model generation (62 out of 86 papers; Zhang et al., 2026). Model completion, validation, and transformation are covered in 33 (a paper may address several tasks). Lastly, code generation is largely neglected: only 5 of the 86 papers address it. The reviews shows that this topic is not a dead end.

The following studies show what this research covers. One of the studies compared sequence diagram generation using a rule-based approach (Stanford CoreNLP) and an LLM (ChatGPT 3.5, zero-shot) on 100 user stories. ChatGPT received highest ratings, but CoreNLP produced simpler result in this case (Jahan et al., 2024). Additionally, OpenAI’s model added elements that the user stories never mentioned.

For a class diagram extraction and a code generation from specifications, in comparison to natural language processing (NLP), language models fine-tuned with supervised learning, and a prompt-guided generation with use of multiple LLMs, the multi-LLM approach achieved best results. (Babaalla et al., 2026). Unfortunately, AI can generate incomplete models, but this can be countered by deploying an agent that asks a human expert contrastive questions. (Silva et al., 2025).

A diagram can then be modified, visualised or refined. Once a logical model, a Platform Independent Model (PIM), is completed, it enables forward engineering with computer-aided software engineering (CASE) tools or artificial intelligence. Both platform specific models (PSM) and a source code can be generated (Visual Paradigm, 2026).

Existing code steps in

Based on the previous section, UML models can be used to generate diagrams (forward engineering), and then source code (through LLM or old-style code generators). What about reverse engineering from existing code?

We have seen that there are some possible limitations when we’re using textual requirements or single-shot prompts. A fine-tuned LLM that converted tokenized code to a JSON representing of Java code elements, and post-processed to be ingested by Graphviz tool, achieved 99.3% accuracy and consistency of diagrams (Siala and Lano, 2025). Such a pipeline could not only output a JSON, but it could also be PlantUML or Mermaid (Rahmanian et al., 2026).

Going further, when we have diagrams, these even in a form of image can be converted to source code - with diagram manipulation in the middle (modifying JSON, PlantUML, or Mermaid code). Another study used an image of a UML class diagram and a prompt to generate source code. But there is a catch: whereas simpler cases produced full source code, more complex one lost some of elements (Antal et al., 2024).

Even further

The full flow from refactoring legacy Java code was completed in academic setting using multi agent pipeline using a conceptual model with text requirements. (Calamo et al., 2026). Single-prompt textual requirements create code that often needs architectural changes, enforce additional cognitive effort, or further refactoring.

Putting a UML class diagram in the middle open up the possibility to modifying and validating of a future source code. Code Refactor provides additional input context and could broaden understanding of implemented logic for humans. Of course, such workflows can be implemented in practice, but they should not be rushed.

As October 2026, studies rarely covers full refactoring flow of code->UML->changes->refactored code, or even requirements->UML->changes->new code. Different studies address different parts of these processes, but a working end-to-end approach seems feasible, because the studies provide promising insights.