Deep Learning Library Testing: Definition, Methods and Challenges

Xiaoyu Zhang, Weipeng Jiang, Chao Shen, Qi Li, Qian Wang, Chenhao Lin, Xiaohong Guan

TL;DR

This paper presents the first comprehensive survey of testing methodologies across the entire deep learning (DL) software stack, covering high-level frameworks (e.g., PyTorch), intermediate compilers (e.g., TVM), and low-level hardware libraries (e.g., cuDNN). By analyzing 93 papers and conducting head-to-head experiments, the authors reveal critical gaps in current research—specifically a lack of focus on performance bugs and the urgent need for better testing of low-level hardware components.

What Problem Does This Paper Address?

Deep learning systems are now the backbone of critical infrastructure, from self-driving cars to medical diagnostics. While much research focuses on the robustness of the DL models themselves, the underlying software libraries that execute these models are often overlooked.

Bugs in these libraries are insidious; they can cause system crashes, lead to "silent" numerical errors that ruin model accuracy, or create massive performance overheads. Because the DL stack is a complex pipeline of abstractions, a bug in a low-level hardware library can propagate upward, making it incredibly difficult to localize. This paper addresses the lack of a systematic, cross-component understanding of how to define, detect, and categorize these library-level bugs.

Methods

The authors employ a Systematic Literature Review (SLR) methodology to analyze the state of the art. They propose a novel taxonomy that categorizes testing research based on three key components of the DL workflow:

  1. DL Frameworks: High-level APIs used to build models.
  2. DL Compilers: Tools that translate models into optimized code.
  3. DL Hardware Libraries: Low-level routines that map operations to specific hardware like GPUs.

The overarching workflow is illustrated in Figure 1: Fig.

  1. Overarching Workflow of the DL system and DL program

![Fig.

  1. Overarching Workflow of the DL system and DL program](/figures/art_b77ed3ec12264dbdbe3ebfb3cbe1c500)

Beyond the survey, the authors conducted comparative experiments using five state-of-the-art framework testing tools (like TitanFuzz and FreeFuzz) and three compiler testing tools (like Tzer and GenCog). They evaluated these tools based on API coverage, code line coverage, and their ability to generate valid bug candidates over a 48-hour execution window.

Datasets

As a survey paper, it reviews various datasets used in the field, including:

  • Mined Code Snippets: Mined from GitHub and StackOverflow to serve as seeds for fuzz testing.
  • DL Bug Benchmarks: Such as the dataset by Kim et al., which contains 4,577 bugs across various DL software categories.
  • Model Zoos: Standard models like ResNet-50 used for differential testing across frameworks.
  • Authors' Repository: The researchers provided their own experimental data and settings in a public repository to facilitate reproducibility.

Key Insights and Ideas

  • The "Framework Bias": A staggering 74% of existing research focuses on DL frameworks. Compilers and hardware libraries remain relatively "black boxes" with significantly less testing coverage, despite being just as prone to bugs.
  • The Rise of LLM-Based Fuzzing: Traditional rule-based fuzzers (which generate random inputs) struggle with the complex syntax of DL APIs. Newer tools like TitanFuzz leverage Large Language Models (LLMs) to generate semantically valid, "edge-case" code that reaches deeper into the library logic.
  • Correctness vs. Efficiency: Most current testing focuses on "correctness" (does it crash or give the wrong answer?). "Efficiency" bugs—like memory leaks or suboptimal execution—are largely ignored, despite their massive impact on the carbon footprint and cost of AI.
  • The Oracle Problem: Differential testing (comparing the output of two different frameworks) is the most popular technique but suffers from high false-positive rates (up to 58%). Legitimate implementation differences between frameworks are often mistaken for bugs.

Key Results

The authors' head-to-head comparison yielded several concrete findings:

  • API Coverage: In framework testing, TitanFuzz achieved the highest coverage, testing 3,413 different APIs across PyTorch and TensorFlow.
  • Bug Candidate Volume: Tools like FreeFuzz and DeepREL generated hundreds of thousands of bug candidates. However, the authors note a major bottleneck: verifying these candidates requires "dozens of man-months" of manual effort, highlighting a desperate need for automated filtering.
  • Compiler Testing: In testing the TVM compiler, Muffin-TVM (a model-based approach) covered over 50,000 lines of code, significantly outperforming IR-based mutation tools like Tzer, which covered only ~26,000 lines.

Limitations and Future Work

The paper identifies several "Future Gazing" challenges:

  • Security Vulnerabilities: Most research focuses on functional bugs. There is almost no work on security vulnerabilities, such as how a malicious model might exploit a library API to perform unauthorized operations or implant backdoors.
  • Performance Benchmarks: There is an urgent need for quantitative "performance oracles" that can precisely predict how fast an API should run, rather than just checking if it crashes.
  • Evolutionary Testing: DL libraries evolve rapidly. Current benchmarks are static and quickly become obsolete. The authors suggest using code similarity metrics to automatically migrate test cases to new library versions.
  • Hardware Library Access: Many low-level libraries are proprietary, making it difficult for independent researchers to conduct the empirical bug studies necessary to build better testing tools.

Summary updated

BibTeX
@article{zhang2025deep,
  author = {Xiaoyu Zhang and Weipeng Jiang and Chao Shen and Qi Li and Qian Wang and Chenhao Lin and Xiaohong Guan},
  title = {{Deep Learning Library Testing: Definition, Methods and Challenges}},
  journal = {ACM Computing Surveys},
  year = {2025},
  url = {https://openreview.net/forum?id=Jej2SItmoI},
}
Figure