Skip to main content
QUICK REVIEW

[Paper Review] WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models

Chenyuan Yang, Yinlin Deng|arXiv (Cornell University)|Oct 24, 2023
Software Testing and Debugging TechniquesComputer Science9 citations
TL;DR

WhiteFox introduces a white-box compiler fuzzer that uses LLMs to analyze optimization code and generate test inputs, achieving more optimization coverage and uncovering many bugs across multiple compilers.

ABSTRACT

Compiler correctness is crucial, as miscompilation can falsify program behaviors, leading to serious consequences. Fuzzing has been studied to uncover compiler defects. However, compiler fuzzing remains challenging: Existing arts focus on black- and grey-box fuzzing, which generates tests without sufficient understanding of internal compiler behaviors. Meanwhile, traditional white-box techniques, like symbolic execution, are computationally inapplicable to the giant codebase of compilers. Recent advances demonstrate that Large Language Models (LLMs) excel in code generation/understanding tasks. Nonetheless, guiding LLMs with compiler source-code information remains a missing piece of research in compiler testing. To this end, we propose WhiteFox, the first white-box compiler fuzzer using LLMs with source-code information to test compiler optimization, with a spotlight on detecting deep logic bugs in the deep learning (DL) compilers. WhiteFox adopts a multi-agent framework: an LLM-based analysis agent examines the low-level optimization source code and produces requirements on the high-level test programs that can trigger the optimization; an LLM-based generation agent produces test programs based on the summarized requirements. Additionally, optimization-triggering tests are used as feedback to enhance the generation on the fly. Our evaluation on the three most popular DL compilers (i.e., PyTorch Inductor, TensorFlow-XLA, and TensorFlow Lite) shows WhiteFox can generate high-quality test programs to exercise deep optimizations, practicing up to 8X more than state-of-the-art fuzzers. WhiteFox has found 101 bugs for the DL compilers, with 92 confirmed as previously unknown and 70 fixed. WhiteFox has been acknowledged by the PyTorch team and is being incorporated into its development workflow. Beyond DL compilers, WhiteFox can also be adapted for compilers in different domains.

Motivation & Objective

  • Motivate the need for reliable compiler optimizations and scalable white-box fuzzing beyond traditional symbolic or coverage-driven methods.
  • Propose a dual-LLM framework to translate optimization implementation into high-level test inputs.
  • Develop a feedback loop that uses optimization-triggering tests to iteratively improve test inputs.
  • Evaluate WhiteFox on multiple compilers to assess optimization coverage and bug-finding capabilities.

Proposed method

  • Use an analysis LLM to summarize low-level optimization code into high-level trigger requirements in mixed NL and pseudo-code format.
  • Use a generation LLM to produce test programs (e.g., PyTorch models) that meet the summarized requirements.
  • Implement a feedback loop where tests that trigger optimizations are added as few-shot examples to improve future generation.
  • Instrument compilers to detect when an optimization is triggered and to identify crashes or result inconsistencies as test oracles.
  • Apply a Thompson Sampling-based multi-armed bandit to select effective triggering examples for balancing exploration and exploitation in test generation.
Figure 1. Motivating example.
Figure 1. Motivating example.

Experimental results

Research questions

  • RQ1Can LLMs translate low-level optimization implementations into high-level input requirements that effectively trigger compiler optimizations?
  • RQ2Do LLM-guided test inputs produce deeper optimization coverage than existing fuzzers across diverse compilers?
  • RQ3How effective is the feedback loop and example selection strategy in improving subsequent test generation?

Key findings

  • WhiteFox achieves up to 8x more optimizations exercised than state-of-the-art fuzzers in experiments.
  • The framework found 96 bugs across tested compilers, with 80 previously unknown and 51 already fixed.
  • WhiteFox demonstrates higher optimization coverage across four SUTs including three DL compilers and LLVM.
  • The combination of natural language and pseudo-code summaries improves requirement extraction for triggering optimizations.
  • A feedback loop using triggering tests as few-shot examples and Thompson Sampling improves subsequent test generation.
Figure 2. Overview of WhiteFox .
Figure 2. Overview of WhiteFox .

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.