cs.LGOct 8, 2026

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

Authors: Sangrock Lee

Organizations: FAMU–FSU College of Engineering, Florida State University, Tallahassee, FL, 32310

Abstract

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.

Figures & tables

Explore similar work

Sep 26, 2025cs.CC

Parameterized Hardness of Zonotope Containment and Neural Network Verification

Neural networks with ReLU activations are a widely used model in machine learning. It is thus important to have a profound understanding of the properties of the functions computed by such networks. Recently, there has been increasing interest in the (parameterized) computational complexity of determining these properties. In this work, we close several gaps and resolve an open problem posed by Froese et al. [COLT '25] regarding the parameterized complexity of various problems related to network verification. In particular, we prove that, for all ℓ≥2\ell\ge 2, deciding positivity (and thus surjectivity) of a function f:Rd→Rf:\mathbb{R}^d\to\mathbb{R} computed by an ℓ\ell-layer ReLU network is W[ℓ−1\ell-1]-hard when parameterized by the input dimension dd. The case ℓ=2\ell=2 implies that zonotope non-containment (a problem that is of independent interest in computational geometry, control theory, and robotics) is W[1]-hard with respect to the ambient dimension dd. Moreover, we show that approximating the maximum within any multiplicative factor and computing the LpL_p-Lipschitz constant for p∈(0,∞]p\in(0,\infty] in ℓ\ell-layer networks is NP-hard and W[ℓ−1\ell-1]-hard with respect to dd. For ℓ≥3\ell\ge 3, approximating the LpL_p-Lipschitz constant is NP- and W[ℓ−2\ell-2]-hard. We further show that the above problems are NP- and W[tt]-hard (for all t≥1t\ge 1) with respect to ℓ\ell for constant dd. Notably, our hardness results imply that the naive enumeration-based methods for these fundamental problems running in n(ℓ−1)d⋅poly⁡(N)n^{(\ell-1) d}\cdot\operatorname{poly}(N) time are all essentially optimal under the Exponential Time Hypothesis.
Jul 22, 2026cs.LG

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.
Aug 24, 2026cs.LG

Every Layer Counts: An Exponential L2L_2 Depth Hierarchy for ReLU Networks

We prove a depth hierarchy for ReLU neural networks in which every additional ReLU layer can save exponentially many neurons. For all k≥2k\geq2, we construct a globally [0,1][0,1]-valued, 11-Lipschitz function realized by a depth-(k+1)(k+1) network of width O(d4)\mathcal{O}(d^4), whereas any depth-kk network with unrestricted weights and width at most 2d2d(k−1)\frac{2^d}{2d(k-1)} has squared L2L_2 error at least 1/241/24 under an absolutely continuous distribution supported at exponential distance from the origin. To the best of our knowledge, this is the first exponential hierarchy across all adjacent fixed depths, and the first exponential separation for ReLU networks between two fixed depths whose shallower network has depth at least 33. The lower bound also immediately yields the corresponding hierarchy for exact computation. Moreover, the case k=2k=2 gives a compactly supported separation between depths 33 and 22 with unrestricted shallow-network weights, answering a question raised by Safran, Eldan, and Shamir (2019). The distribution used in our construction nevertheless has all its mass at exponential radius, placing the hierarchy outside the regularity regime in which such a separation would imply major threshold-circuit lower bounds. We also prove an exact separation for a more regular target, which is globally [0,1][0,1]-valued and O(d)\mathcal{O}(\sqrt d)-Lipschitz and maps the unit hypercube onto [0,1][0,1]. It is computed by a polynomial-width depth-44 network, whereas any depth-33 network agreeing with it on the unit hypercube requires exponentially many first-layer neurons, even with unrestricted weights.