LLM-Based Design Pattern Detection

📅 2025-02-25
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Identifying design pattern instances in unfamiliar codebases remains challenging due to reliance on explicit annotations and rigid syntactic templates in traditional static analysis. Method: This paper pioneers the integration of large language models (LLMs) into design pattern detection, shifting focus from syntax-based matching to semantic role identification of classes. We propose a hybrid approach combining fine-tuning and prompt engineering, incorporating formal pattern role definitions, context-aware code slicing, and multi-turn reasoning for validation—adapted to CodeLlama and DeepSeek-Coder. Results: Evaluated on 12 open-source projects, our method achieves an average F1-score of 86.3%, substantially outperforming existing tools. It supports all 7 Gang-of-Four patterns and robustly detects implicit implementations, thereby enhancing software architecture comprehension, refactoring decision-making, and cross-project knowledge transfer.

Technology Category

Application Category

📝 Abstract
Detecting design pattern instances in unfamiliar codebases remains a challenging yet essential task for improving software quality and maintainability. Traditional static analysis tools often struggle with the complexity, variability, and lack of explicit annotations that characterize real-world pattern implementations. In this paper, we present a novel approach leveraging Large Language Models to automatically identify design pattern instances across diverse codebases. Our method focuses on recognizing the roles classes play within the pattern instances. By providing clearer insights into software structure and intent, this research aims to support developers, improve comprehension, and streamline tasks such as refactoring, maintenance, and adherence to best practices.
Problem

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

Detect design patterns in code
Improve software quality and maintainability
Leverage Large Language Models for analysis
Innovation

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

Leverages Large Language Models
Identifies design pattern instances
Focuses on class roles
💼 Related Jobs
No related jobs found.