cs.LGOct 19, 2026
SaveTwo hidden layer suffice: the caterpillar net
Organizations: FU Berlin · TU Berlin
Abstract
Every continuous piecewise linear (CPWL) function is a finite signed sum of maxima of affine functions, making maximum representation a central problem in the study of the expressiveness of ReLU networks. A now-disproved conjecture predicted logarithmic depth for maxima. Inspired by the proof by Brunck et al. (2026) that two hidden layers suffice for general CPWL functions, we give the Caterpillar Net, a nonrecursive construction for the maximum of inputs with two hidden layers of widths and . The construction has a direct geometric interpretation.
Figures & tables
Figure 1: A labelled caterpillar with and . The spine has two leaves at each vertex; all arrows point from parent to child. The apex is separate from the tree. The last spine position is , so the head function is .
More in this topic
ReLU Neural Networks
Rectified linear unit (ReLU) neural networks use piecewise-linear activations to study approximation, learning dynamics, expressivity, and verification.
See all 113 papersWe 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 is exactly representable with two hidden layers for every . Previously, this was only known up to [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 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 with at most hidden layers. Consequently, every continuous piecewise-linear function on admits an exact representation with at most hidden layers; in particular, two hidden layers suffice for . Again, these results improve upon [Bakaev, Brunck, Hertrich, Stade, Yehudayoff, STOC'26], who proved analogous logarithmic bounds with base three.
Representing MAX functions using two-hidden-layer ReLU networks
We study exact representations of using two-hidden-layer ReLU neural networks. This problem has been studied 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 . 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 as a two-hidden-layer ReLU function obtained in [Bakaev et al., 2026], and the case of was stated as open for in that paper. Using a careful computer assisted search, we obtain two-hidden-layer ReLU representations of , and . We obtain these by considering rational linear combinations of terms of the form , where . 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 in this form therefore gives an exact two-hidden-layer ReLU representation of . Very recently, two-hidden-layer representations of of the above form were obtained for all in [Ruess et al., 2026]. Our representations are different and were developed independently. While our techniques share most of the high-level ideas presented in [Ruess et al., 2026], there are also some minor differences which may be of interest for future research on this problem.
A Hand-Checkable Proof That Two Hidden ReLU Layers Compute the Maximum of Six Numbers
Exactly computing the maximum function is a standard test case for studying depth in ReLU networks. Two hidden layers are known to suffice for up to twelve inputs through computer-assisted constructions. For six real inputs, we give an explicit hexagon identity whose local structure yields a self-contained analytical proof of this depth bound. The identity was found by computer-assisted search; we prove it through explicit cancellations that can be checked entirely by hand, without executing a verification program. The identity also yields an explicit network with hidden widths and , zero biases, and rational weights.