Approximating Continuous Functions by ReLU Nets of Minimal Width

Boris Hanin, Mark Sellke

Introduction

Over the past several years, artificial neural networks, especially deep networks, have become the state of the art in a wide variety of machine learning tasks. These tasks include important benchmark problems in machine vision ([KSH12]) and machine translation ([SVL14, WSC+16]) as well as superhuman performance at games such as Go [SHM+16]. Despite these varied and striking successes, a theory of why neural nets provide such good approximations to interesting functions and can be effectively trained is only beginning to take shape.

While non-linear activations help neural nets express a wide variety of functions, repeated non-linearities can also “garble” the signal, leading to a loss of mutual information between the input and the activations at various hidden layers. Such an information theoretic point of view on neural nets has recently been systematically taken up in the work of Tishby with Shwartz-Ziv, Moshkovitz, and Zaslavsky [ST17, MT17, TZ15]. In the present article, we answer a basic information theoretic question about neural nets. Namely, for each d≥1,d\geq 1, what is the minimal width wmin(d)w_{\text{min}}(d) so that neural nets whose hidden layers have width at least wmin(d)w_{\text{min}}(d) and arbitrary depth can approximate arbitrarily well any scalar continuous function of dd variables? We treat only neural nets with a popular and particularly simple activation function called rectified linear units, defined

It have been known since the 1980’s (e.g. the work of Cybenko [Cyb89] and Hornik-Stinchcombe-White [HSW89]) that feed-forward neural nets with a single hidden layer can approximate essentially any function if the hidden layer is allowed to be arbitrarily wide. Such results hold for a wide variety of activations, including ReLU⁡.\operatorname{ReLU}. However, part of the recent renaissance in neural nets, is the empirical observation that deep neural nets tend to achieve greater expressivity per parameter than their shallow cousins. There are now a number of rigorous results about this so-called expressive power of depth [ABMM16, MLP16, LTR17, MP16, PLR+16, RPK+17, RT17, Tel15, Tel16, Tel17, Yar16]. We refer the reader to §3 in [Han17] for a discussion of the relationships between some of these articles.

The main result of this article shows a sharp transition in the representational power of deep feed-forward neural nets with ReLU⁡\operatorname{ReLU} activations as a function of the widths of their hidden layers. To state it, we need some notation. We say that N\mathcal{N} is a feed-forward neural net with ReLU⁡\operatorname{ReLU} activations, input dimension dind_{in}, output dimension doutd_{out}, and widths din=d1,d2,…,dk,dk+1=doutd_{in}=d_{1},d_{2},\ldots,d_{k},d_{k+1}=d_{out} (a ReLU⁡\operatorname{ReLU} net for short) if it computes a function fNf_{\mathcal{N}} of the form

The main result of this article is the following estimate for wmin(din,dout).w_{\text{min}}(d_{in},d_{out}).

Proving the upper bound wmin(din,dout)≤din+doutw_{\text{min}}(d_{in},d_{out})\leq d_{in}+d_{out} in Theorem 1 requires a novel construction by which any continuous function with dind_{in} input variables and doutd_{out} output variables can be approximated to arbitrary precision by a ReLU⁡\operatorname{ReLU} net with width din+doutd_{in}+d_{out} and depth depending on its modulus of continuity ωf\omega_{f}. Recall that ωf(δ)≤ε\omega_{f}(\delta)\leq\varepsilon when ∣x−y∣≤δ|x-y|\leq\delta implies that ∣f(x)−f(y)∣≤ε|f(x)-f(y)|\leq\varepsilon uniformly over all inputs x,y.x,y. Since ωf\omega_{f} need not be continuous or bijective, define

We refer the reader to Proposition 3 for the precise statement. The construction is carried out in §2. In contrast, obtaining the lower bound

Our construction in §3 only requires that the function have some compact level set (connected component of a fiber f−1(a)f^{-1}(a)) and be non-constant inside that level set.

The first author would like to thank Zhangyang Wang for several stimulating discussions about extending the results in this article to allowing residual connections and to more general activations. We are also grateful to Dmitry Yarotsky for pointing out several inaccuracies and a mistake (now corrected) in the proof of Lemma 6 in a previous version.

Proof of the Upper Bound in Theorem 1

where each σi\sigma_{i} is either a coordinate-wise max or a min.

The statement (3) follows immediately from the following two propositions.

Nonetheless, Proposition 3 is of a rather different nature since we are allowed to take only max and min of two affine functions at a time.

We may assume without loss of generality that KK is contained in the positive orthant:

since we can always shift the input to a neural net by a fixed vector. Let us fix a max-min string

is the graph of g.g. Note that the final ReLU⁡\operatorname{ReLU} is trivial since gg is non-negative. Appending a final layer (x1,…,xdin,y1,…,ydout)↦(y1,…,ydout)(x_{1},\ldots,x_{d_{in}},y_{1},\ldots,y_{d_{out}})\mapsto\left(y_{1},\ldots,y_{d_{out}}\right) yields the desired net. ∎

