[Paper Review] Large Language Models are Edge-Case Fuzzers: Testing Deep Learning Libraries via FuzzGPT
FuzzGPT primes LLMs to generate unusual, edge-case Python code snippets to fuzz DL libraries, outperforming TitanFuzz by leveraging historical bug data through in-context learning and fine-tuning.
Deep Learning (DL) library bugs affect downstream DL applications, emphasizing the need for reliable systems. Generating valid input programs for fuzzing DL libraries is challenging due to the need for satisfying both language syntax/semantics and constraints for constructing valid computational graphs. Recently, the TitanFuzz work demonstrates that modern Large Language Models (LLMs) can be directly leveraged to implicitly learn all the constraints to generate valid DL programs for fuzzing. However, LLMs tend to generate ordinary programs following similar patterns seen in their massive training corpora, while fuzzing favors unusual inputs that cover edge cases or are unlikely to be manually produced. To fill this gap, this paper proposes FuzzGPT, the first technique to prime LLMs to synthesize unusual programs for fuzzing. FuzzGPT is built on the well-known hypothesis that historical bug-triggering programs may include rare/valuable code ingredients important for bug finding. Traditional techniques leveraging such historical information require intensive human efforts to design dedicated generators and ensure the validity of generated programs. FuzzGPT demonstrates that this process can be fully automated via the intrinsic capabilities of LLMs (including fine-tuning and in-context learning), while being generalizable and applicable to challenging domains. While FuzzGPT can be applied with different LLMs, this paper focuses on the powerful GPT-style models: Codex and CodeGen. Moreover, FuzzGPT also shows the potential of directly leveraging the instruct-following capability of the recent ChatGPT for effective fuzzing. Evaluation on two popular DL libraries (PyTorch and TensorFlow) shows that FuzzGPT can substantially outperform TitanFuzz, detecting 76 bugs, with 49 already confirmed as previously unknown bugs, including 11 high-priority bugs or security vulnerabilities.
Motivation & Objective
- Motivate robust testing of DL libraries due to widespread downstream impact of bugs.
- Propose FuzzGPT to generate unusual input programs by leveraging historical bug-triggering code via LLMs.
- Automate bug-triggering code generation through in-context learning and fine-tuning.
- Evaluate FuzzGPT on PyTorch and TensorFlow and compare with TitanFuzz.
- Demonstrate discovery of new bugs and potential vulnerabilities through automated fuzzing.
Proposed method
- Mine historical bug-triggering code snippets from GitHub issues and PRs for target DL libraries.
- Annotate buggy APIs for each code snippet using a self-training LLM approach with few manual labels.
- Apply three learning strategies to generate edge-case fuzzing code: few-shot in-context learning, zero-shot completion/editing, and fine-tuning on bug-triggering code.
- Execute generated programs with crash, CPU/GPU consistency, and automatic differentiation (AD) oracles to detect bugs.
- Evaluate using Codex and CodeGen LLMs, with zero-shot ChatGPT variant, on PyTorch and TensorFlow libraries.

Experimental results
Research questions
- RQ1RQ1: How do the different FuzzGPT learning paradigms (few-shot, zero-shot, fine-tuning) compare in effectiveness?
- RQ2RQ2: How does FuzzGPT perform against existing fuzzers like TitanFuzz?
- RQ3RQ3: How do key components of FuzzGPT contribute to its effectiveness?
- RQ4RQ4: Is FuzzGPT able to detect new bugs in real-world DL libraries?
Key findings
- FuzzGPT variants show 60.70%/36.03% higher coverage than TitanFuzz on PyTorch/TensorFlow, respectively.
- FuzzGPT found 76 bugs across latest PyTorch and TensorFlow versions.
- 49 of these bugs are newly identified, with 11 classified as high-priority or security-relevant.
- The study used 1,750 PyTorch and 633 TensorFlow bug-triggering snippets mined from GitHub.
- FuzzGPT demonstrates effectiveness across Codex, CodeGen, and ChatGPT-based zero-shot variant.
- The approach is fully automated and generalizable to other domains beyond DL libraries.

Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.