CDGen: A TXT-CD dataset synthesizer
Abstract
# CDGen: LLM-Enhanced Stochastic Generation of Class Diagram Datasets Large language models (LLMs) excel at code-centric tasks, but their capabilities in software design and modeling remain limited, largely due to the scarcity of high-quality training corpora linking textual requirements with class diagrams. This artifact provides the complete implementation of **CDGen**, a neuro-symbolic pipeline introduced in the paper *"LLM-Enhanced Stochastic Generation of Class Diagram Datasets"* for synthesizing large-scale Text-Class Diagram (TXT-CD) datasets. CDGen combines a stochastic model generator (SMG) with LLMs and rule-based fixing to produce diverse, semantically meaningful class diagrams paired with natural language descriptions. The pipeline operates in five phases: (1) a stochastic generator produces syntactically correct class diagram skeletons with random identifiers; (2) an LLM grounds skeletons to business domains by replacing generic identifiers with domain-specific concepts; (3) LLM-driven holistic refinement and rule-based fine-grained refinement correct structural and semantic issues; (4) an LLM generates a corresponding system description for each refined diagram; (5) alignment validation filters valid description-diagram pairs. An optional augmentation step injects controlled noise into descriptions to mimic real-world inconsistencies. Using this pipeline, the paper constructed **CDSyn10K**, a dataset comprising 10,000 description-diagram pairs across 2,000 business domains. Evaluations demonstrate that CDSyn10K diagrams are highly diverse and comparable to expert-made artifacts. Fine-tuning Qwen3 models on CDSyn10K yields models (Qw-OOD-0.6B and Qw-OOD-8B) that significantly outperform their base counterparts on class diagram generation benchmarks.
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 12 July 2026