Skip to main content
POPL'24VerificationReLUConvex HullFormal Methods

WraLU: Fast and Precise ReLU Hull Approximation

Zhongkui Ma, Jiaying Li, Guangdong Bai

A fast and precise approach to over-approximating the convex hull of the ReLU function, reporting up to 50% fewer constraints at comparable or better precision.

Overview

WraLU is a fast and precise approach to over-approximating the convex hull of the ReLU function (referred to as the ReLU hull), one of the most used activation functions. POPL’24 (the 51st ACM SIGPLAN Symposium on Principles of Programming Languages).

Key Idea

Our key insight is to formulate a convex polytope that “wraps” the ReLU hull, by reusing the linear pieces of the ReLU function as the lower faces and constructing upper faces that are adjacent to the lower faces. The upper faces can be efficiently constructed based on the edges and vertices of the lower faces, given that an n-dimensional hyperplane can be determined by an (n−1)-dimensional hyperplane and a point outside of it.

Performance Highlights

  • Up to 50% fewer constraints, reaching comparable or better precision in less time — the figure the paper’s abstract reports
  • Construction is bookkeeping over the ReLU’s own edges and vertices, so cost grows with the polytope’s combinatorics rather than with a geometry search
  • Handles arbitrary input polytopes and higher-dimensional cases
  • Used in verification experiments on CNNs and ResNet-style models with tens of thousands of neurons
  • Designed for LP-based neural network verification pipelines that benefit from tighter ReLU relaxations

How It Works

  1. Lower Faces: Reuse the linear pieces of the ReLU function directly
  2. Upper Face Construction: Build upper faces adjacent to lower faces using edge and vertex information
  3. Wrapping Polytope: The resulting convex polytope tightly wraps the ReLU hull
  4. Integration: Feed the constraints to LP solvers for neural network verification
  • WraAct: Extension to general activation functions (Sigmoid, Tanh, MaxPool)
  • wraact (library): Unified Python library for hull approximation

Read the explanation

Talks & tutorials

  • Robustness Verification of Neural Networks using WraLU · Australasian Database Conference (ADC 2024) · Tutorial · December 2024 · Gold Coast, AustraliaJoint with Guangdong Bai
  • ReLU Hull Approximation Workshop · Formal Methods in Australia and New Zealand · Workshop presentation · 30 May 2024 · The University of Queensland, St Lucia, Australia
  • ReLU hull approximation · FPTalks / FPBench community meeting · Talk · 2 May 2024 · Online

More selected talks and tutorials are listed on the About page.

Citation

@article{ma2024relu,
  author = {Ma, Zhongkui and Li, Jiaying and Bai, Guangdong},
  title = {ReLU Hull Approximation},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {POPL},
  pages = {2260--2287},
  year = {2024},
  publisher = {ACM New York, NY, USA}
}