NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

From image to UML: First results of image-based UML diagram generation using LLMs

Aaron David Conrardy, Jordi Cabot

Abstract

This study evaluates the performance of four Vision-Language Models (VLMs)—GPT-4V, Gemini Pro, Gemini Ultra, and CogVLM—in converting hand-drawn UML class diagrams into machine-readable PlantUML code. Through an empirical experiment using diagrams of increasing complexity, the researchers found that GPT-4V significantly outperforms its peers, maintaining a 0% syntax error rate. However, the study also reveals a "prompting paradox" where simpler instructions often yield better results, and highlights how internal semantic filters in models like Gemini can impede the processing of abstract or unconventional diagrams.

Introduction

In software engineering, the initial design phase often takes place on whiteboards or paper. While these sketches are excellent for human collaboration, they are inherently informal and cannot be directly utilized by automated tools for code generation, model-based testing, or documentation. Transcribing these drawings into Computer-Aided Software Engineering (CASE) tools is a tedious process that often leads to a "formality gap," where valuable design insights are lost or relegated to static image files. This paper explores the potential of modern multimodal Large Language Models (LLMs) to bridge this gap by automating the transcription of photos into functional, computer-readable models.

Methodology and Experimental Setup

The researchers conducted an empirical experiment comparing four prominent visual LLMs: GPT-4V, Gemini Pro, Gemini Ultra, and the open-source CogVLM. The study utilized a controlled set of four hand-drawn UML diagrams of increasing complexity:

  • Level 1: Basic classes and inheritance (e.g., Animals, Ducks, Fish).
  • Level 2: Addition of attributes, methods, and visibility modifiers.
  • Level 3: Complex relationships, including associations, aggregations, and cardinalities.
  • Level 4: A "nonsensical" diagram (e.g., a Human inheriting from a Spaceship) designed to test if models are biased by real-world logic.
Visual comparison of hand-drawn UML sketches, expected solutions, and GPT-4V outputs across four levels of complexity.

The models were evaluated using three different prompting strategies, ranging from simple requests to highly detailed instructions. Each combination was run three times to account for non-determinism, measuring both "mistakes" (missing or hallucinated elements) and syntax errors.

Results and Performance Analysis

The experimental results identified GPT-4V as the current gold standard for this task. It was the only model to achieve a 0% syntax error rate across 36 generations, demonstrating significant robustness in following PlantUML notation. In contrast, Gemini Pro and Ultra failed to produce valid syntax in approximately 44% of attempts, while CogVLM failed in 55% of cases.

Syntax accuracy and code generation failure rates across the tested LLM models.

As diagram complexity increased, there was a steady rise in the number of mistakes across all models. While LLMs are proficient at identifying classes, they frequently struggle with the "fine print" of UML, such as distinguishing between specific arrow types for aggregation versus association.

Discussion: The Prompting Paradox and Semantic Guardrails

Two unexpected findings emerged from the study. First, the "Prompting Paradox" revealed that the least descriptive prompts often yielded the best results. Overly detailed instructions appeared to confuse the models' visual processing or lead to over-complication of the output.

Second, the researchers encountered a "Semantic Guardrail" problem with the Gemini models. These models often refused to process the Level 4 diagram because the content was nonsensical (e.g., dogs and spaceships). By deeming the content "not relevant to UML," the models' internal filters effectively hindered abstract modeling tasks. This suggests that safety or relevance filters in some LLMs may inadvertently limit their utility in creative or unconventional engineering contexts.

Conclusion and Future Work

While VLMs show great promise in accelerating "low-modeling" workflows, they are not yet "set and forget" tools. Human oversight remains essential to correct subtle errors in relationships and cardinalities. Future research will focus on integrating "LLM-as-judge" systems for self-correction, expanding support to other diagram types like State Machines and Sequence Diagrams, and conducting user studies with professional engineers to assess real-world productivity gains.

Summary updated

BibTeX
@inproceedings{conrardy2024from,
  author = {Aaron David Conrardy and Jordi Cabot},
  title = {{From image to UML: First results of image-based UML diagram generation using LLMs}},
  booktitle = {STAF Workshops},
  year = {2024},
  url = {https://openreview.net/forum?id=Gm363xiEn9},
}
Figure