← Latest papers
💻 computer science

A Pilot Study on Detecting Software Design Patterns with Large Language Models: An Empirical Evaluation

This pilot study empirically evaluates the effectiveness of four Large Language Models and three ensemble approaches in detecting five software design patterns using source code, PlantUML diagrams, and text descriptions, finding that NextCoder and Gemma 3 achieve higher accuracy while ensemble methods improve overall detection efficiency.

Original authors: Oishik Chowdhury, Bastin Tony Roy Savarimuthu, Sherlock A. Licorish

Published 2026-04-21
📖 5 min read🧠 Deep dive

Original authors: Oishik Chowdhury, Bastin Tony Roy Savarimuthu, Sherlock A. Licorish

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are handed a massive, tangled ball of yarn that represents a huge software program. To a new developer, this ball looks like a chaotic mess. To an experienced developer, however, they can spot specific, familiar knots and loops within the yarn. These knots are called Design Patterns. They are like standard recipes or blueprints (like "how to build a secure door" or "how to organize a library") that programmers use to solve common problems.

The problem is that finding these patterns manually is like trying to find a specific knot in that giant ball of yarn while blindfolded. It takes forever, and if you miss a knot, the whole structure might be weak or prone to breaking.

This paper is a pilot study (a small-scale test run) asking a big question: Can new "AI brains" (Large Language Models or LLMs) help us find these knots faster and better?

Here is the breakdown of their experiment, explained simply:

1. The "AI Detectives"

The researchers didn't just use one AI; they hired a team of four different "detectives" (AI models) to see who was best at spotting the patterns:

  • Three "Coder" AIs: These are AIs specifically trained to read and write computer code (like Qwen2.5, NextCoder, and Nxcode-CQ).
  • One "General" AI: This is a smart AI not specifically trained on code (Gemma 3), just to see if a general brain could figure it out.
  • The "Council": They also tried a strategy where they asked three detectives to vote on the answer. If two out of three said "Yes, this is a pattern," the Council said "Yes." This is called an Ensemble.

2. The Three Ways of Showing the Clues

The researchers tested the detectives using three different ways to present the "crime scene" (the software code):

  • The Raw Code: Showing the AI the actual computer code (like showing a detective the raw evidence).
  • The Blueprint (PlantUML): Showing a simplified diagram of how the code connects (like showing a detective a floor plan instead of the messy room).
  • The Story (Text Description): Asking another AI to write a plain English summary of what the code does (like a detective reading a witness's testimony).

3. The Five "Knots" They Looked For

They focused on five specific types of design patterns (the "knots"):

  • Singleton: Making sure there is only one "boss" in the room.
  • Adapter: Using a plug adapter to make two different things fit together.
  • Bridge: Building a bridge to connect two separate islands.
  • Composite: Building a tree where branches are made of smaller branches.
  • Decorator: Adding extra features to an object without changing its core (like putting a new coat of paint on a car).

4. What Did They Find? (The Results)

The Star Performers:

  • NextCoder and Gemma 3 were the top detectives. Surprisingly, the "General" AI (Gemma 3) was just as good, if not better, than the specialized "Coder" AIs in some cases.
  • The Council (Ensemble): When the detectives voted together, they were often more accurate than any single detective working alone. It's like having a team of experts double-checking each other's work.

The Input Mystery:

  • You might think showing the AI the Raw Code would be best. But the study found something weird: It didn't matter much!
  • Whether they showed the Raw Code, the Blueprint, or the Story, the AIs performed roughly the same.
  • The Twist: The "Story" (text description) actually helped the AI find more patterns (higher "recall"), while the "Blueprint" was very good at avoiding false alarms (higher "precision").

The Struggles:

  • The AIs were great at finding simple patterns (like the "Singleton" or "Decorator").
  • They struggled a bit with complex, messy patterns (like "Composite" or "Bridge"), often missing them or getting confused. This is like a detective missing a knot because the yarn was too tangled to see the whole picture.

5. Why Does This Matter?

Think of software as a city.

  • New developers are like tourists trying to navigate the city. They get lost easily.
  • Experienced developers are like locals who know the shortcuts.
  • Design Patterns are the street signs.

This study shows that AI can act as a super-powered GPS. It can scan a messy codebase and say, "Hey, look! Here is a 'Bridge' pattern here, and a 'Singleton' there." This helps new developers understand the city quickly and helps experienced developers fix broken streets before they cause traffic jams (bugs).

The Bottom Line

The paper concludes that AI is ready to help, but it's not perfect yet.

  • Good News: We don't necessarily need super-expensive, specialized "Coder" AIs; smart general AIs work well too.
  • Good News: Asking the AI to read a plain English summary of the code is just as effective as reading the code itself.
  • Future Work: The researchers want to test more patterns, look at bigger chunks of code (not just single files), and teach the AI to explain why it found a pattern, not just that it found one.

In short: AI is becoming a very helpful assistant for software architects, capable of spotting the hidden blueprints in our digital buildings.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →