Code2UML: Agentic LLMs with context engineering for scalable software visualization
Alin-Gabriel V\u{a}duva, Anca-Ioana Andreescu, Simona-Vasilica Oprea, Adela B\^ara
Why It Matters
What makes this one worth your time
This work addresses the challenge of scaling LLM-based code analysis to large codebases, which is crucial for automating software documentation and improving developer productivity.
Code2UML uses agentic LLMs and context engineering for scalable UML diagram generation from large codebases.
Summary
The paper presents Code2UML, an agentic architecture leveraging context engineering to generate UML diagrams from large codebases. It introduces a hierarchy of five specialized agents to handle different cognitive tasks and a deterministic IR compaction layer to fit project representations within token limits. The system is evaluated on 12 open-source repositories across multiple languages and UML diagram types, showing high syntactic validity and relationship precision, though with limited entity recall.
Key contributions
- Introduction of an agentic architecture with context engineering for UML diagram generation.
- Development of a deterministic IR compaction layer to manage large codebases within LLM token limits.
- Evaluation across multiple programming languages and UML diagram types demonstrating high syntactic validity and relationship precision.
Notable insights
- The use of a deterministic, importance-weighted IR compaction layer to fit project representations within token constraints is a clever approach to handle large codebases.
- The hierarchical agent architecture allows for specialized handling of distinct cognitive subtasks, potentially improving the efficiency and accuracy of UML diagram generation.
Possible limitations
- Entity recall is relatively low, indicating a trade-off between architectural prioritization and exhaustive coverage.
- Not stated in the abstract
Abstract
arXiv:2605.24453v1 Announce Type: cross Abstract: Large Language Model (LLM)-based code analysis tools are adopted to automate software documentation tasks. However, the scalability of these approaches to real codebases, where Intermediate Representations (IR) exceed LLM context limits, remains underexplored. This paper introduces an agentic architecture with context engineering for automated UML diagram generation from source code repositories. It employs a hierarchy of five specialized agents: PlannerAgent, AnalyzerAgent, DiagramAgent, CorrectorAgent and DependencyAnalyzerAgent, built on the Claude Agent SDK, each addressing a distinct cognitive subtask. A deterministic, importance-weighted IR compaction layer transforms full project IRs into diagram-specific views guaranteed to fit within token constraints, requiring no LLM calls and completing in milliseconds. Thus, we evaluate the system across 12 open-source repositories in 4 programming languages (Java, JavaScript, PHP, Python) and 7 UML diagram types, producing 84 observations assessed on 5 automated metrics. Results demonstrate high syntactic validity (mean: 91.5%, with component and deployment diagrams reaching 100%), strong relationship precision (mean: 0.858) and consistent structural quality (mean: 81.7/100, with cross-language variance of 3.1 points). Entity recall averaged 0.313, reflecting deliberate architectural prioritization over exhaustive coverage. A sensitivity analysis (31 to 4,578 IR entities) confirms that quality scores remain stable regardless of scale.