Refactoring architectural smells with large language models: an exploratory study on cyclic dependencies

Abstract Context Architectural smells, e.g., cyclic dependencies (CDs), are widespread in software systems and pose significant challenges to maintainability, reliability and scalability. While tools can automatically detect such smells, refactoring them remains a manual and time-consuming task that developers often postpone in favor of implementing new features, which leads to increasing architectural technical debt. Objective This paper explores the use of Large Language Models (LLMs) to support the automated refactoring of CD smells across multiple programming languages, including C#, Java, and Python. Method We focus on enhancing LLM-generated refactoring suggestions through prompt engineering and Retrieval-Augmented Generation (RAG), enriching the models with context-specific information. We build on tools like Arcan, Understand and Pyexamine to identify CD smells and extract resolution strategies, which are then fed to both local and cloud-based LLMs to generate refactoring proposals. The effectiveness of these proposals is qualitatively assessed through interviews with seventeen participants: ten software engineering master students and seven professional developers. Results Our findings show that detailed contextualization significantly improves the quality of LLM-generated suggestions and that more complex smells may benefit from an agentic approach. Conclusion This study demonstrates the potential of LLMs to assist in architectural refactoring tasks and provides insights into optimizing their use through tailored prompting and retrieval techniques.

Authors

Institutions

Publication Details

Journal
Empirical Software Engineering
Published
2026-11-03
DOI
https://doi.org/10.1007/s10664-026-10939-8
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Refactoring architectural smells with large language models: an exploratory study on cyclic dependencies

Karthik Shivashankar, Francesca Arcelli Fontana, Simeon Tverdal, Antonio Martini et al.
Empirical Software Engineering
Software Engineering Research
article

Refactoring architectural smells with large language models: an exploratory study on cyclic dependencies

Karthik Shivashankar, Francesca Arcelli Fontana, Simeon Tverdal, Antonio Martini, Arda Göknil, Adela Nedisan Videsjorden, Gabriele Pandini, Phu Nguyen
article en

Abstract

Abstract Context Architectural smells, e.g., cyclic dependencies (CDs), are widespread in software systems and pose significant challenges to maintainability, reliability and scalability. While tools can automatically detect such smells, refactoring them remains a manual and time-consuming task that developers often postpone in favor of implementing new features, which leads to increasing architectural technical debt. Objective This paper explores the use of Large Language Models (LLMs) to support the automated refactoring of CD smells across multiple programming languages, including C#, Java, and Python. Method We focus on enhancing LLM-generated refactoring suggestions through prompt engineering and Retrieval-Augmented Generation (RAG), enriching the models with context-specific information. We build on tools like Arcan, Understand and Pyexamine to identify CD smells and extract resolution strategies, which are then fed to both local and cloud-based LLMs to generate refactoring proposals. The effectiveness of these proposals is qualitatively assessed through interviews with seventeen participants: ten software engineering master students and seven professional developers. Results Our findings show that detailed contextualization significantly improves the quality of LLM-generated suggestions and that more complex smells may benefit from an agentic approach. Conclusion This study demonstrates the potential of LLMs to assist in architectural refactoring tasks and provides insights into optimizing their use through tailored prompting and retrieval techniques.

Empirical Software EngineeringVol. 32(2)
SINTEF (NO), University of Oslo (NO), University of Milano-Bicocca (IT)
Openalex Percentile: Top 10%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon