arXiv:2608.25221cs.LGAug 2026

Manuscript Offprint

arXiv:2608.25221

Representing MAX functions using two-hidden-layer ReLU networks

Zhimao Wang, Amitabh Basu

Abstract

We study exact representations of

MAXN(x)=max⁡{x1,⋯ ,xN}\mathrm{MAX}_{N}(x)=\max\{x_{1},\cdots,x_{N}\}

using two-hidden-layer ReLU neural networks. This problem has been studied by several researchers in recent years in an attempt to characterize the exact number of hidden layers required to represent continuous piecewise linear functions. The best lower bound is 2, while the current upper bound is logarithmic in N. It remains completely open if the right answer is a constant number of hidden layers (possibly even 2!) or not. In fact, a recent breakthrough was the representation of MAX₅ as a two-hidden-layer ReLU function which was obtained in [BBH⁺26], and the case of MAXₙ was stated as open for N ≥ 6 in that paper.

Using a careful computer assisted search, we are able to obtain two-hidden-layer ReLU representations of MAX 5_{5}, MAX 6_{6}, MAX 7_{7}, and MAX 8_{8}. We obtain these by considering rational linear combination of terms of the form

max⁡{∑r=1smax⁡(xar,xbr),∑r=1smax⁡(xcr,xdr)},\max\left\{\sum_{r=1}^{s}\max(x_{a_{r}},x_{b_{r}}),\sum_{r=1}^{s}\max(x_{c_{r}},x_{d_{r}})\right\},

where ar,br,cr,dr∈{1,…,N}a_r, b_r, c_r, d_r \in \{1, \ldots, N\}. Each inner maximum of two coordinates can be computed in a first hidden layer, and the outer maximum of the two side-sums can be computed in a second hidden layer. Consequently, every finite linear combination of these terms has a two-hidden-layer ReLU realization. An identity for MAXN\text{MAX}_N in this form therefore gives an exact two-hidden-layer ReLU representation of MAXN\text{MAX}_N.

Very recently, two-hidden-layer representations of MAXNMAX_N of the above form were obtained for all N≤10N \leq 10 in [RAB+26][RAB^{+}26]. Our representations are different and were developed independently. While our techniques share most of the high level ideas presented in [RAB+26][RAB^{+}26], there are also some minor differences which may be of interest for future research on this problem.

1 Introduction

The ReLU activation function is given by

ρ(t):=max⁡{0,t}.\rho(t):=\max\{0,t\}.

A (feedforward) ReLU neural network function is an alternating composition of affine linear maps and coordinatewise application of ρ\rho such that the overall composition begins and ends with affine maps. The number of ρ\rho applications is termed the number of hidden layers of the ReLU neural network. A central question that has been studied for over a decade now is the question of expressivity of such neural networks, i.e., what family of functions can be represented by such neural networks and what

*Department of Applied Mathematics, Johns Hopkins University, zwang539@jh.edu, basu.amitabh@jhu.edu bounds can one provide on the required number of hidden layers and the total number of neurons to such functions. Since ρ\rho is a continuous, piecewise linear function, any ReLU neural network function is continuous and piecewise linear. It was observed in [ABMM18] that every continuous, piecewise linear function on Rn\mathbb{R}^n is a ReLU neural network function with at most ⌈log⁡2(n+1)⌉\lceil \log_2(n+1) \rceil hidden layers. It has been a long standing question if ⌈log⁡2(n+1)⌉\lceil \log_2(n+1) \rceil is required in the worst case, i.e., there exist some continuous piecewise linear functions that cannot be represented with strictly smaller number of hidden layers. While this was shown to be true under integer weight restrictions in [HHL23] and a lower bound of ⌈log⁡3(n)⌉\lceil \log_3(n) \rceil was shown under decimal-fraction weight restrictions [AHM25]. Conditional super-constant lower bounds were established in [GHL26]. A breakthrough was obtained in [BBH +^{+}26] where the authors show that ⌈log⁡3(n−1)⌉+1\lceil \log_3(n-1) \rceil + 1 hidden layers are sufficient if one allows arbitrary real weights. However, the best known general lower bound remains 2; no continuous piecewise linear function is known that requires more than 2 hidden layers.

It has been known for a while [HBSS23] that it is sufficient to focus attention on the function

MAXN(x)=max⁡{x1,…,xN}.\mathrm{MAX}_{N}(x)=\max\{x_{1},\ldots,x_{N}\}.

