Skip to main navigation Skip to search Skip to main content

An Empirical Analysis of LLM-Driven Refactoring for Microservices

  • Istanbul Technical University
  • University of Southern Denmark

Research output: Chapter in Book/Report/Conference proceeding › Conference contribution › peer-review

Abstract

Large Language Models (LLMs) are increasingly used in software engineering, raising the question of whether they can reliably support refactoring in microservice-based systems, where architectural constraints and deployment requirements make refactoring particularly complex. This study empirically examines LLM-driven refactoring using a structured, three-phase prompting protocol applied twice to four microservices previously labeled as low-maintainability by experienced developers. Three state-of-the-art LLMs, GPT-5.2 Extended Thinking, Claude Opus 4.5, and Gemini 3 Pro, were evaluated across analysis, refactoring, and self-audit phases, followed by deployment, execution, and metric-based validation. Of 24 total refactorings, 22 successfully passed build and run verification, showing that LLM-supported refactoring is feasible in real microservice environments. Across all models, refactored microservices demonstrated consistent improvements in software quality. Maximum cognitive complexity decreased by about 45%, maximum cyclomatic complexity by around 31%, and average cognitive complexity by 26%, while code duplication decreased by roughly 9%. Expectedly, LOC and NoM increased due to the enforced method-decomposition strategy. Model behaviors varied: Claude Opus 4.5 produced the strongest overall reductions in complexity, and Gemini 3 Pro achieved competitive improvements with the smallest code growth. Overall, the findings indicate that LLM-driven, developer-assisted refactoring can produce measurable and functionally safe improvements in microservice-based systems.

Original languageEnglish
Title of host publicationProceedings - 2026 IEEE 23rd International Conference on Software Architecture Companion, ICSA-C 2026
PublisherInstitute of Electrical and Electronics Engineers Inc.
Pages369-376
Number of pages8
ISBN (Electronic)9798331557409
DOIs
Publication statusPublished - 2026
Event23rd IEEE International Conference on Software Architecture Companion, ICSA-C 2026 - Amsterdam, Netherlands
Duration: 22 Jun 2026 → 26 Jun 2026

Publication series

NameProceedings - 2026 IEEE 23rd International Conference on Software Architecture Companion, ICSA-C 2026

Conference

Conference23rd IEEE International Conference on Software Architecture Companion, ICSA-C 2026
Country/TerritoryNetherlands
CityAmsterdam
Period22/06/26 → 26/06/26

Bibliographical note

Publisher Copyright:
© 2026 IEEE.

Keywords

  • Large Language Models (LLMs)
  • Maintainability
  • Microservices
  • Refactoring
  • Software metrics

Fingerprint

Dive into the research topics of 'An Empirical Analysis of LLM-Driven Refactoring for Microservices'. Together they form a unique fingerprint.

Cite this