Benefits of depth in neural networks
Matus Telgarsky
Setting and main results
A neural network is a model of real-valued computation defined by a connected directed graph as follows. Nodes await real numbers on their incoming edges, thereafter computing a function of these reals and transmitting it along their outgoing edges. Root nodes apply their computation to a vector provided as input to the network, whereas internal nodes apply their computation to the output of other nodes. Different nodes may compute different functions, two common choices being the maximization gate (where is the vector of values on incoming edges), and the standard ReLU gate where is called the ReLU (rectified linear unit), and the parameters and may vary from node to node. Graphs in the present work are acyclic, and there is exactly one node with no outgoing edges whose computation is the output of the network.
Neural networks distinguish themselves from many other function classes used in machine learning by possessing multiple layers, meaning the output is the result of composing together an arbitrary number of (potentially complicated) nonlinear operations; by contrast, the functions computed by boosted decision stumps and SVMs can be written as neural networks with a constant number of layers.
The purpose of the present work is to show that standard types of networks always gain in representation power with the addition of layers. Concretely: it is shown that for every positive integer , there exist neural networks with layers, nodes per layer, and distinct parameters which can not be approximated by networks with layers and nodes.
Before stating the main result, a few choices and pieces of notation deserve explanation. First, the target many-layered function uses standard ReLU gates; this is by no means necessary, and a more general statement can be found in Theorem 3.19. Secondly, the notion of approximation is the distance: given two functions and , their pointwise disagreement is averaged over the cube . Here as well, the same proofs allow flexibility (cf. Theorem 3.19). Lastly, the shallower networks used for approximation use semi-algebraic gates, which generalize the earlier maximization and standard ReLU gates, and allow for analysis of not just standard networks with ReLU gates, but convolutional networks with ReLU and maximization gates (Krizhevsky et al., 2012), sum-product networks (where nodes compute polynomials) (Poon and Domingos, 2011), and boosted decision trees; the full definition of semi-algebraic gates appears in Section 2.
where is the union of the following two sets of functions.
Functions computed by networks of -semi-algebraic gates in layers and nodes. (E.g., as with standard ReLU networks or with convolutional neural networks with standard ReLU and maximization gates; cf. Section 2.)
Functions computed by linear combinations of decision trees each with nodes. (E.g., the function class used by boosted decision trees; cf. Section 2.)
Analogs to Theorem 1.1 for boolean circuits — which have boolean inputs routed through gates — have been studied extensively by the circuit complexity community, where they are called depth hierarchy theorems. The seminal result, due to Håstad (1986), establishes the inapproximability of the parity function by shallow circuits (unless their size is exponential). Standard neural networks appear to have received less study; closest to the present work is an investigation by Eldan and Shamir (2015) analyzing the case when the dimension is large, showing an exponential separation between 2- and 3-layer networks, a regime not handled by Theorem 1.1. Further bibliographic notes and open problems may be found in Section 5.
The proof of Theorem 1.1 (and of the more general Theorem 3.19) occupies Section 3. The key idea is that just a few function compositions (layers) suffice to construct a highly oscillatory function, whereas function addition (adding nodes but keeping depth fixed) gives a function with few oscillations. Thereafter, an elementary counting argument suffices to show that low-oscillation functions can not approximate high-oscillation functions.
2 Companion results
Theorem 1.1 only provides the existence of one network (for each ) which can not be approximated by a network with many fewer layers. It is natural to wonder if there are many such special functions. The following bound indicates their population is in fact quite modest.
Specifically, the construction behind Theorem 1.1, as elaborated in Theorem 3.19, can be seen as exhibiting points, and a fixed labeling of these points, upon which a shallow network hardly improves upon random guessing. The forthcoming Theorem 1.2 similarly shows that even on the more simpler task of fitting points, the earlier class of networks is useless on most random labellings.
Let any neural net graph be given with parameters in layers and total -semi-algebraic nodes. Then for any and any points , with probability over uniform random labels ,
This proof is a direct corollary of the VC dimension of semi-algebraic networks, which in turn can be proved by a small modification of the VC dimension proof for piecewise polynomial networks (Anthony and Bartlett, 1999, Theorem 8.8). Moreover, the core methodology for VC dimension bounds of neural networks is due to Warren, whose goal was an analog of Theorem 1.2 for polynomials (Warren, 1968, Theorem 7).
Let any neural net graph be given with parameters in layers and total nodes, each of which is -semi-algebraic. Then
The proof of Theorem 1.2 and Lemma 1.3 may be found in Section 4. The argument for the VC dimension is very close to the argument for Theorem 1.1 that a network with few layers has few oscillations; see Section 4 for further discussion of this relationship.
Semi-algebraic gates and assorted network notation
The definition of a semi-algebraic gate is unfortunately complicated; it is designed to capture a few standard nodes in a single abstraction without degrading the bounds. Note that the name semi-algebraic set is standard (Bochnak et al., 1998, Definition 2.1.4), and refers to a set defined by unions and intersections of polynomial inequalities (and thus the name is somewhat abused here).
A notable trait of the definition is that the number of terms does not need to enter the name as it does not affect any of the complexity estimates herein (e.g., Theorem 1.1 or Theorem 1.2).
Given polynomials of degree , the standard -min and -max gates and are -sa.
Every -dt is -sa, and every -bdt is .
The proof of Lemma 2.3 is mostly a matter of unwrapping definitions, and is deferred to Appendix A. Perhaps the only interesting encoding is for the maximization gate (and similarly the minimization gate), which uses .
Some of the results, for instance Theorem 1.1 and its generalization Theorem 3.19, will let not only the parameters but also network graph vary. Let denote a network where layer has nodes where each is -sa and the input has dimension . As a simplification, let denote networks of -sa gates in layers (not including layer 0) each with nodes. There are various empirical prescriptions on how to vary the number of nodes per layer; for instance, convolutional networks typically have an increase between layer 0 and layer 1, followed by exponential decrease for a few layers, and finally a few layers with the same number of nodes (Fukushima, 1980; LeCun et al., 1998; Krizhevsky et al., 2012).
Benefits of depth
The purpose of this section is to prove Theorem 1.1 and its generalization Theorem 3.19 in the following three steps.
Functions with few oscillations poorly approximate functions with many oscillations.
Functions computed by networks with few layers must have few oscillations.
Functions computed by networks with many layers can have many oscillations.
To control this expression, note that every is disjoint, however can be smaller than : in particular, it misses intervals whose interior intersects with the boundary of an interval in . Since there are at most such boundaries,
which rearranges to gives . Combining this with eq. 3.1,
2 Few layers, few oscillations
Before giving the central upper bounds and sketching their proofs, notice by analogy to polynomials how compositions and additions vary in their impact upon oscillations. By adding together two polynomials, the resulting polynomial has at most twice as many terms and does not exceed the maximum degree of either polynomial. On the other hand, composing polynomials, the result has the product of the degrees and can have more than the product of the terms. As both of these can impact the number of roots or crossings (e.g., by the Bezout Theorem or Descartes’ Rule of Signs), composition wins the race to higher oscillations.
Suppose with . Setting , , , then .
Lemma 3.3 shows the key tradeoff: the number of layers is in the exponent, while the number of nodes is in the base.
Rather than directly controlling , the proofs will first show is -poly, which immediately bounds as follows.
A second technical lemma is needed to reason about combinations of partitions defined by -sa and -poly functions.
The proof is somewhat painful owing to the fact that there is no convention on the structure of the intervals in the partitions, namely which ends are closed and which are open, and is thus deferred to Appendix A. The principle of the proof is elementary, and is depicted at right: given a collection of partitions, an intersection of constituent intervals must share endpoints with intervals in in the intersection, thus the total number of intervals bounds the total number of possible intersections. Arguably, this failure to increase complexity in the face of arbitrary intersections is why semi-algebraic gates do not care about the number of terms in their definition.
Recall that -sa means there is a set of polynomials of degree at most which form the regions defining the function by intersecting simpler regions and . As such, in order to analyze semi-algebraic gates composed with piecewise polynomial gates, consider first the behavior of these predicate polynomials.
This gives the following complexity bound for composing -sa and -poly gates.
The proof of Lemma 3.3 now follows by Lemma 3.9. In particular, for semi-algebraic networks, the proof is an induction over layers, establishing node is -poly (for appropriate ).
3 Many layers, many oscillations
The idea behind this construction is as follows. Consider any continuous function which is a generalization of a triangle wave with a single peak: , and there is some with , and additionally strictly increases along and strictly decreases along .
Now consider the effect of the composition . Along , this is a stretched copy of , since and moreover is a bijection between and $[0,a]f^{2}[a,1]f^{2}f^{k}2^{k-1}$ peaks; the following definition and lemmas formalize this reasoning.
is -triangle when it is continuous along , and may be divided into intervals with and , whenever , , , is strictly increasing along odd-numbered intervals (those starting from with odd), and strictly decreasing along even-numbered intervals.
If is -triangle and is -triangle, then is -triangle.
Since and and are continuous along $f\circ g(a_{1},\ldots,a_{2s+1})(c_{1},\ldots,c_{2t+1})fg$.
Now consider any interval where is odd, meaning the restriction of to is strictly increasing. It will be shown that is -triangle, and an analogous proof holds for the strictly decreasing restriction , whereby it follows that is by considering all choices of .
To this end, note for any that exists and is unique, thus set . By this choice, for odd it holds that and is strictly increasing along (since is strictly increasing everywhere and is strictly increasing along ), and similarly even has and is strictly decreasing along .
If is -triangle with distinct parameters, then is -triangle with distinct parameters and .
It suffices to perform applications of Lemma 3.12.
Next, note the following examples of triangle functions.
The following functions are -triangle.
.
.
. Cf. Schmitt (2000).
Set (cf. Lemma 3.16). Let real and positive integer be given, and choose the unique nonnegative integer and real so that . Then
4 Proof of Theorem 1.1
The proof of Theorem 1.1 now follows: Lemma 3.17 shows that a many-layered ReLU network can give rise to a highly oscillatory and regular function , Lemma 3.3 shows that few-layered networks and (boosted) decision trees give rise to functions with few oscillations, and lastly Lemma 3.1 shows how to combine these into an inapproximability result.
Using nearly the same proof, but giving up on continuous uniform measure, it is possible to handle other distances and more flexible target functions.
Limitations of depth
Theorem 3.19 can be taken to say: there exists a labeling of points which is realizable by a network of depth and size , but can not be approximated by networks with depth and size . On the other hand, this section will sketch the proof of Theorem 1.2, which implies that these depth networks realize relatively few different labellings. The proof is a quick consequence of the VC dimension of semi-algebraic networks (cf. Lemma 1.3) and the following fact, where is used to denote the growth function (Anthony and Bartlett, 1999, Chapter 3).
Let any function class and any distinct points be given. Then with probability at least over a uniform random draw of labels (with ),
The proof of the preceding result is similar to proofs of the Gilbert-Varshamov packing bound via Hoeffding’s inequality (Duchi, 2016, Lemma 13.5). Note that a similar result was used by Warren to prove rates of approximation of continuous functions by polynomials, but without invoking Hoeffding’s inequality (Warren, 1968, Theorem 7).
The remaining task is to control the VC dimension of semi-algebraic networks. To this end, note the following generalization of Lemma 1.3, which further provides that semi-algebraic networks compute functions which are polynomial when restricted to certain polynomial regions.
Let neural network graph be given with parameters, layers, and total nodes, and suppose every gate is -sa. Then
The proof follows the same basic structure of the VC bound for networks with piecewise polynomial activation functions (Anthony and Bartlett, 1999, Theorem 8.8). The slightly modified proof here is also very similar to the proof of Lemma 3.3, performing an induction up through the layers of the network, arguing that each node computes a polynomial after restricting attention to some range of parameters. The proof of Lemma 4.2 manages to be multivariate (unlike Lemma 3.3), though this requires arguments due to Warren (1968) which are significantly more complicated than those of Lemma 3.3 (without leading to a strengthening of Theorem 1.1).
One minor departure from the VC dimension proof of piecewise polynomial networks (cf. (Anthony and Bartlett, 1999, Theorem 8.8)) is the following lemma, which is used to track the number of regions with the more complicated semi-algebraic networks. Despite this generalization, the VC dimension bound is basically the same as for piecewise polynomial networks.
Bibliographic notes and open problems
Arguably the first approximation theorem of a big class by a smaller one is the Weierstrass Approximation Theorem, which states that polynomials uniformly approximate continuous functions over compact sets (Weierstrass, 1885). Refining this, Kolmogorov (1936) gave a bound on how well subspaces of functions can approximate continuous functions, and Vitushkin (1955, 1959) showed a similar bound for approximation by polynomials in terms of the polynomial degrees, dimension, and modulus of continuity of the target function. Warren (1968) then gave an alternate proof and generalization of this result, in the process effectively proving the VC dimension of polynomials (developing tools still used to prove the VC dimension of neural networks (Anthony and Bartlett, 1999, Chapters 7-8)), and producing an analog to Theorem 1.2 for polynomials.
The preceding results, however, focused on separating large classes (e.g., continuous functions of bounded modulus) from small classes (polynomials of bounded degree). Aiming to refine this, depth hierarchy theorems in circuit complexity separated circuits of a certain depth from circuits of a slightly smaller depth. As mentioned in Section 1, the seminal result here is due to Håstad (1986). For architectures closer to neural networks, sum-product networks (summation and product nodes) have been analyzed by Bengio and Delalleau (2011) and more recently Martens and Medabalimi (2015), and networks of linear threshold functions in 2 and 3 layers by Kane and Williams (2015); note that both polynomial gates (as in sum-product networks) and linear threshold gates are semi-algebraic gates. Most closely to the present work (excluding (Telgarsky, 2015), which is a vastly simplified account), Eldan and Shamir (2015) analyze 2- and 3-layer networks with general activation functions composed with affine mappings, showing separations which are exponential in the input dimension. Due to this result and also recent advances in circuit complexity (Rossman et al., 2015), it is natural to suppose Theorem 1.1 can be strengthened to separating and layer networks when dimension is large; however, none of the earlier works give a tight sense of the behavior as .
The triangle wave target functions considered here (e.g., cf. Lemma 3.16) have appeared in various forms throughout the literature. General properties of piecewise affine highly oscillating functions were investigated by Szymanski and McCane (2014) and Montúfar et al. (2014). Also, Schmitt (2000) investigated the map (as in Lemma 3.16) to show that sigmoidal networks can not approximate high degree polynomials via an analysis similar to the one here, however looseness in the VC bounds for sigmoidal networks prevented exponential separations and depth hierarchies.
A tantalizing direction for future work is to characterize not just one difficult function (e.g., triangle functions as in Lemma 3.16), but many, or even all functions which are not well-approximated by smaller depths. Arguably, this direction could have value in machine learning, as discovery of such underlying structure could lead to algorithms to recover it. As a trivial example of the sort of structure which could arise, considering the following proposition, stating that any symmetric signal may be repeated by pre-composing it with the ReLU triangle function.
Set (cf. Lemma 3.16), and let any be given with . Then satisfies for every real and integer ; in other words, is repetitions of with graph scaled horizontally and uniformly to fit within .
The author is indebted to Joshua Zahl for help navigating semi-algebraic geometry and for a simplification of the multivariate case in Theorem 1.1, and to Rastislav Telgársky for an introduction to this general topic via Kolmogorov’s Superposition Theorem (Kolmogorov, 1957). The author further thanks Jacob Abernethy, Peter Bartlett, Sébastien Bubeck, and Alex Kulesza for valuable discussions.
References
Appendix A Deferred proofs
This appendix collects various proofs omitted from the main text.
The following mechanical proof shows that standard piecewise polynomial gates, maximization/minimization gates, and decision trees are all semi-algebraic gates.
Since , it suffices to handle the maximum case, which has the form
Constructing polynomials when and when , it follows that is -sa.
First consider a -dt , wherein the proof follows by induction on tree size. In the base case , is constant. Otherwise, there exist functions and which are respectively - and -dt with , and additionally an affine function so that
where the last step expanded the semi-algebraic forms of and . As such, by combining the sets of predicate polynomials for and together with (where the former two have cardinalities and by the inductive hypothesis), and unioning together the triples for and but extending the triples to include for triples in and for triples in , it follows by construction that is -semi-algebraic.
Now consider a -bdt . By the preceding expansion, each individual tree is -sa, thus their sum is by unioning together the sets of polynomials, triples, and adding together the expansions.
A.2 Deferred proofs from Section 3
The first proof shows that a collection of partitions may be refined into a single partition whose size is at most the total number of intervals across all partitions. As discussed in the text, while the proof has a simple idea (one need only consider boundaries of intervals across all partitions), it is somewhat painful since there is not consistent rule for whether specific endpoints endpoints of intervals are open or closed.
Consider the case that each partition which contains the boundary point has exactly two intervals meeting at and moreover the closedness properties are the same, meaning either is contained in the interval which ends at , or it is contained in the interval which starts at . In this case, partition into two intervals so that the treatment of the boundary is the same as those ’s with a boundary at .
Otherwise, it is either the case that some have contained in the interval ending at whereas others have it contained in the interval starting at , or simply some have three intervals meeting at : namely, the singleton interval as well as two intervals not containing . In this case, partition into three intervals: one ending at (but not containing it), the singleton interval , and an interval starting at (but not containing it).
(These cases may also be described in a unified way: consider all intervals of which have as an endpoint, extend such intervals of positive length to have infinite length while keeping endpoint and the side it falls on, and then refine by intersecting it with all of these intervals, which as above results in either 2 or 3 intervals.)
Note that the construction never introduces more intervals at a boundary point than exist in , thus .
It remains to be shown that a union of intersections of elements of is a union of elements of . Note that it suffices to show that intersections of elements of are unions of elements of , since thereafter these encodings can be used to express unions of intersections of as unions of . As such, consider any intersection of elements of ; there is nothing to show if is empty, thus suppose it is nonempty. In this case, it must also be an interval (e.g., since intersections of convex sets are convex), and its endpoints must coincide with endpoints of . Moreover, if the left endpoint of is open, then must be formed from an intersection which includes an interval with the same open left endpoint, thus there exists such an interval in , and by the above construction of , there also exists an interval with such an open left endpoint in ; the same argument similarly handles the case of closed left endpoints, as well as open and closed right endpoints, namely giving elements in which match these traits. Let and denote these endpoints. By the above construction of , intervals with endpoints for will be included in , and since is a partition, the union of these elements will be exactly . Since was an arbitrary intersection of elements of , the proof is complete.
Next, the tools of Section 3.2 (culminating in the composition rule for semi-algebraic gates (Lemma 3.9)) are used to show crossing number bounds on semi-algebraic networks and boosted decision trees.
This proof first shows is -poly, and then relaxes this expression and applies Lemma 3.4 to obtain the desired bound.
First consider the case and is the identity map, thus . For convenience, set
The proof proceeds by induction on the layers of , showing that each node in layer is -poly.
For convenience, first consider layer of the inputs themselves: here, node outputs the coordinate of the input, and is thus affine and -poly. Next consider layer , where the inductive hypothesis grants that each node in layer is -poly. Consequently, since any node in layer is -sa, Lemma 3.9 grants it is also -poly as desired (since ).
Lastly, the simplified terms give is -poly. Since is strictly increasing and concave and ,
It follows that is -poly, whereby the crossing number bound follows by Lemma 3.4.
Next, elementary computations verify that the three functions listed in Lemma 3.16 are indeed -triangle.
By inspection, and . Moreover, for , meaning is increasing, and means , meaning is decreasing. Lastly, the properties of follow since .
By inspection, and . Moreover is a quadratic, thus can cross 0 at most twice, and moreover is the unique critical point (since has degree 1), thus is increasing on and decreasing on .
In the case of the ReLU -triangle function given in Lemma 3.16, the exact form of may be established as follows. (Recall that this refined form allows for the use of Lebesgue measure in Theorem 1.1, and also the repetition statement in Proposition 5.1.)
(of Lemma 3.17) The proof proceeds by induction on the number of compositions . For the base case ,
For the inductive step, first note for any , by symmetry of around 1/2 (i.e., by the inductive hypothesis), and by the above explicit form of ,
meaning the case is implied by the case . Since the unique nonnegative integer and real satisfy , the inductive hypothesis grants
The proof of the slightly more general form of Theorem 1.1 is as follows; it does not quite imply Theorem 1.1, since the constructed measure is not the Lebesgue measure even for the ReLU-based -triangle function from Lemma 3.16.
Since and , then taking to denote the intervals of sorted by their left endpoint, for . By Lemma 3.1,
Construct the continuous measure as follows, starting with the construction of a univariate measure . Since is continuous, there exists a so that for any and with . As such, let denote the probability measure which places half of its mass uniformly on these balls of radius (which must be disjoint since alternates between 0 and 1 along ), and half of its mass uniformly on the remaining subset of $\mu^{d}\mu\mu_{0}\mu_{1}^{d-1}$. Now consider the two types of distances.
As a closing curiosity, Theorem 3.19 implies the following statement regarding polynomials.
A.3 Deferred proofs from Section 4
First, the proof of a certain VC lower bound which mimics the Gilbert-Varshamov bound; the proof is little more than a consequence of Hoeffding’s inequality.
(of Lemma 4.1) For convenience, set , and let denote these dichotomies (meaning ), and with foresight set . Let denote fair Bernoulli random labellings for each point, and note by symmetry of the fair coin that for any fixed dichotomy ,
Consequently, by a union bound over all dichotomies and lastly by Hoeffding’s inequality,
where the last step used the choice of .
The remaining deferred proofs do not exactly follow the order of Section 4, but instead the order of dependencies in the proofs. In particular, to control the VC dimension, first it is useful to prove Lemma 4.3, which is used to control the growth of numbers of regions as semi-algebraic gates are combined.
Additionally consider the set of sign patterns
Distinct elements of correspond to distinct sign patterns in : namely, for any , using the ordering of to encode and as binary vectors of length , the corresponding interleaved binary vector of length is distinct for distinct choices of . (For each that appears in neither nor , there two possible encodings in : having both coordinates corresponding to set to 1, and having them set to 0. On the other hand, a more succinct encoding based just on fails to capture those sets arising from intersections of proper subsets of .) As such, making use of growth function bounds for sets of polynomials (Anthony and Bartlett, 1999, Theorem 8.3),
Thanks to Lemma 4.3, the proof of the VC dimension bound Lemma 4.2 follows by induction over layers, effectively keeping track of a piecewise (regionwise?) polynomial function as with the proof of Lemma 3.3 (but now in the multivariate case).
(of Lemma 4.2) First note that this proof follows the scheme of a VC dimension proof for networks with piecewise polynomial activation functions (Anthony and Bartlett, 1999, Theorem 8.8), but with Lemma 4.3 allowing for the more complicated semi-algebraic gates, and some additional bookkeeping for the (semi-algebraic) shapes of the regions of the partition .
For the inductive step, consider some layer . Restricted to any , the nodes of the previous layer compute fixed polynomials of degree . Each node in layer is -sa, meaning there are predicates, defined by polynomials of degree , which define regions wherein this node is a fixed polynomial. Let denote this set of predicates, where by considering the possible input examples and the possible predicates encountered in each of the nodes in layer , and set By the definition of semi-algebraic gate, each node in layer computes a fixed polynomial when restricted to a region defined by an intersection of predicates which moreover are defined by . As such, defining as the refinement of which partitions each according to the intersections of predicates encountered in each node, then Lemma 4.3 on each grants
which completes the inductive construction.
The upper bound on may now be estimated. First, may be upper bounded by applying eq. A.2 recursively:
To compute , it suffices to find such that , which in turn is implied by . Since and , it suffices to show
As such, the left hand side of this expression is an upper bound on .
The proofs of Lemma 1.3 and Theorem 1.2 from Section 1 are now direct from Lemma 4.2 and Lemma 4.1.
(of Lemma 1.3) This statement is the same as Lemma 4.2 with some details removed.
(of Theorem 1.2) By the bound on from Lemma 4.2,
The result follows by plugging this into Lemma 4.1.
A.4 Deferred proofs from Section 5
(of Proposition 5.1) Immediate from Lemma 3.17.