This is because every continuous piecewise linear function is a linear combination of functions of the form MAXn+1∘ϕ\text{MAX}_{n+1} \circ \phi, where ϕ:Rn→Rn+1\phi : \mathbb{R}^n \to \mathbb{R}^{n+1} is an affine linear function [WS05]. Therefore, the number of hidden layers needed to represent MAXN\text{MAX}_N gives us the number of hidden layers to represent arbitrary continuous piecewise linear functions in Rn\mathbb{R}^n by setting N=n+1N = n + 1. A recent paper [RAB +^+26] obtains two-hidden-layer representations for MAXN\text{MAX}_N for all N≤10N \leq 10. As a corollary, the authors establish the best known upper bound of ⌈log⁡5(n+12)⌉+1\left\lceil \log_5\left(\frac{n+1}{2}\right) \right\rceil + 1 for ReLU neural network representations of continuous piecewise linear functions on Rn\mathbb{R}^n.

The paper [RAB +^{+}26] obtains its representations of MAX N_{N}, N≤10N \leq 10 using a linear combination of terms of the form

max⁡{∑i=1kmax⁡(xai,xbi),∑i=1kmax⁡(xci,xdi)}.(1)\max\left\{\sum_{i=1}^{k}\max(x_{a_{i}},x_{b_{i}}),\sum_{i=1}^{k}\max(x_{c_{i}},x_{d_{i}})\right\}. \tag{1}

We will call such terms as atoms in this paper. For fixed k∈Nk \in \mathbb{N}, we will call them atoms of degree kk. The inner pair maxima can be evaluated in a first hidden ReLU layer, while the outer maximum of the two side-sums can be evaluated in a second hidden layer. Thus every finite signed linear combination of atoms of the form (1) has a two-hidden-layer ReLU realization. The same atom also has a convex-geometric interpretation: each sum is the support function of a zonotope, and the outer maximum is the support function of the convex hull of the two zonotopes. An identity for MAXN\text{MAX}_N in this ansatz therefore gives both an exact network representation and, after clearing denominators, an equality of Minkowski sums of polytopes.

The main challenge is proving that a large signed combination of such atoms agrees with MAXN\text{MAX}_N on all of RN\mathbb{R}^N. An important observation that was made in [RAB+26][\text{RAB}^+26] is that MAXN\text{MAX}_N is invariant with respect to permutations of coordinates. Moreover any particular atom of the form (1) can be transformed into another such atom under permutations of coordinates. More formally, one can consider the group action of the symmetric group ΣN\Sigma_N on the set of atoms of the form (1), for a fixed kk: For any σ∈ΣN\sigma \in \Sigma_N and an atom A(x)=max⁡{∑i=1kmax⁡(xai,xbi),∑i=1kmax⁡(xci,xdi)}\mathcal{A}(x) = \max\left\{\sum_{i=1}^k \max(x_{a_i}, x_{b_i}), \sum_{i=1}^k \max(x_{c_i}, x_{d_i})\right\}, define σA\sigma \mathcal{A} as the atom max⁡{∑i=1kmax⁡(xσ(ai),xσ(bi)),∑i=1kmax⁡(xσ(ci),xσ(di))}\max\left\{\sum_{i=1}^k \max(x_{\sigma(a_i)}, x_{\sigma(b_i)}), \sum_{i=1}^k \max(x_{\sigma(c_i)}, x_{\sigma(d_i)})\right\}.

Thus, any linear combination of atoms of the form (1) such that all atoms in the same orbit under this group action have the same coefficient would give rise to a function that is invariant with respect to coordinate permutations. Consequently, one can try to find such a linear combination that equals MAXNMAX_{N} on the single sorted chamber

C:={x∈RN:x1≥x2≥⋯≥xN}.\mathcal{C}:=\{x\in\mathbb{R}^{N}:x_{1}\geq x_{2}\geq\cdots\geq x_{N}\}.

If equality holds on this sorted chamber, we must have equality over all of RN\mathbb{R}^N by symmetry with respect to permutations; see the discussion in Section 3 and 4 of [RAB+26][RAB^{+}26]. This symmetry helps to reduce the search for such linear combinations. We now formalize this approach.

Definition 1.1. Fix any number k≥1k \geq 1. Define an atom pattern of degree kk to be a list

P=[p1,…,pk∣q1,…,qk],P=[p_{1},\ldots,p_{k}\mid q_{1},\ldots,q_{k}],

where p1,…,pk,q1,…,qk∈{1,…,N}×{1,…,N}p_1, \ldots, p_k, q_1, \ldots, q_k \in \{1, \ldots, N\} \times \{1, \ldots, N\} be ordered pairs (with repetition allowed) of numbers in {1,…,N}\{1, \ldots, N\}. Define the corresponding functions

