How LLMs Aid in UML Modeling: An Exploratory Study with Novice Analysts

Beian Wang, Chong Wang, Peng Liang, Bing Li, Cheng Zeng

TL;DR

This paper investigates how Large Language Models (LLMs) like ChatGPT can assist novice software engineers in creating UML models (use case, class, and sequence diagrams). While LLMs show promise in identifying core modeling elements, they struggle with complex relationships, and the output format significantly impacts their effectiveness, with hybrid approaches yielding the best results.

What Problem Does This Paper Address?

Requirements engineering (RE) is a critical but often time-consuming phase in software development, involving the creation of models to represent system requirements. Unified Modeling Language (UML) is a standard graphical notation for this purpose. While LLMs have demonstrated impressive capabilities in natural language processing and code generation, their effectiveness in assisting with the creation of graphical UML models, especially for novice analysts, has been underexplored. This paper aims to fill this gap by evaluating how LLMs can aid students in generating use case, class, and sequence diagrams, identifying both their strengths and limitations.

Methods

The researchers designed an experiment involving 45 undergraduate students in a software requirements analysis and modeling course. Participants were tasked with creating three types of UML models (use case, class, and sequence diagrams) for a given case study, with the explicit instruction to use LLMs (primarily ChatGPT) for assistance. The experiment involved two phases:

  1. Setting up modeling tasks: Students were assigned the case study and instructed to use LLMs. They submitted their project reports, which included the generated UML models and a history of their interactions with the LLM.
  2. Evaluating modeling results: The collected reports were analyzed. Data items extracted included participant background, the LLM used, prompt language, and the output format of the UML models. The UML models themselves were evaluated based on predefined criteria for each diagram type, with scores assigned and correctness rates calculated. The impact of different output formats (simple wireframe, PlantUML-based, and hybrid-created) on model quality was also assessed.

Datasets

The study did not use pre-existing datasets for training LLMs. Instead, it utilized a case study ("Order Processing System") for the students to model. The primary "dataset" for evaluation consisted of the 45 project reports submitted by the undergraduate students, which contained their LLM-assisted UML models and interaction logs.

Key Insights and Ideas

  • LLMs excel at identifying core elements, but struggle with relationships: LLMs are generally good at recognizing individual components like actors, use cases, classes, objects, and attributes. However, they often falter when it comes to accurately identifying and representing the relationships between these elements (e.g., generalization, association, inheritance).
  • Sequence diagrams are LLM's strong suit: LLMs performed best in generating sequence diagrams. This is attributed to sequence diagrams having fewer complex relationship elements and relying more on directly extractable object-type interactions.
  • Output format matters significantly: The way the LLM's output is presented has a substantial impact on the quality of the final UML model. "Hybrid-created" diagrams, where students used LLM output as a basis and then refined it using specific UML tools (like StarUML), yielded the highest quality models.
  • Novice analysts benefit, but LLMs are not a silver bullet: LLMs can serve as valuable auxiliary tools for novice analysts, providing suggestions and aiding in the initial stages. However, they are not yet reliable enough to replace human expertise entirely, and students must be aware of their limitations to avoid errors.
  • Human-LLM interaction language can vary: Participants used both English and Chinese in their interactions with LLMs, highlighting the global applicability of these tools.

Key Results

  • Use Case Diagrams: LLMs achieved 100% correctness in identifying relationships between actors and use cases (UC4) and 88.89% for identifying use cases (UC2). However, identifying actors (UC1) and relationships among actors (UC3) were challenging, with correctness rates of 31.11% and 17.78%, respectively. The average score for use case models was 59.44%.
  • Class Diagrams: LLMs showed good performance in identifying classes (66.67%), operations (75.56%), and attributes (91.11%). The weakest area was the accurate recognition of relationships among classes (24.44%). The average score for class diagrams was 64.44%.
  • Sequence Diagrams: LLMs performed well in identifying objects (73.33%) and messages (68.89%), with the order of messages also being reasonably accurate (82.22%). The average score for sequence diagrams was 74.81%.
  • Output Format Impact: Hybrid-created diagrams achieved the highest average score (8.20), followed by PlantUML-based diagrams (6.94), and simple wireframes (5.50). This indicates that human refinement of LLM output is crucial for optimal results.

Limitations and Future Work

Limitations: * Participant Experience: The study involved novice analysts (undergraduate students), so the findings might not directly apply to experienced industry professionals. Individual differences in skill and attitude among students could also influence results. * Manual Evaluation: The scoring of modeling results was done manually by the authors, introducing potential subjectivity and bias. The binary scoring (0 or 1) for criteria might not fully capture the nuances of correctness. * LLM Output Uncertainty: LLMs exhibit inherent randomness, meaning identical inputs can produce different outputs, making performance difficult to control precisely.

Future Work: * Refined Scoring: Develop more continuous scoring methods to better assess model correctness. * Larger Sample Size: Increase the number of participants to enhance the credibility of the findings. * Broader Scope: Extend the study to other UML diagram types (e.g., activity, state diagrams) and explore LLMs beyond ChatGPT (e.g., ERNIE Bot, Qwen). * Controlled Experiments: Conduct comparative studies with and without LLM assistance to quantify its impact on model quality. * Educator and Professional Guidance: Further explore how LLMs can be integrated into software engineering education and professional practice, emphasizing balanced usage and critical evaluation of LLM outputs.

Summary updated

BibTeX
@inproceedings{wang2024how,
  author = {Beian Wang and Chong Wang and Peng Liang and Bing Li and Cheng Zeng},
  title = {{How LLMs Aid in UML Modeling: An Exploratory Study with Novice Analysts}},
  booktitle = {SSE},
  year = {2024},
  doi = {10.1109/sse62657.2024.00046},
}
Figure