arXiv:2506.00788cs.SEcs.AI2025-06被引 11

用大模型从需求自动生成类图方法,提升软件设计效率

Behavioral Augmentation of UML Class Diagrams: An Empirical Study of Large Language Models for Method Generation

  • 九个大模型基于自然语言用例生成类图行为方法
  • 生成3373个方法,部分模型在参数丰富度和标注准确率上表现优
  • 适合敏捷开发人员快速迭代设计,需人工校验结果

自动化将自然语言用例中的行为方法填充到无方法的UML类图中是一项重大挑战。本研究评估了九个大语言模型(LLMs)在21个类、17个关系的类图上,基于21个结构化废物管理用例进行增强的效果。共生成90个图表(含3373个方法),通过六项指标评估:方法数量、签名丰富度(可见性、名称、参数、返回类型)、注释完整性(与用例/动作关联)、结构保真度、语法正确性(PlantUML编译通过)及命名一致性(跨模型)。所有模型均生成符合UML规范的合法PlantUML图。部分模型在方法覆盖率和注释准确性方面表现突出,另一些则在参数化丰富度上更优但可追溯性较弱。结果表明,大模型能生成结构良好、命名一致的方法,推动行为建模自动化。然而注释与签名不一致的问题凸显了改进提示工程与模型选择的必要性。快速生成支持敏捷实践,实现更快的设计迭代。尽管能力强大,仍需人工监督以确保准确性、合理性与语义对齐。大模型在此扮演协作角色。所有实验数据(.puml, .png, .csv)公开可复现。

原文摘要 · Abstract (English)

Automating the enrichment of UML class diagrams with behavioral methods from natural language use cases is a significant challenge. This study evaluates nine large language models (LLMs) in augmenting a methodless UML diagram (21 classes, 17 relationships) using 21 structured waste-management use cases. A total of 90 diagrams (3,373 methods) were assessed across six metrics: method quantity, signature richness (visibility, names, parameters, return types), annotation completeness (linking to use cases/actions), structural fidelity, syntactic correctness (PlantUML compilation), and naming convergence (across models). All LLMs produced valid PlantUML diagrams adhering to UML conventions. Some models excelled in method coverage and annotation accuracy, while others showed richer parameterization but weaker traceability. These results demonstrate that LLMs can generate well-structured methods with consistent naming, advancing automated behavioral modeling. However, inconsistencies in annotations and signatures highlight the need for improved prompt engineering and model selection. The rapid generation of these methods supports Agile practices by enabling faster design iterations. Despite their capabilities, human oversight is essential to ensure accuracy, appropriateness, and semantic alignment. This positions LLMs as collaborative partners in software design. All experimental artifacts (\texttt{.puml}, \texttt{.png}, \texttt{.csv}) are publicly available for reproducibility.

大模型代码生成UML敏捷开发

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。