From Use Cases to Sequence Diagrams: Schema-Constrained Generation with Large Language Models
Abstract
Sequence diagrams are widely used to model interactions among system components and external actors by explicitly describing how operations are executed over time. However, constructing sequence diagrams manually is tedious and time-consuming in practice, and their automated generation remains largely unresolved. In this work, we study LLM-based sequence diagram generation from use cases. We first construct a high-quality dataset of industrial-scale use cases paired with corresponding sequence diagrams, supporting reproducible and extensible future research. We then investigate structured generation under schema constraints using both workflow and chainof-thought (CoT) prompting strategies, enabling the generation of complex sequence diagrams with nested combined fragments. In addition, we propose an evaluation framework that measures not only the correctness of sequential messages but also the structural validity of nested control structures. Experimental results demonstrate that schema constraints together with CoT/workflow guidance substantially improve generation quality over a basic LLM-only approach.