Generating Software Architecture Description from Source Code using Reverse Engineering and Large Language Model

📅 2025-11-07
📈 Citations: 0
✨ Influential: 0
📄 PDF
🤖 AI Summary
Software architecture documentation (SAD) is frequently missing, outdated, or inconsistent with implementation, leading to high comprehension costs and maintenance challenges. To address this, we propose a semi-automated approach integrating reverse engineering with large language models (LLMs). Our method first extracts component structure via static analysis, then leverages prompt engineering and few-shot learning to guide LLMs in generating architectural artifacts—specifically, static views (component diagrams) and dynamic views (state machine diagrams). Crucially, it requires minimal expert annotation, substantially reducing manual effort while enabling scalable, abstraction-aware documentation. Evaluated on an industrial C++ system, our approach accurately reconstructs complex component structures and behavioral logic. Results demonstrate significant improvements in both the accuracy of generated architecture documentation and the efficiency of its maintenance, thereby enhancing system comprehensibility and long-term maintainability.

Technology Category

Cognitive Modeling & Cognitive Systems: Agent ArchitecturesMachine Learning: Large Multimodal Models (LMMs)Natural Language Processing: Code Generation / Program Synthesis from Natural Language

Application Category

Semantics and Knowledge: Data modeling to support human-machine intelligence, including LLMs agents, intelligent system behavior, explanations, and user-friendly interactionsSearch and Retrieval-Augmented AI: Large language models for searchEconomics, Online Markets and Human Computation: Cost models of using LLMs in production systems
📝 Abstract
Software Architecture Descriptions (SADs) are essential for managing the inherent complexity of modern software systems. They enable high-level architectural reasoning, guide design decisions, and facilitate effective communication among diverse stakeholders. However, in practice, SADs are often missing, outdated, or poorly aligned with the system's actual implementation. Consequently, developers are compelled to derive architectural insights directly from source code-a time-intensive process that increases cognitive load, slows new developer onboarding, and contributes to the gradual degradation of clarity over the system's lifetime. To address these issues, we propose a semi-automated generation of SADs from source code by integrating reverse engineering (RE) techniques with a Large Language Model (LLM). Our approach recovers both static and behavioral architectural views by extracting a comprehensive component diagram, filtering architecturally significant elements (core components) via prompt engineering, and generating state machine diagrams to model component behavior based on underlying code logic with few-shots prompting. This resulting views representation offer a scalable and maintainable alternative to traditional manual architectural documentation. This methodology, demonstrated using C++ examples, highlights the potent capability of LLMs to: 1) abstract the component diagram, thereby reducing the reliance on human expert involvement, and 2) accurately represent complex software behaviors, especially when enriched with domain-specific knowledge through few-shot prompting. These findings suggest a viable path toward significantly reducing manual effort while enhancing system understanding and long-term maintainability.
Problem

Research questions and friction points this paper is trying to address.

Automatically generating software architecture descriptions from source code to address outdated documentation
Reducing manual effort in deriving architectural insights through reverse engineering and LLMs
Improving system understanding and maintainability by recovering static and behavioral architectural views
Innovation

Methods, ideas, or system contributions that make the work stand out.

Combining reverse engineering with large language models
Generating component and state machine diagrams automatically
Using few-shot prompting for domain-specific knowledge integration
🔎 Similar Papers
No similar papers found.
A
Ahmad Hatahet
Institute for Software and Systems Engineering, Technical University of Clausthal, Clausthal-Zellerfeld, Germany
C
Christoph Knieke
Institute for Software and Systems Engineering, Technical University of Clausthal, Clausthal-Zellerfeld, Germany
Andreas Rausch
Andreas Rausch
Full Professor for Software Systems Engineering, Institute for Software & Systems Engineering, TU
Software Systems EngineeringRequirements Engineering and Software ArchitectureDesign and ModelingEngineering ProcessesProcess Management