This paper demonstrates small language models classify code smells in Python, indicating their potential in automated code quality assessment.
Code quality is essential for maintainable and evolvable software systems. Traditional code smell detection tools rely on AST-based techniques and metric-driven heuristics, which, while effective, often lack interpretability and require specialized knowledge. This paper investigates the use of Small Language Models (SLMs) for classifying two widely studied code smells—Long Method and Long Parameter List—in Python codebases. Unlike Large Language Models (LLMs), SLMs offer lower latency and reduced computational cost, making them suitable for deployment in resourceconstrained environments. We systematically compare the performance of SLMs with traditional Machine Learning (ML) and Deep Learning (DL) models, and the AST-based DPy tool. We also analyze the role of prompt engineering techniques—zero-shot and chain-of-thought—in enhancing SLM performance. Our evaluation considers precision, recall, F1-score, and processing time, using a custom event-driven dataset designed for code classification. Results show that SLMs achieve competitive accuracy with improved interpretability. Additionally, we release an annotated dataset comprising classifications from all approaches. This work provides new insights into lightweight, explainable, and practical methods for automated code quality assessment, and supports the broader adoption of SLMs in software engineering.
No takes yet. Share an insight, caveat, or question.
Oliveira et al. (2025) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: