Automatically Detecting Numerical Instability in Machine Learning Applications via Soft Assertions

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sharmin, Shaila, Zahid, Anwar Hossain, Bhattacharjee, Subhankar, Igwilo, Chiamaka, Kim, Miryung, Le, Wei
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910917188386816
author Sharmin, Shaila
Zahid, Anwar Hossain
Bhattacharjee, Subhankar
Igwilo, Chiamaka
Kim, Miryung
Le, Wei
author_facet Sharmin, Shaila
Zahid, Anwar Hossain
Bhattacharjee, Subhankar
Igwilo, Chiamaka
Kim, Miryung
Le, Wei
contents Machine learning (ML) applications have become an integral part of our lives. ML applications extensively use floating-point computation and involve very large/small numbers; thus, maintaining the numerical stability of such complex computations remains an important challenge. Numerical bugs can lead to system crashes, incorrect output, and wasted computing resources. In this paper, we introduce a novel idea, namely soft assertions (SA), to encode safety/error conditions for the places where numerical instability can occur. A soft assertion is an ML model automatically trained using the dataset obtained during unit testing of unstable functions. Given the values at the unstable function in an ML application, a soft assertion reports how to change these values in order to trigger the instability. We then use the output of soft assertions as signals to effectively mutate inputs to trigger numerical instability in ML applications. In the evaluation, we used the GRIST benchmark, a total of 79 programs, as well as 15 real-world ML applications from GitHub. We compared our tool with 5 state-of-the-art (SOTA) fuzzers. We found all the GRIST bugs and outperformed the baselines. We found 13 numerical bugs in real-world code, one of which had already been confirmed by the GitHub developers. While the baselines mostly found the bugs that report NaN and INF, our tool \tool found numerical bugs with incorrect output. We showed one case where the Tumor Detection Model, trained on Brain MRI images, should have predicted "tumor", but instead, it incorrectly predicted "no tumor" due to the numerical bugs. Our replication package is located at https://figshare.com/s/6528d21ccd28bea94c32.
format Preprint
id arxiv_https___arxiv_org_abs_2504_15507
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Automatically Detecting Numerical Instability in Machine Learning Applications via Soft Assertions
Sharmin, Shaila
Zahid, Anwar Hossain
Bhattacharjee, Subhankar
Igwilo, Chiamaka
Kim, Miryung
Le, Wei
Software Engineering
D.2.5; D.2.4
Machine learning (ML) applications have become an integral part of our lives. ML applications extensively use floating-point computation and involve very large/small numbers; thus, maintaining the numerical stability of such complex computations remains an important challenge. Numerical bugs can lead to system crashes, incorrect output, and wasted computing resources. In this paper, we introduce a novel idea, namely soft assertions (SA), to encode safety/error conditions for the places where numerical instability can occur. A soft assertion is an ML model automatically trained using the dataset obtained during unit testing of unstable functions. Given the values at the unstable function in an ML application, a soft assertion reports how to change these values in order to trigger the instability. We then use the output of soft assertions as signals to effectively mutate inputs to trigger numerical instability in ML applications. In the evaluation, we used the GRIST benchmark, a total of 79 programs, as well as 15 real-world ML applications from GitHub. We compared our tool with 5 state-of-the-art (SOTA) fuzzers. We found all the GRIST bugs and outperformed the baselines. We found 13 numerical bugs in real-world code, one of which had already been confirmed by the GitHub developers. While the baselines mostly found the bugs that report NaN and INF, our tool \tool found numerical bugs with incorrect output. We showed one case where the Tumor Detection Model, trained on Brain MRI images, should have predicted "tumor", but instead, it incorrectly predicted "no tumor" due to the numerical bugs. Our replication package is located at https://figshare.com/s/6528d21ccd28bea94c32.
title Automatically Detecting Numerical Instability in Machine Learning Applications via Soft Assertions
topic Software Engineering
D.2.5; D.2.4
url https://arxiv.org/abs/2504.15507