Skip to main navigation Skip to search Skip to main content

The specification, detection, and refactoring of machine learning service misuses

  • Hadil Ben Amor

Student thesis: Master's thesisMaster in Engineering: Engineering

Abstract

Machine Learning (ML) models are widely used across many domains, including image processing, medical diagnostics, and autonomous systems. Major cloud providers such as Amazon, Google, and Microsoft offer ML cloud services that simplify development by eliminating the need to build models from scratch. While these services accelerate ML adoption, recurring misuses frequently arise, degrading system quality and maintainability. Although prior work has examined specific misuse cases in areas such as object-oriented programming, cloud services, and ML-based systems, the literature still lacks a comprehensive treatment of ML cloud service misuses in terms of their specification, detection, and refactoring. This project addresses this gap through three main contributions: (1) a catalog of bad practices in ML cloud service usage, (2) a highly automated detection approach for identifying these misuses, and (3) an automated refactoring strategy for removing them. To build the catalog, we conducted a multi-vocal empirical study combining an academic and gray literature review, a manual analysis of 377 GitHub projects using ML cloud services, and a survey of 50 industry practitioners. This study resulted in the identification of 20 distinct ML service misuses. We propose MLmisFinder, an automated detection approach based on a metamodel and rule-based detection algorithms targeting seven misuse types. It was evaluated on 107 open-source projects, achieving an average precision of 96.7% and a recall of 97%, and demonstrated strong scalability across 817 ML service–based systems. Finally, we explored automated refactoring using Large Language Models (LLMs), with GPT being the best-performing model in 58% of the cases, achieving up to 82% accuracy and the fastest average execution time of 3.86 seconds.
Date22 Mar 2026
Original languageAmerican English
Awarding Institution
  • École de technologie supérieure
SupervisorManel Abdellatif (Supervisor) & Taher A. Ghaleb (Co-supervisor)

Cite this

'