2. Proof of Proposition 3

where the max and min are componentwise. By construction, g^(s0)=f(s0).\widehat{g}(s_{0})=f(s_{0}). Further, because tt is large, g^(s)=f(s)\widehat{g}(s)=f(s) for s∈S\{s0}s\in S\backslash\{s_{0}\}. Hence g^\widehat{g} and ff agree on SS, completing the proof. ∎

such that KK is contained in the infinite planar sector ∠BAC\angle BAC. Then if there exists a max-min string gg with

then there also exists a max-min string g^\widehat{g} with

Next, by the definition of ωf−1,\omega^{-1}_{f}, we have

We now show that this estimate continues to hold for x∈Kx\in K as well. We claim that on K∪△ABCK\cup\triangle ABC we have

Indeed, suppose that ray AxAx has length nωf−1(ε)+rn\omega^{-1}_{f}(\varepsilon)+r for integer nn and real remainder r<ωf−1(ε)r<\omega^{-1}_{f}(\varepsilon). Then by the triangle inequality we have

Therefore, g^−ε≤f≤g^+ε,\widehat{g}-\varepsilon\leq f\leq\widehat{g}+\varepsilon, as desired. ∎

We now turn to the details of the proof of Proposition 3. We will explain how to approximate our fixed continuous function ff by a max-min string on a ball of radius R>0R>0 centered at the origin. We will use Lemma 5 to show that we can approximate ff on successively larger and larger balls. Observe that if r≤ωf−1(ε)r\leq\omega^{-1}_{f}(\varepsilon) then

so that the constant max-min string f(0)f(0) is an ε\varepsilon-approximation to ff on the small ball Bωf−1(ε)(0)B_{\omega^{-1}_{f}(\varepsilon)}(0). To prove that we can approximate ff on larger balls, suppose gg is a max-min string on din{d_{in}} variables that approximates ff to within ε\varepsilon on the ball Br(0)B_{r}(0) with r≥wf−1(ε).r\geq w_{f}^{-1}(\varepsilon). We use Lemma 5 to construct a new max-min string g^\widehat{g} which uniformly ε\varepsilon-approximates ff on a ball of slightly larger radius

Since for every ε>0,\varepsilon>0, the function Rr,εR_{r,\varepsilon} is strictly increasing in rr it cannot have a fixed point and the k−k-fold composition Rr,ε(k)R_{r,\varepsilon}^{(k)} sends any r>0r>0 to infinity with k.k. Using this procedure repeatedly therefore allows us to increase rr without bound and will complete the proof. Our approach is illustrated in Figures 1 and 2.

We begin with the construction when din=2{d_{in}}=2 and will explain the simple modification for din≥3{d_{in}}\geq 3 below. For each r′>rr^{\prime}>r and any two sufficiently close points X,YX,Y on the boundary of BrB_{r}, let X′,Y′X^{\prime},Y^{\prime} be the intersections of line XYXY with the boundary circle of Br′(P)B_{r^{\prime}}(P). Also, denote by ZZ be the intersection of the tangents to Br′B_{r^{\prime}} through X′,Y′X^{\prime},Y^{\prime} (see Figure 1). Then BrB_{r} is contained in the planar sector ∠X′ZY′\angle X^{\prime}ZY^{\prime}, and the diameter of △X′ZY′\triangle X^{\prime}ZY^{\prime} can be made arbitrarily small by taking r′r^{\prime} close to rr and XX close to Y.Y. In particular, for every r≥ωf−1(ε),r\geq\omega^{-1}_{f}(\varepsilon), we take

This choice for ∣XY∣|XY| is valid because ∣XY∣≤ωf−1(ε)≤r|XY|\leq\omega^{-1}_{f}(\varepsilon)\leq r, so we can indeed find points X,YX,Y at this distance with no problem. Then

We also know that ∣X′Z∣=∣Y′Z∣≤∣X′Y′∣=ωf−1(ε)|X^{\prime}Z|=|Y^{\prime}Z|\leq|X^{\prime}Y^{\prime}|=\omega^{-1}_{f}(\varepsilon) because ∣X′Y′∣=ωf−1(ε)≤r≤r′|X^{\prime}Y^{\prime}|=\omega^{-1}_{f}(\varepsilon)\leq r\leq r^{\prime}, implying obtuseness of △X′ZY′\triangle X^{\prime}ZY^{\prime} at ZZ. Thus,

Lemma 5 therefore shows that there exists a max-min string g′g^{\prime} that uniformly ε\varepsilon approximates ff on K′=△X′Y′Z∪Br.K^{\prime}=\triangle X^{\prime}Y^{\prime}Z\cup B_{r}. Notice that K′K^{\prime} contains the circular sector of BRr,εB_{R_{r,\varepsilon}} cut out by the rays OXOX and OY.OY. Finally, consider a δ−\delta-net {pi}\{p_{i}\} on the circumference of BrB_{r} with

