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.
Links:
- OpenAI ‘OpenAI Developers - Images and Vision’ https://developers.openai.com/api/docs/guides/images-vision?api-mode=responses.
- Sauvola, Jaakko, Sasu Tarkoma, Mika Klemettinen, Jukka Riekki, and David Doermann. ‘Future of Software Development with Generative AI’. Automated Software Engineering 31, no. 1 (2024): 26. https://doi.org/10.1007/s10515-024-00426-z.
- Ye, Hengzhi, Fengyuan Ran, Weiwei Xu, and Minghui Zhou. ‘Characterizing Readability Issue Patterns and the Role of Prompt Design in LLM-Generated Code’. arXiv:2605.13280. Preprint, arXiv, 3 August 2026. https://doi.org/10.48550/arXiv.2605.13280.
- Mojdeh Rahmanian, Ashkan Sami, and Yanchao Yu. ‘Large Language Models for Software Engineering Diagrams: A Systematic Review of UML and ER modelling’ https://arxiv.org/html/2607.26100v1.
- Zhang, Weixing, Bowen Jiang, Yuhong Fu, et al. ‘Large Language Models in Model-Driven Engineering: A Systematic Mapping Study’. Preprint, Karlsruher Institut für Technologie, 16 April 2026. https://doi.org/10.5281/zenodo.20064398.
- Silva, Jonathan, Qin Ma, and Pierre Kelsen. ‘Towards Human-in-the-Loop LLM-Enabled Domain Modeling’. (University of Luxembourg, Esch-sur-Alzette, Luxembourg), 19 October 2025. https://doi.org/10.1007/978-3-032-08623-5_7.
- Calamo, Marco, Massimo Mecella, and Monique Snoeck. ‘Is There a Future for Models in the LLM Era?’ arXiv:2609.35281. Preprint, arXiv, 28 September 2026. https://doi.org/10.48550/arXiv.2609.35281.
- Visual Paradigm ‘Architecting for Reuse: A Comprehensive Guide to Platform Independent Models (PIM) in Model Driven Architecture (MDA)’ https://www.visual-paradigm.com/guide/architecting-for-reuse-a-comprehensive-guide-to-platform-independent-models-pim-in-model-driven-architecture-mda/.
- Jahan, Munima, Mohammad Mahdi Hassan, Reza Golpayegani, et al. ‘Automated Derivation of UML Sequence Diagrams from User Stories: Unleashing the Power of Generative AI vs. a Rule-Based Approach’. Proceedings of the ACM/IEEE 27th International Conference on Model Driven Engineering Languages and Systems, 22 September 2024, 138–48. https://doi.org/10.1145/3640310.3674081.
- Babaalla, Zakaria, Hamza Abdelmalek, Abdeslam Jakimi, and Rachid Saadane. ‘From Rule-Based NLP to Prompt-Guided Multi-LLM Pipelines for Text-to-UML and Code Generation’. Engineering, Technology & Applied Science Research 16, no. 3 (2026): 35287–94. https://doi.org/10.48084/etasr.18049.
- Antal, Gábor, Richárd Vozár, and Rudolf Ferenc. ‘Assessing GPT-4-Vision’s Capabilities in UML-Based Code Generation’. arXiv:2404.14370. Preprint, arXiv, 22 April 2024. https://doi.org/10.48550/arXiv.2404.14370.
- Siala, Hanan Abdulwahab, and Kevin Lano. ‘Using Large Language Models to Extract UML Class Diagrams from Java Programs’. 2025 8th International Conference on Software and System Engineering (ICoSSE), 4 April 2025, 70–74. https://doi.org/10.1109/ICoSSE65712.2025.00020.