NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Bug Characterization in Machine Learning-based Systems

Mohammad Mehdi Morovati, Amin Nikanjam, Florian Tambon, Foutse Khomh, Zhen Ming, JiangarXiv 2023

TL;DR

This paper presents a comprehensive empirical study of bugs in machine learning (ML)-based systems, revealing that while ML code represents only a small fraction of a system's codebase, it accounts for nearly half of all "real" bugs. Furthermore, fixing these ML-specific bugs is significantly more complex than fixing traditional software bugs, requiring more code changes, more iterations, and more collaborators.

What Problem Does This Paper Address?

As machine learning moves from research labs into safety-critical production environments (like autonomous vehicles or medical diagnostics), the reliability of these systems becomes paramount. However, software maintenance—specifically identifying and fixing bugs—is notoriously difficult for ML.

Traditional software follows explicit logic, but ML components learn complex functions from data. This creates a "black box" effect that makes debugging a nightmare. While previous research has looked at bugs within ML frameworks (like TensorFlow itself) or isolated ML programs, this paper addresses the gap in understanding how bugs manifest and are managed in complete ML-based systems, where ML components must interact with traditional "non-ML" software (databases, UIs, etc.).

Methods

The authors followed a rigorous multi-step pipeline to extract and analyze real-world data from GitHub:

  1. Repository Mining: They initially scraped 447,948 GitHub repositories that imported popular ML frameworks (TensorFlow, Keras, PyTorch).
  2. Filtering: To ensure they were looking at mature, professional projects, they filtered for repositories with high activity (stars, forks, commits) and excluded tutorials or personal projects. This left 4,057 repositories.
  3. Manual Inspection: The authors manually inspected the top 300 repositories to confirm they were true ML-based systems. They identified 40 high-quality projects, including simulators like AirSim and speech engines like DeepSpeech.
  4. Issue Sampling & Labeling: They sampled 386 closed issues and pull requests (PRs). Through manual labeling and an open coding procedure, they categorized these as "ML bugs," "non-ML bugs," or "not real bugs" (e.g., user questions).
  5. Complexity Analysis: For the real bugs, they calculated metrics like the number of commits, changed lines of code (LOC), entropy (how scattered the changes are), and the number of developers involved.
Fig. 4: High-level view of the followed methodology.

Datasets

The study utilized a custom-built dataset derived from GitHub:

  • Source: 40 open-source ML-based software systems.
  • Frameworks: TensorFlow, Keras, and PyTorch.
  • Labeled Data: 386 manually inspected issues/PRs, resulting in a core set of 109 ML bugs and 119 non-ML bugs.
  • Replication Package: The authors have made their dataset and labeling results publicly available.

Key Insights and Ideas

  • The "Small Code, Big Headache" Paradox: As illustrated in the system architecture (Fig. 1), ML code is often just a tiny sliver of the overall system. Yet, the study found that 47.8% of real bugs are related to ML components. ML is disproportionately error-prone.
  • ML Bugs are "Stickier": ML bugs require significantly more commits to fix than non-ML bugs. This suggests that developers often struggle to find the right fix on the first try, leading to more trial-and-error iterations.
  • Higher Collaboration Requirements: Fixing an ML bug involves more people. The study found a statistically significant increase in the number of collaborators required for an ML bug-fix compared to traditional bugs.
  • Taxonomies are Aging: The authors found that existing classifications for ML bugs are becoming "stale." They had to add new categories like "deployment," "inference," and "monitoring" to account for bugs that occur when a trained model is actually put to use in a system.
  • Training is the Danger Zone: The majority of ML-related issues (52.7%) originate during the training phase, echoing earlier studies but confirming this holds true even in integrated systems.
Fig. 1: Sample architecture of an ML-based online transcription system (in- spired from [5]).

Key Results

  • Prevalence: Nearly half (40.9%) of reported issues in these repositories were "not real bugs" (user errors or unclear reports). Of the remaining actual bugs, 47.8% were ML-specific.
  • Fix Complexity: ML bugs showed a statistically significant increase in:
  • Number of Commits: Medium effect size ($d = 0.337$).
  • Changed Lines of Code (LOC): Small effect size ($d = 0.164$).
  • Entropy: ML changes are more localized to specific files but involve more complex internal logic changes.
  • Review Rigor: Development teams are more cautious with ML. 87.3% of ML bug-fix PRs were reviewed by other developers, compared to only 62.2% for non-ML bugs.
  • Root Causes: The most common root cause for ML bugs was Logic Errors (36.7%), followed by Configuration Errors (19.0%).

Limitations and Future Work

The authors acknowledge several limitations:

  • Platform Bias: The study focused exclusively on GitHub and Python-based projects.
  • Metric Limitations: "Time-to-fix" was measured as the interval between opening and closing an issue, which may not reflect the actual hours of active work spent by a developer.
  • Subjectivity: Manual labeling, while checked for inter-rater agreement, still carries a risk of human bias.

Future Work: The authors plan to expand this study to compare bug characteristics across different ML domains (e.g., Computer Vision vs. NLP) and to develop a more comprehensive taxonomy that covers the entire ML pipeline, including deployment and long-term maintenance.

Summary updated

BibTeX
@misc{morovati2023bug,
  author = {Mohammad Mehdi Morovati and Amin Nikanjam and Florian Tambon and Foutse Khomh and Zhen Ming and Jiang},
  title = {{Bug Characterization in Machine Learning-based Systems}},
  year = {2023},
  eprint = {2307.14512},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.14512},
}
Figure