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 language | English |
|---|---|
| Title of host publication | Proceedings - 2026 IEEE 23rd International Conference on Software Architecture Companion, ICSA-C 2026 |
| Publisher | Institute of Electrical and Electronics Engineers Inc. |
| Pages | 369-376 |
| Number of pages | 8 |
| ISBN (Electronic) | 9798331557409 |
| DOIs | |
| Publication status | Published - 2026 |
| Event | 23rd IEEE International Conference on Software Architecture Companion, ICSA-C 2026 - Amsterdam, Netherlands Duration: 22 Jun 2026 → 26 Jun 2026 |
Publication series
| Name | Proceedings - 2026 IEEE 23rd International Conference on Software Architecture Companion, ICSA-C 2026 |
|---|
Conference
| Conference | 23rd IEEE International Conference on Software Architecture Companion, ICSA-C 2026 |
|---|---|
| Country/Territory | Netherlands |
| City | Amsterdam |
| Period | 22/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
- APA
- Author
- BIBTEX
- Harvard
- Standard
- RIS
- Vancouver