Fast and Exact Enumeration of Deep Networks Partitions Regions

Randall Balestriero, Yann LeCun

TL;DR

Deep networks with ReLU-like activations partition their input space into a complex web of distinct linear regions. This paper introduces the first parallel algorithm to exactly enumerate and count these regions, revealing that traditional random sampling severely misses smaller regions as input dimensions grow.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) using piecewise linear activations (such as ReLU or Leaky-ReLU) can be mathematically viewed as Continuous Piecewise Affine (CPA) functions. This means they divide their high-dimensional input space into a massive partition of polytopal regions, applying a unique linear transformation within each region.

Understanding the geometry and quantity of these regions is crucial for analyzing network expressivity, optimization landscapes, and generalization bounds. However, exactly mapping these regions is incredibly difficult. Until now, researchers have relied on uniform random sampling or visualizing 2D/3D slices of the input space. The core challenge is that random sampling suffers from the curse of dimensionality, leaving a massive blind spot for smaller regions that might be theoretically or practically vital.

Methods

The authors introduce a principled, parallelizable region enumeration method (Algorithm 1) that leverages mathematical frameworks from hyperplane arrangements.

Instead of naively checking all $2^K$ possible sign patterns (where $K$ is the number of neurons), which is computationally impossible for large networks, the algorithm uses a recursive tree-like search:

  • Single-Layer Enumeration: Each neuron defines a hyperplane boundary. The algorithm recursively subdivides a parent region using a target hyperplane. It sets up a simple Linear Program (LP) feasibility check to see if the hyperplane actually intersects the current region. If it doesn't, the branch is pruned immediately.
  • Multi-Layer Extension: Because deep networks recursively subdivide the partitions created by preceding layers, the algorithm applies the single-layer method iteratively. It maps the first layer, and then for each discovered region, composes the local affine mapping to project and define the hyperplane boundaries for the subsequent layer.

This recursive process across multiple layers is visualized below:

Multilayer subdivision process

Datasets

The paper does not use standard empirical datasets (like ImageNet or CIFAR). Because it focuses on a purely geometric and architectural problem, the algorithm is evaluated using synthetic deep networks initialized with random weights and biases. The experiments vary across input dimensions ($D \in \{2, 4, 8\}$) and layer widths ($K \in \{16, 32, 64, 128, 256\}$).

Key Insights and Ideas

  • The Sampling Illusion: Uniform random sampling is highly efficient if you only care about regions with large volumes. However, if you need to discover smaller regions, uniform sampling becomes exponentially costly as the input dimension increases.
  • Linear Complexity Scaling: Crucially, the proposed exact method scales linearly with both the input space dimension and the total number of actual regions, bypassing the typical exponential explosion.
  • Bias in Current Literature: Many current techniques (like certain Neural Architecture Search methods or generative model evaluations) rely on sampling to estimate partition statistics. This paper proves that such sampling is heavily biased and frequently misses a huge percentage of the partition structure.

Key Results

The exact enumeration algorithm dramatically outperforms sampling-based discovery in higher dimensions.

As shown in the benchmark figures, given a fixed time budget, the exact algorithm (represented by the orange star) identifies every single region, while random sampling (blue dots) plateaus significantly below the true total:

Exact enumeration vs sampling over time

Quantitatively, the gap widens drastically as the input dimension ($D$) grows:

Quantitative comparison table

For instance, at dimension $D=8$ and width $K=128$, the exact method successfully enumerates all 386,566 regions. Under the exact same time budget, uniform sampling only manages to discover 35% of them (136,748 regions), completely missing the remaining 65%.

Limitations and Future Work

While the algorithm scales linearly with the number of regions, the total number of regions itself can still explode exponentially based on the depth and width of the network architecture. For exceptionally massive production-scale models, the absolute number of regions might still present a computational boundary.

Additionally, the current formulation is tailored strictly to standard continuous piecewise affine operators (like standard dense or convolutional layers with ReLU). Extending this exact enumeration framework to more complex modern architectures, such as SwiGLU activations or Attention mechanisms in Transformers, remains an open challenge for future research.

Summary updated

BibTeX
@inproceedings{balestriero2023fast,
  author = {Randall Balestriero and Yann LeCun},
  title = {{Fast and Exact Enumeration of Deep Networks Partitions Regions}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2023},
  doi = {10.1109/icassp49357.2023.10095698},
}
Figure