The size of this net is O(r/ωf−1(ε)).O(r/\omega^{-1}_{f}(\varepsilon)). Applying Lemma 5 O(r/ωf−1(ε))O(r/\omega^{-1}_{f}(\varepsilon)) times and repeating the above argument with (X,Y)=(pi,pi+1)(X,Y)=(p_{i},p_{i+1}) completes the proof of the upper bound in Theorem 1 when din=2.{d_{in}}=2.

The argument when din≥3{d_{in}}\geq 3 is essentially the same. The idea is to take the diagrams depicted and rotate them around the axis PZ.PZ. Lemma 5 extends to higher dimensions with the triangle △ABC\triangle ABC replaced by the tip of a cone with the same diameter requirement. Such a cone is obtained by rotating X′ZY′X^{\prime}ZY^{\prime} in Figures 1 and 2. The rest of the argument then carries over verbatim.

balls. We get one extra max and min in the max-min string we build to approximate ff for each such ball. Thus, at a cost of (O(r)ωf−1(ε))din−1\left(\frac{O(r)}{\omega^{-1}_{f}(\varepsilon)}\right)^{{d_{in}}-1} many maxes and mins, the radius on which we approximate ff increases

Hence, if we fix R>ωf−1(ε),R>\omega^{-1}_{f}(\varepsilon), then for every ωf−1(ε)≤r≤R,\omega^{-1}_{f}(\varepsilon)\leq r\leq R, we have

and to obtain an approximation of ff on BR,B_{R}, by a max-min we need to extend the approximation of ff from a small ball to a larger ball at most 10R2/ωf−1(ε)210R^{2}/\omega^{-1}_{f}(\varepsilon)^{2} times. The number of maxes and mins required for each extension is (O(R)/ωf−1(ε))din−1(O(R)/\omega^{-1}_{f}(\varepsilon))^{{d_{in}}-1}. Hence, the length of the max-min string we construct to approximate ff on BRB_{R} is

We have tacitly neglected the case din=1d_{in}=1. This case is the same as din=2d_{in}=2 but easier. In fact here we require only

layers, which would naively correspond to din=0d_{in}=0. The reason is that a 11-dimensional ball can be increased in radius by ωf−1(ε)\omega_{f}^{-1}(\varepsilon) by adding only a single external line segment of length ωf−1(ε)\omega_{f}^{-1}(\varepsilon). In the higher dimensional cases, we need to add the external pieces mostly tangentially which requires more layers.

Proof of the Lower Bound in Theorem 1

Fix din≥1,{d_{in}}\geq 1, and consider a width din{d_{in}} ReLU⁡\operatorname{ReLU} net

computed by the first jj hidden layers of N\mathcal{N} are of a rather special form.

For each j≥1j\geq 1, set SjS_{j} to be the set of points on which all ReLU evaluations throughout the evaluation of fjf_{j} are (strictly) positive. Then SjS_{j} is open and convex, fjf_{j} is affine on SjS_{j}, and every level set of fjf_{j} that is bounded is contained in Sj.S_{j}.

In this case AA is a sphere and BB is a ball. Suppose y∈By\in B and f(y)=b≠af(y)=b\neq a. Then for η<∣a−b∣4\eta<\frac{|a-b|}{4}, we show that ff is not η\eta-approximable on A∪BA\cup B.

Set c=a+b2c=\frac{a+b}{2}, and let CC be the intersection of f−1(c)f^{-1}(c) with BB. Since ff is continuous, the intermediate value theorem implies that CC separates yy and AA. Let C′⊆CC^{\prime}\subseteq C be the boundary of any connected component of CC that contains yy. Informally, AA surrounds C′C^{\prime} which surrounds yy. Now, suppose some fNf_{\mathcal{N}} computed by a neural net satisfies

Suppose in the second case that SNS_{\mathcal{N}} does not contain C′C^{\prime}, so there is x∈C′\SNx\in C^{\prime}\backslash S_{\mathcal{N}}. Then, by Lemma 6, the level set of fNf_{\mathcal{N}} containing xx must be unbounded, and hence must intersect AA (as AA separates yy from ∞\infty and x∈C′x\in C^{\prime} is reachable from yy without intersecting A). This is again a contradiction for η<∣a−c∣2=∣a−b∣4.\eta<\frac{|a-c|}{2}=\frac{|a-b|}{4}.

In both cases, we showed that ff and fNf_{\mathcal{N}} differed significantly; the first case used the affineness of fNf_{\mathcal{N}} on SNS_{\mathcal{N}} while the second used the unboundedness of level sets away from SNS_{\mathcal{N}}. We conclude that a width-dd net cannot uniformly approximate ff. □\square

References