Interpretable deep learning for efficient code smell prioritization in software development - M. Rashid, Maaeda; Osman, Mohd Hafeez; Sharif, Khaironi Yatim; Zulzalil, Hazura (Institute of Electrical and Electronics Engineers, 2025)
Code smells indicate potential design flaws in software systems that can impair maintainability and increase technical debt. While existing approaches have advanced code smell priortization, they often lack effective prioritization mechanisms and interpretability, hindering developers’ ability to make informed refactoring decisions. This paper presents a novel approach combining CodeBERT embeddings with Bidirectional Long Short-Term Memory (Bi-LSTM) networks for code smell prioritization, enhanced by Local Interpretable Model-agnostic Explanations (LIME) for model interpretability. The approach introduces specialized preprocessing for large-scale projects and implements a selectivity metric for validating explanation quality. Our comprehensive evaluation demonstrates that the Bi-LSTM approach consistently outperforms traditional architectures across various code smell types, achieving 0.90 across precision, recall, and F1-score metrics for complex class priortization, and precision of 0.88 with recall of 0.87 for feature envy priortization. The model also showed strong performance in identifying God classes, namely, 0.84 for precision, 0.77 for recall, and 0.89 for long methods. The integration of LIME provides developers with clear insights into the model’s decision-making process, enhancing trust and facilitating more effective refactoring decisions. This work contributes a framework that not only accurately detects and prioritizes code smells but also offers transparent, interpretable results applicable in real-world software development.