Creating UML Class Diagrams with General-Purpose LLMs
Mina Shehata, Blaire Lepore, Hailey Cummings, Esteban Parra · 2024
General-purpose large language models (LLMs) have become a versatile tool in software development and maintenance. These models offer support in tasks such as under-standing, writing, and summarizing code. While these LLMs can generate code quickly their use in software modeling is relatively under-explored. This research aims to study ChatGPT's ability to generate class diagrams from source code. To do this, we engineered a prompt that takes in source code to create a UML class diagram for that system. We used this prompt to create class diagrams for 40 systems and assessed the diagrams on their correctness and structure. Our results show that ChatGPT creates class diagrams that accurately capture 90% of the classes and their attributes and 66 % of the associations. While ChatGPT performed nearly flawlessly for smaller projects, the diagrams for larger projects had more issues. We conclude that ChatGPT is best utilized as a complementary tool rather than the sole resource for software modeling and maintenance.