[论文解读] From Image to UML: First Results of Image Based UML Diagram Generation Using LLMs
本文评估了视觉大型语言模型(LLMs)将手绘或图像形式的UML类图转换为正式、机器可读的PlantUML代码的能力。使用GPT-4V及其他多模态LLM进行研究发现,尽管结果具有前景且可在模型驱动工程流程中使用,但性能因模型而异,且由于准确性和一致性方面的局限,仍需人工介入验证。
In software engineering processes, systems are first specified using a modeling language such as UML. These initial designs are often collaboratively created, many times in meetings where different domain experts use whiteboards, paper or other types of quick supports to create drawings and blueprints that then will need to be formalized. These proper, machine-readable, models are key to ensure models can be part of automated processes (e.g. input of a low-code generation pipeline, a model-based testing system, ...). But going from hand-drawn diagrams to actual models is a time-consuming process that sometimes ends up with such drawings just added as informal images to the software documentation, reducing their value a lot. To avoid this tedious task, we explore the usage of Large Language Models (LLM) to generate the formal representation of (UML) models from a given drawing. More specifically, we have evaluated the capabilities of different LLMs to convert images of UML class diagrams into the actual models represented in the images. While the results are good enough to use such an approach as part of a model-driven engineering pipeline we also highlight some of their current limitations and the need to keep the human in the loop to overcome those limitations.
研究动机与目标
- 调查视觉LLM是否能够准确地将UML类图图像转换为正式、机器可读的模型。
- 解决将非正式的手绘软件设计草图转换为结构化、可重用模型的挑战,以支持低代码和模型驱动工程流程。
- 评估使用LLM作为中间环节,从非正式草图到正式软件模型转换的可行性与局限性。
提出的方法
- 本研究使用10幅手绘UML类图作为输入图像进行评估。
- 多个视觉LLM(包括GPT-4V、Gemini Pro和CogVLM)被用于从相同图像生成PlantUML代码。
- 根据生成代码与原始图表在语义上的一致性,评估其正确性和完整性。
- 采用提示工程策略以提高输出的一致性并减少语法错误。
- 由于LLM的黑箱特性,结果通过定性分析进行解读。
- 实现了一个名为BESSER的原型工具,通过OpenAI API使用GPT-4V支持图像到UML的转换。

实验结果
研究问题
- RQ1视觉LLM能否从图像输入中准确且完整地重建UML类图?
- RQ2在从UML图图像生成PlantUML代码时,不同视觉LLM在正确性和完整性方面表现如何比较?
- RQ3提示工程在提高基于LLM的UML生成可靠性方面发挥什么作用?
- RQ4生成的模型在下游软件工程流程(如代码生成或模型验证)中可复用的程度如何?
- RQ5在该流程中,人工介入验证对确保模型质量有多重要?
主要发现
- 在所评估的LLM中,GPT-4V生成的PlantUML代码最准确且最完整,展现出在图像到UML转换方面的卓越性能。
- 其他模型如Gemini Pro和CogVLM在处理复杂图示元素时表现出较低的一致性和更高的错误率。
- 尽管整体结果良好,LLM仍表现出非确定性行为,即使对同一张输入图像和提示,输出也会有差异。
- 语法错误在各模型中普遍存在,但每种模型在重复测试中表现相对稳定。
- 本研究证实,尽管LLM可作为模型驱动工程流程中的有效转换器,但人工验证对确保正确性仍至关重要。
- BESSER平台成功集成了基于GPT-4V的图像到UML功能,实现了从图像到可执行模型的端到端转换。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。