Introduction
In software engineering, a "code smell" is a surface-level indicator of a deeper design problem that makes code difficult to maintain, test, or evolve. While traditional software engineering has decades of research on smells like "Long Methods" or "Large Classes," Deep Learning (DL) systems present unique challenges. These systems involve complex data dependencies, opaque model logic, and heavy reliance on rapidly evolving libraries like TensorFlow or PyTorch. This research identifies five new code smells specifically tailored to the architectural and data-dependent challenges of AI.
Methodology
The researchers employed a rigorous mixed-methods approach consisting of three main phases: code mining, qualitative analysis, and a developer survey. They analyzed 90,301 commits from 59 popular open-source DL projects to find recurring maintenance patterns. Through manual inspection and card sorting of 426 maintenance-related commits, they distilled nine modification categories into five distinct DL-specific smells. Finally, they validated these findings by surveying 235 practitioners to assess the prevalence and impact of these smells.
Key Results: Five New DL Code Smells
The study successfully identified and validated five novel DL code smells:
- Scattered Use of ML Library: API calls for a library are spread haphazardly across a project, making updates difficult.
- Unwanted Debugging Code: Leftover print statements or shape checks that clutter the codebase.
- Deep God File: A single file containing multiple DL components (e.g., preprocessing, training, and evaluation) without clear boundaries.
- Jumbled Model Architecture: Model parts like encoders and decoders are cobbled together rather than modularized.
- Dispensable Dependency: Unused or redundant DL libraries that bloat the system.
As illustrated in the survey data, these smells are highly prevalent in the field. Scattered Use of ML Library was recognized by 84% of respondents and was categorized as the most severe threat to long-term maintainability. Interestingly, while Unwanted Debugging Code was the most frequent smell found in the code mining phase, developers rated it as having the lowest impact on maintenance.
Insights and Impact
The research highlights that DL maintenance is fundamentally unique: one-third (33%) of all maintenance-related modifications in these systems are specific to DL components rather than general logic. Many of these smells, such as the Deep God File and Jumbled Model Architecture, stem from a lack of modularization between different stages of the ML pipeline. Quantitatively, these newly identified smells are more frequent in DL projects than generic Python smells like "Long Parameter List."
Conclusion and Future Work
While the study focused on Python-based open-source projects, the findings underscore a critical need for specialized maintenance tools in the AI ecosystem. The researchers suggest that the next logical step is the development of automated detection tools (linters) specifically for these DL smells. Such tools would help developers catch architectural issues before they become a significant maintenance burden, ultimately improving the sustainability of machine learning systems.
Summary updated