NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Bounding and Counting Linear Regions of Deep Neural Networks

Thiago Serra, Christian Tjandraatmadja, Srikumar Ramalingam

Deep neural networks (DNNs) are often described as "black boxes," but their internal geometry is surprisingly structured. For networks using piecewise linear (PWL) activations like ReLU or Maxout, the function they represent is essentially a massive collection of linear "tiles" or regions stitched together.

In their paper "Bounding and Counting Linear Regions of Deep Neural Networks," Serra et al. provide new mathematical tools to measure this complexity, offering tighter bounds on how many regions a network can create and, for the first time, a way to count them exactly in trained models.

TL;DR

The authors provide significantly tighter theoretical bounds on the number of linear regions in ReLU and Maxout networks and introduce a novel Mixed-Integer Linear Programming (MILP) framework to count these regions exactly. Their findings reveal a "bottleneck effect" where small early layers permanently limit a network's expressiveness and show that shallow networks can actually outperform deep ones in region count when input dimensions are very high.

What Problem Does This Paper Address?

While we know deep networks perform exceptionally well, the theoretical understanding of why depth helps is still catching up. A common proxy for a network's "expressive power" is the number of linear regions it can partition its input space into. More regions generally mean the network can approximate more complex, wiggly functions.

Previous research established that depth allows for an exponential increase in the number of regions compared to shallow networks. However, existing upper bounds were loose, and there was no way to determine the actual number of regions in a real-world, trained network. This paper aims to close the gap between theoretical maximums and empirical reality.

Methods

The authors tackle the problem from two angles:

  1. Theoretical Refinement: They derive new upper and lower bounds by carefully tracking the dimensionality of the space as it passes through each layer. They prove that the maximum number of regions is constrained by the rank of the weight matrices and the number of active neurons.
  2. Exact Counting via MILP: This is the paper's most practical contribution. They model the DNN as a Mixed-Integer Linear Program (MILP). By using binary variables to represent whether a ReLU is "on" or "off," they can systematically enumerate every unique activation pattern (and thus every linear region) within a bounded input space.
Figure 2. (a) Simple DNN with two inputs and three layers with 2 activation units each. (b) Visualization of the hyperplanes from the layers partitioning the input space into 20 linear regions. The arrows indicate the directions in which the corresponding neurons are activated. (c) Visualization of the hyperplanes from the first, second, and third (non-input) layers (from top to bottom) in the space given by the outputs of their respective previous layers. The outputs of the units are ha = max{0, −x1 + x2}, hb = max{0, x1 + x2 −4}, hc = max{0, −ha −3hb + 4}, hd = max{0, −3ha −hb + 4}, he = max{0, hc + 3hd −4}, and hf = max{0, 3hc + hd −4}.

Datasets

To validate their counting method, the authors trained small ReLU networks on the MNIST benchmark dataset. They used these trained models to compare the actual number of linear regions against their new theoretical bounds.

Key Insights and Ideas

  • The Bottleneck Effect: The number of regions is highly sensitive to the width of early layers. If a network starts with a very narrow layer, it "compresses" the input dimensionality in a way that subsequent wider layers cannot recover. This suggests that architecture design should avoid early-stage bottlenecks to maintain high expressiveness.
  • Deep vs. Shallow Crossover: The "depth is always better" mantra has a caveat. The authors show that if the input dimension ($n_0$) is significantly larger than the number of neurons per layer, a shallow network can actually produce more linear regions than a deep one with the same total neuron count.
  • Bound Tightness: Their new bounds are the first to be exact for one-dimensional inputs and are demonstrably tighter than previous state-of-the-art results (see Figure 1).
Figure 1. This paper shows improved bounds on the ”number of lin- ear regions” (typically used to study the expressiveness of DNNs) of PWL functions modeled by DNNs that use rectified linear acti- vation functions, and a method for exact counting of the number of such regions in trained networks. We compare upper bounds from the first and latest results in the literature (Mont´ufar et al., 2014; Mont´ufar, 2017) with our main result (See Theorem 1). Using the proposed exact counting algorithm, we show the actual number of linear regions in 10 rectifier networks for MNIST digit recogni- tion task with each configuration of two hidden layers totaling 22 neurons, reporting average and min-max range.

Key Results

  • Tighter Bounds: The authors' upper bound (Theorem 1) significantly outperforms previous bounds by Montúfar et al., especially as the network configuration changes.
  • Empirical Validation: Using their MILP counting method, they found that trained networks typically utilize only a fraction of their theoretically possible regions, but the relative behavior of the counts across different architectures follows the trends predicted by their "bottleneck" theory.
  • Architecture Sensitivity: Figure 4 demonstrates how shifting neurons from early layers to later layers (increasing the bottleneck) monotonically decreases the upper bound on regions.
Figure 4. Upper bound from Theorem 1, in semilog scale, for input dimension n0 = 32 and the width of the first five layers parame- terized as 16 + 2k, 16 + k, 16, 16 −k, 16 −2k.

Limitations and Future Work

  • Computational Complexity: Counting regions using MILP is NP-hard. While feasible for the small networks (22 neurons) used in the MNIST experiments, it remains computationally prohibitive for modern, massive architectures like ResNets or Transformers.
  • Generalization vs. Complexity: The paper notes a potential trade-off: having too many regions might lead to poor generalization if the network begins to "memorize" individual training points in their own private regions.
  • Region Shape: The authors suggest that the shape and volume of these regions, not just their count, likely play a critical role in how networks learn and generalize—a promising direction for future research.
Figure 7. Scatter plot for the number of linear regions versus train- ing and testing errors on DNNs with minimum width at least 4. The colors follow the same convention used in Figure 6.

Summary updated

BibTeX
@inproceedings{serra2018bounding,
  author = {Thiago Serra and Christian Tjandraatmadja and Srikumar Ramalingam},
  title = {{Bounding and Counting Linear Regions of Deep Neural Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=rJEYd2buZS},
}
Figure