Generating C4 Diagrams with LLMs: An Overview and Future Directions
C4 diagrams provide a structured method for visualising complex software architectures by breaking down systems into containers, components, and contexts. Manually creating these diagrams can be time-consuming, but advancements in natural language processing (NLP) offer a path to automate this task.
Building on the concepts in the recent paper DiagrammerGPT, this article discusses an LLM-based solution that uses PlantUML and PlantUML C4 to generate C4 diagrams from textual descriptions.
System Overview
My solution leverages Google Gemma7B Large Language Model (LLM) for the tasks of designing and auditing.
The design and audit task are executed in a loop creating and iterative process that allows to refine entities and their relationships, and ultimately providing a diagram layout that accurately represents of the received caption — the description of the diagram to generate.
The generated design is then automatically converted to its PlantUML representation.
Designer
The designer is responsible for creating the diagram layout describing entities and relationships in a form that is tractable by the LLM. For this reason during the generation process entities and relationships are separated into clearly defined groups.
Inside each group, entities and relationships are defined using PlantUML and PlantUML C4…