LP(x)=∑i=1kmpi(x),RP(x)=∑i=1kmqi(x),L_{P}(x)=\sum_{i=1}^{k}m_{p_{i}}(x),\qquad R_{P}(x)=\sum_{i=1}^{k}m_{q_{i}}(x),

where m(a,b)(x)=max⁡{xa,xb}m_{(a,b)}(x) = \max\{x_a, x_b\}. The atom represented by P is then defined as

AP(x)=max⁡{LP(x),RP(x)}\mathcal{A}_{P}(x)=\max\{L_{P}(x),R_{P}(x)\}

For any permutation σ∈ΣN\sigma \in \Sigma_N and any ordered pair (a,b)∈{1,…,N}×{1,…,N}(a, b) \in \{1, \ldots, N\} \times \{1, \ldots, N\}, define σ((a,b))=(σ(a),σ(b))\sigma((a, b)) = (\sigma(a), \sigma(b)). This defines a group action of the symmetric group ΣN\Sigma_N on the set of all atom patterns of degree kk by defining

σP=[σ(p1),…,σ(pk)∣σ(q1),…,σ(qk)].\sigma P=[\sigma(p_{1}),\ldots,\sigma(p_{k})\mid\sigma(q_{1}),\ldots,\sigma(q_{k})].

Lemma 1.2. Fix a natural number k≥1k \geq 1. For any atom pattern PP of degree kk, there exist ηL,ηR∈Z+N\eta_L, \eta_R \in \mathbb{Z}_+^N such that ∥ηL∥1=∥ηR∥1=k\|\eta_L\|_1 = \|\eta_R\|_1 = k such that

AP(x)=max⁡{⟨ηL,x⟩,⟨ηR,x⟩}\mathcal{A}_{P}(x)=\max\{\langle\eta_{L},x\rangle,\langle\eta_{R},x\rangle\}

for all x∈Cx \in \mathcal{C}. ηL\eta_L and ηR\eta_R are given by the closed-form formulas:

(ηL)i=∑j=1k1min⁡(pj)=i∀i=1,…,N,(\eta_{L})_{i}=\sum_{j=1}^{k}\mathbf{1}_{\min(p_{j})=i}\qquad\forall i=1,\ldots,N, (ηR)i=∑j=1k1min⁡(qj)=i∀i=1,…,N,(\eta_{R})_{i}=\sum_{j=1}^{k}\mathbf{1}_{\min(q_{j})=i}\qquad\forall i=1,\ldots,N,

where min⁡(pj)\min(p_j) and min⁡(qj)\min(q_j) denote the minimum of the pair of numbers in pjp_j and qjq_j, respectively.

Proof. Write pj=(aj,bj)p_j = (a_j, b_j) and qj=(cj,dj)q_j = (c_j, d_j). Since x∈Cx \in \mathcal{C} has ordered coordinates,

max⁡{xaj,xbj}=xmin⁡{aj,bj}=xmin⁡(pj),\max\{x_{a_{j}},x_{b_{j}}\}=x_{\min\{a_{j},b_{j}\}}=x_{\min(p_{j})},

and similarly max⁡{xcj,xdj}=xmin⁡(qj)\max\{x_{c_j}, x_{d_j}\} = x_{\min(q_j)}. Hence

∑j=1kmax⁡{xaj,xbj}=∑j=1kxmin⁡(pj)=∑j=1k∑i=1N1min⁡(pj)=ixi=∑i=1N(∑j=1k1min⁡(pj)=i)xi=⟨ηL,x⟩,\sum_{j=1}^{k}\max\{x_{a_{j}},x_{b_{j}}\}=\sum_{j=1}^{k}x_{\min(p_{j})}=\sum_{j=1}^{k}\sum_{i=1}^{N}\mathbf{1}_{\min(p_{j})=i}x_{i}=\sum_{i=1}^{N}\left(\sum_{j=1}^{k}\mathbf{1}_{\min(p_{j})=i}\right)x_{i}=\langle\eta_{L},x\rangle,

and analogously the right side-sum equals ⟨ηR,x⟩\langle\eta_{R},x\rangle. Taking the outer maximum gives

AP(x)=max⁡{⟨ηL,x⟩,⟨ηR,x⟩}.\mathcal{A}_{P}(x)=\max\{\langle\eta_{L},x\rangle,\langle\eta_{R},x\rangle\}.

Finally, for each jj, exactly one indicator 1min⁡(pj)=i\mathbf{1}_{\min(p_j)=i} is equal to 1 as ii ranges from 1 to NN. Hence the sum of the entries of ηL\eta_L is kk, and similarly for ηR\eta_R. Since these vectors have nonnegative entries, ∥ηL∥1=∥ηR∥1=k\|\eta_L\|_1 = \|\eta_R\|_1 = k.