Lune

FSE2025Top-tier venue

Automatically Detecting Numerical Instability in Machine Learning Applications via Soft Assertions

Shaila Sharmin, Anwar Hossain Zahid, Subhankar Bhattacharjee, Chiamaka Igwilo, Miryung Kim, Wei Le

Abstract

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 Soft Assertion Fuzzer 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.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

Questions to start from

Lune can draw on

the full paper · related work

Get the answer

Free to start. No credit card required.

Lineage

  • NNSmith: Generating Diverse and Valid Test Cases for Deep Learning Compilers cites Exposing numerical bugs in deep learning via gradient back-propagation
  • Fuzzing Automatic Differentiation in Deep-Learning Libraries cites NNSmith: Generating Diverse and Valid Test Cases for Deep Learning Compilers
  • Fuzzing Automatic Differentiation in Deep-Learning Libraries cites Detecting numerical bugs in neural network architectures
  • Fuzzing Automatic Differentiation in Deep-Learning Libraries cites Exposing numerical bugs in deep learning via gradient back-propagation
Builds onCited byLeft to right by year; the more cited, the higher.

Builds on11

  1. On learning meaningful assert statements for unit test casesCody Watson, Michele Tufano, Kevin Moran, Gabriele Bavota et al.ICSE 2020 · 96 citations
  2. NNSmith: Generating Diverse and Valid Test Cases for Deep Learning CompilersJiawei Liu, Jinkun Lin, Fabian Ruffy, Cheng Tan et al.ASPLOS 2023 · 90 citations
  3. Detecting numerical bugs in neural network architecturesYuhao Zhang, Luyao Ren, Liqian Chen, Yingfei Xiong et al.FSE 2020 · 66 citations
  4. Exposing numerical bugs in deep learning via gradient back-propagationMing Yan, Junjie Chen, Xiangyu Zhang, Lin Tan et al.FSE 2021 · 47 citations
  5. Fuzzing Automatic Differentiation in Deep-Learning LibrariesChenyuan Yang, Yinlin Deng, Jiayi Yao, Yuxing Tu et al.ICSE 2023 · 34 citations

Related papers

  1. Balancing Effectiveness and Flakiness of Non-Deterministic Machine Learning TestsChunqiu Steven Xia, Saikat Dutta, Sasa Misailovic, Darko Marinov et al.ICSE 2023 · 5 citations
  2. Detecting flaky tests in probabilistic and machine learning applicationsSaikat Dutta, August Shi, Rutvik Choudhary, Zhekun Zhang et al.ISSTA 2020 · 71 citations
  3. Muffin: Testing Deep Learning Libraries via Neural Architecture FuzzingJiazhen Gu, Xuchuan Luo, Yangfan Zhou, Xin WangICSE 2022 · 63 citations
  4. Constraint-Based Test Oracles for Program AnalyzersMarkus Fleischmann, David Kaindlstorfer, Anastasia Isychev, Valentin Wüstholz et al.ASE 2024 · 2 citations
  5. DeepStability: A Study of Unstable Numerical Methods and Their Solutions in Deep LearningEliska Kloberdanz, Kyle G. Kloberdanz, Wei LeICSE 2022 · 16 citations
Dusk over the sea between two cliffs drawn in fine vertical lines