cs.CCMay 22, 2025

The Computational Complexity of Counting Linear Regions in ReLU Neural Networks

Authors: Moritz Stargalla, Christoph Hertrich, Daniel Reichman

Organizations: University of Technology Nuremberg · Worcester Polytechnic Institute

Abstract

An established measure of the expressive power of a given ReLU neural network is the number of linear regions into which it partitions the input space. There exist many different, non-equivalent definitions of what a linear region actually is. We systematically assess which papers use which definitions and discuss how they relate to each other. We then analyze the computational complexity of counting the number of such regions for the various definitions. Generally, this turns out to be an intractable problem. We prove NP- and #P-hardness results already for networks with one hidden layer and strong hardness of approximation results for two or more hidden layers. Finally, on the algorithmic side, we demonstrate that counting linear regions can at least be achieved in polynomial space for some common definitions.

Figures & tables

Explore similar work

Oct 8, 2026

NP-Hardness of Minimizing Neurons in Two-Hidden-Layer ReLU Neural Networks

A fundamental question in neural network architecture optimization is whether the minimum hidden-neuron count required to approximate a target function within a prescribed tolerance can be computed efficiently. This paper resolves this question for two-hidden-layer ReLU networks under an Lp(Rd,Rm)L^p(\mathbb{R}^d,\mathbb{R}^m) approximation constraint. For every fixed d≥1d \ge 1, m≥1m \ge 1, and 1≤p<∞1 \le p < \infty, we prove that computing the optimum exactly is NP-hard. The result holds even when the target is represented by a rational ReLU network whose realization is nonzero, componentwise nonnegative, compactly supported, globally Lipschitz, and continuous piecewise affine. The polynomial-time reduction from 3-SAT produces an architecture gap in which unsatisfiable formulas yield an optimum of zero, whereas satisfiable formulas yield an optimum of at least d+2d+2. The proof constructs compactly supported polyhedral frustum functions realized by two-hidden-layer ReLU networks and establishes the LpL^p-density of finite linear combinations of box-frustum functions. The results offer theoretical justification for employing heuristic approximation methods in the design of ReLU neural networks, illustrating that attaining a minimal configuration within polynomial time is computationally unachievable.
Jun 5, 2026

Characterizing the Discrete Geometry of ReLU Networks

It is well established that ReLU networks define continuous piecewise-linear functions, and that their linear regions are polyhedra in the input space. These regions form a complex that fully partitions the input space. The way these regions fit together is fundamental to the behavior of the network, as nonlinearities occur only at the boundaries where these regions connect. However, relatively little is known about the geometry of these complexes beyond bounds on the total number of regions, and calculating the complex exactly is intractable for most networks. In this work, we prove new theoretical results about these complexes that hold for all fully-connected ReLU networks, specifically about their connectivity graphs in which nodes correspond to regions and edges exist between each pair of regions connected by a face. We find that the average degree of this graph is upper bounded by twice the input dimension regardless of the width and depth of the network, and that the diameter of this graph has an upper bound that does not depend on input dimension, despite the number of regions increasing exponentially with input dimension. We corroborate our findings through experiments with networks trained on both synthetic and real-world data, which provide additional insight into the geometry of ReLU networks. Code to reproduce our results can be found at https://github.com/bl-ake/ICLR-2026.
Jul 22, 2026

Shallower ReLU Network Representations via Exact Linear Algebra

We study the depth required by ReLU networks to exactly represent piecewise linear functions, focusing specifically on the maximum function. This problem has recently received significant attention in both the ML and TCS literature. We prove that max⁡n(x)=max⁡{x1,…,xn}\max_n(x)=\max\{x_1,\ldots,x_n\} is exactly representable with two hidden layers for every n≤12n\leq 12. Previously, this was only known up to n≤5n\leq5 [Bakaev, Brunck, Hertrich, Stade, Yehudayoff, STOC'26]. We obtain our constructions through an exact computer-assisted search within a space of candidate solutions: After a symmetry reduction, we obtain a finite system of linear equations over Q\mathbb{Q} such that any solution yields a valid representation of the maximum function. The resulting constructions have a structured first hidden layer, which enables recursive substitution into deeper networks. This yields an exact ReLU representation of max⁡n\max_n with at most ⌈log⁡6(n/2)⌉+1\lceil \log_6(n/2) \rceil+1 hidden layers. Consequently, every continuous piecewise-linear function on Rd\mathbb{R}^d admits an exact representation with at most ⌈log⁡6((d+1)/2)⌉+1\lceil\log_6((d+1)/2)\rceil+1 hidden layers; in particular, two hidden layers suffice for d≤11d\leq 11. Again, these results improve upon [Bakaev, Brunck, Hertrich, Stade, Yehudayoff, STOC'26], who proved analogous logarithmic bounds with base three.