Search papers, labs, and topics across Lattice.
This paper evaluates the ability of LLMs (NextCoder, Gemma 3, and ensembles) to detect five software design patterns (Singleton, Adapter, Bridge, Composite, Decorator) from source code, PlantUML, and text descriptions. LLMs, particularly NextCoder and Gemma 3, show promise in design pattern detection, with ensemble methods further improving performance. The study compares the effectiveness of different input representations, finding that ensembles enhance detection efficiency.
LLMs can spot design patterns in code with surprising accuracy, potentially automating crucial software understanding tasks.
Design patterns provide reusable solutions to recurring software design problems. Automatically detecting these patterns in source code can help bootstrap new developers' understanding of unfamiliar software system architectures, and can help experienced developers to quickly identify and rectify potential quality issues. While many prior research works have explored graph based and machine-learning based detection techniques, this work evaluates the design pattern recognition capabilities of four Large Language Models and two ensemble approaches consisting three out of the four models. We also compare their performance when prompted with a) Source code, b) PlantUML representation of source code, and c) Text-based descriptions of the source code. We investigate the detection of five design patterns: singleton, adapter, bridge, composite and decorator. Our preliminary results indicate that LLMs show promise for automatically detecting design patterns, with NextCoder and Gemma 3 demonstrating comparatively higher accuracy than other models evaluated, and the ensemble approaches enhancing the overall efficiency of design pattern detection. We identify several directions for future work.