Neural networks and rational functions

Matus Telgarsky

Overview

Significant effort has been invested in characterizing the functions that can be efficiently approximated by neural networks. The goal of the present work is to characterize neural networks more finely by finding a class of functions which is not only well-approximated by neural networks, but also well-approximates neural networks.

The function class investigated here is the class of rational functions: functions represented as the ratio of two polynomials, where the denominator is a strictly positive polynomial. For simplicity, the neural networks are taken to always use ReLU activation σr(x)\mathchar58=max⁡{0,x}\sigma_{\textup{r}}(x)\mathrel{\mathop{\mathchar 58\relax}}=\max\{0,x\}; for a review of neural networks and their terminology, the reader is directed to Section 1.4. For the sake of brevity, a network with ReLU activations is simply called a ReLU network.

The main theorem here states that ReLU networks and rational functions approximate each other well in the sense that ϵ\epsilon-approximating one class with the other requires a representation whose size is polynomial in ln⁡(1 / ϵ)\ln(1\,/\,\epsilon), rather than being polynomial in 1/ϵ1/\epsilon.

Perhaps the main wrinkle is the appearance of mkm^{k} when approximating neural networks by rational functions. The following theorem shows that this dependence is tight.

Note that this statement implies the desired difficulty of approximation, since a gap in the above integral (L1L_{1}) distance implies a gap in the earlier uniform distance (L∞L_{\infty}), and furthermore an rr-degree rational function necessarily has ≤2r+2\leq 2r+2 total terms in its numerator and denominator.

As a final piece of the story, note that the conversion between rational functions and ReLU networks is more seamless if instead one converts to rational networks, meaning neural networks where each activation function is a rational function.

Combining Theorem 1.2 and Section 1.1 yields an intriguing corollary.

The hard-to-approximate function ff is a rational network which has a description of size O(k2)\mathcal{O}(k^{2}). Despite this, attempting to approximate it with a rational function of the usual form requires a description of size Ω(2k)\Omega(2^{k}). Said another way: even for rational functions, there is a benefit to a neural network representation!

2 Auxiliary results

The first thing to stress is that Theorem 1.1 is impossible with polynomials: namely, while it is true that ReLU networks can efficiently approximate polynomials (Yarotsky, 2016; Safran & Shamir, 2016; Liang & Srikant, 2017), on the other hand polynomials require degree Ω(poly(1/ϵ))\Omega(\textup{poly}(1/\epsilon)), rather than O(poly(ln⁡(1/ϵ)))\mathcal{O}(\textup{poly}(\ln(1/\epsilon))), to approximate a single ReLU, or equivalently the absolute value function (Petrushev & Popov, 1987, Chapter 4, Page 73).

Another point of interest is the depth needed when converting a rational function to a ReLU network. Theorem 1.1 is impossible if the depth is o(ln⁡(1/ϵ))o(\ln(1/\epsilon)): specifically, it is impossible to approximate the degree 1 rational function x↦1/xx\mapsto 1/x with size O(ln⁡(1/ϵ))\mathcal{O}(\ln(1/\epsilon)) but depth o(ln⁡(1/ϵ))o(\ln(1/\epsilon)).

Lastly, the implementation of division in a ReLU network requires a few steps, arguably the most interesting being a “continuous switch statement”, which computes reciprocals differently based on the magnitude of the input. The ability to compute switch statements appears to be a fairly foundational operation available to neural networks and rational functions (Petrushev & Popov, 1987, Theorem 5.2), but is not available to polynomials (since otherwise they could approximate the ReLU).

3 Related work

The results of the present work follow a long line of work on the representation power of neural networks and related functions. The ability of ReLU networks to fit continuous functions was no doubt proved many times, but it appears the earliest reference is to Lebesgue (Newman, 1964, Page 1), though of course results of this type are usually given much more contemporary attribution (Cybenko, 1989). More recently, it has been shown that certain function classes only admit succinct representations with many layers (Telgarsky, 2015). This has been followed by proofs showing the possibility for a depth 3 function to require exponentially many nodes when rewritten with 2 layers (Eldan & Shamir, 2016). There are also a variety of other result giving the ability of ReLU networks to approximate various function classes (Cohen et al., 2016; Poggio et al., 2017).

Most recently, a variety of works pointed out neural networks can approximate polynomials, and thus smooth functions essentially by Taylor’s theorem (Yarotsky, 2016; Safran & Shamir, 2016; Liang & Srikant, 2017). This somewhat motivates this present work, since polynomials can not in turn approximate neural networks with a dependence O(poly log(1/ϵ))\mathcal{O}(\textup{poly\,log}(1/\epsilon)): they require degree Ω(1/ϵ)\Omega(1/\epsilon) even for a single ReLU.

Rational functions are extensively studied in the classical approximation theory literature (Lorentz et al., 1996; Petrushev & Popov, 1987). This literature draws close connections between rational functions and splines (piecewise polynomial functions), a connection which has been used in the machine learning literature to draw further connections to neural networks (Williamson & Bartlett, 1991). It is in this approximation theory literature that one can find the following astonishing fact: not only is it possible to approximate the absolute value function (and thus the ReLU) over [−1,+1][-1,+1] to accuracy ϵ>0\epsilon>0 with a rational function of degree O(ln⁡(1/ϵ)2)\mathcal{O}(\ln(1/\epsilon)^{2}) (Newman, 1964), but moreover the optimal rate is known (Petrushev & Popov, 1987; Zolotarev, 1877)! These results form the basis of those results here which show that rational functions can approximate ReLU networks. (Approximation theory results also provide other functions (and types of neural networks) which rational functions can approximate well, but the present work will stick to the ReLU for simplicity.)

An ICML reviewer revealed prior work which was embarrassingly overlooked by the author: it has been known, since decades ago (Beame et al., 1986), that neural networks using threshold nonlinearities (i.e., the map x↦\mathds1[x≥0]x\mapsto\mathds{1}[x\geq 0]) can approximate division, and moreover the proof is similar to the proof of part 1 of Theorem 1.1! Moreover, other work on threshold networks invoked Newman polynomials to prove lower bound about linear threshold networks (Paturi & Saks, 1994). Together this suggests that not only the connections between rational functions and neural networks are tight (and somewhat known/unsurprising), but also that threshold networks and ReLU networks have perhaps more similarities than what is suggested by the differing VC dimension bounds, approximation results, and algorithmic results (Goel et al., 2017).

4 Further notation

Here is a brief description of the sorts of neural networks used in this work. Neural networks represent computation as a directed graph, where nodes consume the outputs of their parents, apply a computation to them, and pass the resulting value onward. In the present work, nodes take their parents’ outputs zz and compute σr(a⊤z+b)\sigma_{\textup{r}}(a^{\top}z+b), where aa is a vector, bb is a scalar, and σr(x)\mathchar58=max⁡{0,x}\sigma_{\textup{r}}(x)\mathrel{\mathop{\mathchar 58\relax}}=\max\{0,x\}; another popular choice of nonlineary is the sigmoid x↦(1+exp⁡(−x))−1x\mapsto(1+\exp(-x))^{-1}. The graphs in the present work are acyclic and connected with a single node lacking children designated as the univariate output, but the literature contains many variations on all of these choices.

Approximating ReLU networks with rational functions

This section will develop the proofs of part 2 of Theorem 1.1, Theorem 1.2, Section 1.1, and Section 1.1.

The starting point is a seminal result in the theory of rational functions (Zolotarev, 1877; Newman, 1964): there exists a rational function of degree O(ln⁡(1/ϵ)2)\mathcal{O}(\ln(1/\epsilon)^{2}) which can approximate the absolute value function along [−1,+1][-1,+1] to accuracy ϵ>0\epsilon>0. This in turn gives a way to approximate the ReLU, since

The construction here uses the Newman polynomials (Newman, 1964): given an integer rr, define

The Newman polynomials N5N_{5}, N9N_{9}, and N13N_{13} are depicted in Figure 3. Typical polynomials in approximation theory, for instance the Chebyshev polynomials, have very active oscillations; in comparison, the Newman polynomials look a little funny, lying close to 0 over ,andquicklyincreasingmonotonicallyover, and quickly increasing monotonically over. The seminal result of Newman (1964) is that

Thanks to this bound and eq. 2.1, it follows that the ReLU can be approximated to accuracy ϵ>0\epsilon>0 by rational functions of degree O(ln⁡(1/ϵ)2)\mathcal{O}(\ln(1/\epsilon)^{2}).

(Some basics on Newman polynomials, as needed in the present work, can be found in Section A.1.)

2 Proof of Section 1.1

Now that a single ReLU can be easily converted to a rational function, the next task is to replace every ReLU in a ReLU network with a rational function, and compute the approximation error. This is precisely the statement of Section 1.1.

The proof of Section 1.1 is an induction on layers, with full details relegated to the appendix. The key computation, however, is as follows. Let R(x)R(x) denote a rational approximation to σr\sigma_{\textup{r}}. Fix a layer i+1i+1, and let H(x)H(x) denote the multi-valued mapping computed by layer ii, and let HR(x)H_{R}(x) denote the mapping obtained by replacing each σr\sigma_{\textup{r}} in HH with RR. Fix any node in layer i+1i+1, and let x↦σr(a⊤H(x)+b)x\mapsto\sigma_{\textup{r}}(a^{\top}H(x)+b) denote its output as a function of the input. Then

For the first term ♡\heartsuit, note since σr\sigma_{\textup{r}} is 11-Lipschitz and by Hölder’s inequality that

meaning this term has been reduced to the inductive hypothesis since ∥a∥1≤1\|a\|_{1}\leq 1. For the second term ♣\clubsuit, if a⊤HR(x)+ba^{\top}H_{R}(x)+b can be shown to lie in [−1,+1][-1,+1] (which is another easy induction), then ♣\clubsuit is just the error between RR and σr\sigma_{\textup{r}} on the same input.

3 Proof of part 2 of Theorem 1.1

It is now easy to find a rational function that approximates a neural network, and to then bound its size. The first step, via Section 1.1, is to replace each σr\sigma_{\textup{r}} with a rational function RR of low degree (this last bit using Newman polynomials). The second step is to inductively collapse the network into a single rational function. The reason for the dependence on the number of nodes mm is that, unlike polynomials, summing rational functions involves an increase in degree:

4 Proof of Theorem 1.2

The final interesting bit is to show that the dependence on mlm^{l} in part 2 of Theorem 1.1 (where mm is the number of nodes and ll is the number of layers) is tight.

The kk-fold composition Δk\Delta^{k} is a piecewise affine function with 2k−12^{k-1} regularly spaced peaks (Telgarsky, 2015). This function was demonstrated to be inapproximable by shallow networks of subexponential size, and now it can be shown to be a hard case for rational approximation as well.

Consider the horizontal line through y=1/2y=1/2. The function Δk\Delta^{k} will cross this line 2k2^{k} times. Now consider a rational function f(x)=p(x)/q(x)f(x)=p(x)/q(x). The set of points where f(x)=1/2f(x)=1/2 corresponds to points where 2p(x)−q(x)=02p(x)-q(x)=0. A poor estimate for the number of zeros is simply the degree of 2p−q2p-q, however, since ff is univariate, a stronger tool becomes available: by Descartes’ rule of signs, the number of zeros in f−1/2f-1/2 is upper bounded by the number of terms in 2p−q2p-q.

Approximating rational functions with ReLU networks

This section will develop the proof of part 1 of Theorem 1.1, as well as the tightness result in Section 1.2

To establish part 1 of Theorem 1.1, the first step is to approximate polynomials with ReLU networks, and the second is to then approximate the division operation.

The representation of polynomials will be based upon constructions due to Yarotsky (2016). The starting point is the following approximation of the squaring function.

Let any ϵ>0\epsilon>0 be given. There exists f\mathchar58x→f\mathrel{\mathop{\mathchar 58\relax}}x\to, represented as a ReLU network with O(ln⁡(1/ϵ))\mathcal{O}(\ln(1/\epsilon)) nodes and layers, such that sup⁡x∈∣f(x)−x2∣≤ϵ\sup_{x\in}|f(x)-x^{2}|\leq\epsilon and f(0)=0f(0)=0.

Yarotsky’s proof is beautiful and deserves mention. The approximation of x2x^{2} is the function fkf_{k}, defined as

where Δ\Delta is the triangle map from Section 2. For every kk, fkf_{k} is a convex, piecewise-affine interpolation between points along the graph of x2x^{2}; going from kk to k+1k+1 does not adjust any of these interpolation points, but adds a new set of O(2k)\mathcal{O}(2^{k}) interpolation points.

Once squaring is in place, multiplication comes via the polarization identity xy=((x+y)2−x2−y2)/2xy=((x+y)^{2}-x^{2}-y^{2})/2.

Let any ϵ>0\epsilon>0 and B≥1B\geq 1 be given. There exists g(x,y)\mathchar58[0,B]2→[0,B2]g(x,y)\mathrel{\mathop{\mathchar 58\relax}}[0,B]^{2}\to[0,B^{2}], represented by a ReLU network with O(ln⁡(B/ϵ)\mathcal{O}(\ln(B/\epsilon) nodes and layers, with

Next, it follows that ReLU networks can efficiently approximate exponentiation thanks to repeated squaring.

Let ϵ∈(0,1]\epsilon\in(0,1] and positive integer yy be given. There exists h\mathchar58→h\mathrel{\mathop{\mathchar 58\relax}}\to, represented by a ReLU network with O(ln⁡(y/ϵ)2)\mathcal{O}(\ln(y/\epsilon)^{2}) nodes and layers, with

With multiplication and exponentiation, a representation result for polynomials follows.

Let ϵ∈(0,1]\epsilon\in(0,1] be given. Let p\mathchar58d→[−1,+1]p\mathrel{\mathop{\mathchar 58\relax}}^{d}\to[-1,+1] denote a polynomial with ≤s\leq s monomials, each with degree ≤r\leq r and scalar coefficient within [−1,+1][-1,+1]. Then there exists a function q\mathchar58d→[−1,+1]q\mathrel{\mathop{\mathchar 58\relax}}^{d}\to[-1,+1] computed by a network of size O(min⁡{srln⁡(sr/ϵ),sdln⁡(dsr/ϵ)2})\mathcal{O}\mathinner{\left(\min\{sr\ln(sr/\epsilon),sd\ln(dsr/\epsilon)^{2}\}\right)}, which satisfies sup⁡x∈d∣p(x)−q(x)∣≤ϵ\sup_{x\in^{d}}|p(x)-q(x)|\leq\epsilon.

The remainder of the proof now focuses on the division operation. Since multiplication has been handled, it suffices to compute a single reciprocal.

Let ϵ∈(0,1]\epsilon\in(0,1] and nonnegative integer kk be given. There exists a ReLU network q\mathchar58[2−k,1]→[1,2k]q\mathrel{\mathop{\mathchar 58\relax}}[2^{-k},1]\to[1,2^{k}], of size O(k2ln⁡(1/ϵ)2)\mathcal{O}(k^{2}\ln(1/\epsilon)^{2}) and depth O(k4ln⁡(1/ϵ)3)\mathcal{O}(k^{4}\ln(1/\epsilon)^{3}) such that

This proof relies on two tricks. The first is to observe, for x∈(0,1]x\in(0,1], that

Thanks to the earlier development of exponentiation, truncating this summation gives an expression easily approximate by a neural network as follows.

Unfortunately, Section 3.1 differs from the desired statement Section 3.1: inverting inputs lying within [2−k,1][2^{-k},1] requires O(2kln⁡(1/ϵ)2)\mathcal{O}(2^{k}\ln(1/\epsilon)^{2}) nodes rather than O(k4ln⁡(1/ϵ)3)\mathcal{O}(k^{4}\ln(1/\epsilon)^{3})!

To obtain a good estimate with only O(ln⁡(1/ϵ))\mathcal{O}(\ln(1/\epsilon)) terms of the summation, it is necessary for the input to be xx bounded below by a positive constant (not depending on kk). This leads to the second trick (which was also used by Beame et al. (1986)!).

Consider, for positive constant c>0c>0, the expression

If xx is small, choosing a larger cc will cause this summation to converge more quickly. Thus, to compute 1/x1/x accurately over a wide range of inputs, the solution here is to multiplex approximations of the truncated sum for many choices of cc. In order to only rely on the value of one of them, it is possible to encode a large “switch” style statement in a neural network. Notably, rational functions can also representat switch statements (Petrushev & Popov, 1987, Theorem 5.2), however polynomials can not (otherwise they could approximate the ReLU more efficiently, seeing as it is a switch statement of 0 (a degree 0 polynomial) and xx (a degree 1 polynomial).

2 Proof of Section 1.2

It remains to show that shallow networks have a hard time approximating the reciprocal map x↦1/xx\mapsto 1/x.

This proof uses the same scheme as various proofs in (Telgarsky, 2016), which was also followed in more recent works (Yarotsky, 2016; Safran & Shamir, 2016): the idea is to first upper bound the number of affine pieces in ReLU networks of a certain size, and then to point out that each linear segment must make substantial error on a curved function, namely 1/x1/x.

The proof is fairly brute force, and thus relegated to the appendices.

Summary of figures

Throughout this work, a number of figures were presented to show not only the astonishing approximation properties of rational functions, but also the higher fidelity approximation achieved by both ReLU networks and rational functions as compared with polynomials. Of course, this is only a qualitative demonstration, but still lends some intuition.

In all these demonstrations, rational functions and polynomials have degree 9 unless otherwise marked. ReLU networks have two hidden layers each with 3 nodes. This is not exactly apples to apples (e.g., the rational function has twice as many parameters as the polynomial), but still reasonable as most of the approximation literature fixes polynomial and rational degrees in comparisons.

Figure 1 shows the ability of all three classes to approximate a truncated reciprocal. Both rational functions and ReLU networks have the ability to form “switch statements” that let them approximate different functions on different intervals with low complexity (Petrushev & Popov, 1987, Theorem 5.2). Polynomials lack this ability; they can not even approximate the ReLU well, despite it being low degree polynomials on two separate intervals.

Figure 2 shows that rational functions can fit the threshold function errily well; the particular rational function used here is based on using Newman polynomials to approximate (1+∣x∣/x)/2(1+|x|/x)/2 (Newman, 1964).

Figure 3 shows Newman polynomials N5N_{5}, N9N_{9}, N13N_{13}. As discussed in the text, they are unlike orthogonal polynomials, and are used in all rational function approximations except Figure 1, which used a least squares fit.

Figure 4 shows that rational functions (via the Newman polynomials) fit Δ\Delta very well, whereas polynomials have trouble. These errors degrade sharply after recursing, namely when approximating Δ3\Delta^{3} as in Figure 6.

Figure 5 shows how polynomials and rational functions fit the ReLU, where the ReLU representation, based on Newman polynomials, is the one used in the proofs here. Despite the apparent slow convergence of polynomials in this regime, the polynomial fit is still quite respectable.

Open problems

There are many next steps for this and related results.

Can rational functions, or some other approximating class, be used to more tightly bound the generalization properties of neural networks? Notably, the VC dimension of sigmoid networks uses a conversion to polynomials (Anthony & Bartlett, 1999).

Can rational functions, or some other approximating class, be used to design algorithms for training neural networks? It does not seem easy to design reasonable algorithms for minimization over rational functions; if this is fundamental and moreover in contrast with neural networks, it suggests an algorithmic benefit of neural networks.

Can rational functions, or some other approximating class, give a sufficiently refined complexity estimate of neural networks which can then be turned into a regularization scheme for neural networks?

Acknowledgements

The author thanks Adam Klivans and Suvrit Sra for stimulating conversations. Adam Klivans and the author both thank Almare Gelato Italiano, in downtown Berkeley, for necessitating further stimulating conversations, but now on the topic of health and exercise. Lastly, the author thanks the University of Illinois, Urbana-Champaign, and the Simons Institute in Berkeley, for financial support during this work.

References

Appendix A Deferred material from Section 2

This section collects technical material omitted from Section 2. The first step is to fill in some missing details regarding Newman polynomials.

Define the Newman polynomial (Newman, 1964)

Define Ar(x)A_{r}(x), the Newman approximation to ∣x∣|x|, as

If x=0x=0, then Nr(−x)=Nr(x)=∏i=1r−1αri>0N_{r}(-x)=N_{r}(x)=\prod_{i=1}^{r-1}\alpha_{r}^{i}>0. Otherwise x>0x>0, and note for any i∈{1,…,r−1}i\in\{1,\ldots,r-1\} that

x∈(0,αri]x\in(0,\alpha_{r}^{i}] means ∣x−αri∣=αri−x<αri+x|x-\alpha_{r}^{i}|=\alpha_{r}^{i}-x<\alpha_{r}^{i}+x,

x>αrix>\alpha_{r}^{i} means ∣x−αri∣=x−αri<x+αri|x-\alpha_{r}^{i}|=x-\alpha_{r}^{i}<x+\alpha_{r}^{i}.

Together, ∣x−αri∣<x+αri|x-\alpha_{r}^{i}|<x+\alpha_{r}^{i}, and

Since Nr(x)>0N_{r}(x)>0 when x>0x>0, thus Nr(x)+Nr(−x)>Nr(x)−∣Nr(x)∣=0N_{r}(x)+N_{r}(-x)>N_{r}(x)-|N_{r}(x)|=0.

Lastly, the case x<0x<0 follows from the case x>0x>0 since x↦Nr(x)+Nr(−x)x\mapsto N_{r}(x)+N_{r}(-x) is even.

where the last step was proved by Newman (Lorentz et al., 1996, Theorem 7.3.1).

If ϵr,b≤1\epsilon_{r,b}\leq 1, then Rr,b∈[0,b]R_{r,b}\in[0,b] along [−b,+b][-b,+b].

A.2 Remaining deferred proofs

The details of converting a ReLU network into a rational network are as follows.

This construction will use the Newman-based approximation R\mathchar58=Rr,bR\mathrel{\mathop{\mathchar 58\relax}}=R_{r,b} to σr\sigma_{\textup{r}} with degree O(ln⁡(l/ϵ)2)\mathcal{O}(\ln(l/\epsilon)^{2}). By Section A.1, this degree suffices to guarantee R(x)∈R(x)\in and ∣R(x)−σr(x)∣≤ϵ/l|R(x)-\sigma_{\textup{r}}(x)|\leq\epsilon/l for ∣x∣≤1|x|\leq 1.

First note, by induction on layers, that the output of every node has absolute value at most 1. The base case is the inputs themselves, and thus the statement holds by the assumption ∥x∥∞≤1\|x\|_{\infty}\leq 1. In the inductive step, consider any node z↦R(a⊤z+b)z\mapsto R(a^{\top}z+b), where zz is the multivariate input to this node. By the inductive hypothesis, ∥z∥∞≤1\|z\|_{\infty}\leq 1, thus

Next, collapsing a rational network down into a single rational function is proved as follows.

Throughout this proof, let RR denote the rational activation function at each node, and write R(x)=p(x)/q(x)R(x)=p(x)/q(x) where pp and qq are polynomials of degree at most rr. The proof establishes, by induction on layers, that the nodes of layer ii compute rational functions of degree at most (rm)i(rm)^{i}. The base case is layer 11, where each node computes a rational function of degree r≤rmr\leq rm. For the case of layer i>1i>1, fix any node, and denote its computation by h(x)=R(∑j=1najgj(x)+b)h(x)=R(\sum_{j=1}^{n}a_{j}g_{j}(x)+b), where n≤mn\leq m and gj=pj/qjg_{j}=p_{j}/q_{j} is a rational function of degree at most (rm)i−1(rm)^{i-1}. Note

the map f\mathchar58=∑jajgj+bf\mathrel{\mathop{\mathchar 58\relax}}=\sum_{j}a_{j}g_{j}+b is rational of degree m(mr)i−1m(mr)^{i-1}. Let pfp_{f} and qfq_{f} denote its numerator and denominator. Since RR is univariate, its numerator pp and denominator qq have the form p(x)\mathchar58=∑j≤rcjxjp(x)\mathrel{\mathop{\mathchar 58\relax}}=\sum_{j\leq r}c_{j}x^{j} and q(x)∑j≤rdjxjq(x)\sum_{j\leq r}d_{j}x^{j}. Thus, using the fact that q>0q>0,

The proof of part 2 of Theorem 1.1 now follows by combining Sections 1.1, A.1 and A.2.

The last piece is a slighly more detailed account of Theorem 1.2.

Define the target function f=Δkf=\Delta^{k}, which as in (Telgarsky, 2015) has 2k2^{k} regular-spaced crossings of 0 along $,andcanbewrittenasanetworkwith, and can be written as a network with2klayers,eachwithlayers, each with\leq 2$ nodes.

Next consider the rational function gg. As in the text, it is necessary to count the zeros of g−1/2g-1/2 (the case g=1/2g=1/2 is trivial). Writing g=p/qg=p/q, equivalently this means the zeros of 2p−q2p-q. Since pp and qq together have ≤2k−2\leq 2^{k-2} terms, by Descartes’ rule of signs, gg crosses 1/21/2 at most 2k−22^{k-2} times along (0,1](0,1]. Therefore, following a similar calculation to the proof in (Telgarsky, 2016, Proof of Theorem 1.1),

Appendix B Deferred material from Section 3

To start, the lemmas due to Yarotsky are slightly adjusted to clip the range to $$.

Inspecting Yarotsky’s proof, the construction provides g(x)g(x) with g(0)=0g(0)=0 and sup⁡x∈∣g(x)−x2∣≤ϵ\sup_{x\in}|g(x)-x^{2}|\leq\epsilon. To provide the desired ff, it suffices to define f(x)=σr(g(x))−σr(g(x)−1)f(x)=\sigma_{\textup{r}}(g(x))-\sigma_{\textup{r}}(g(x)-1). ∎

First suppose B=1B=1, let ff be as in Section 3.1 at resolution ϵ/8\epsilon/8, and define hh via the polarization identity (as in Yarotsky’s proof):

(where x/2x/2 appears since ff has domain 2^{2}). Since f(0)=0f(0)=0,

Now consider the case B≥1B\geq 1, and set g(x,y)=B2g(x/B,y/B)g(x,y)=B^{2}g(x/B,y/B). Then (x,y)∈[0,B]2(x,y)\in[0,B]^{2} implies

The full details for the proof of fast exponentiation are as follows.

This proof constructs a network implementing the russian peasant algorithm for exponentiation:

Set v\mathchar58=1v\mathrel{\mathop{\mathchar 58\relax}}=1.

For b∈bits-ltr(y)b\in\textup{bits-ltr}(y) (the bits of yy from left to right):

Set v\mathchar58=v2v\mathrel{\mathop{\mathchar 58\relax}}=v^{2}.

If b=1b=1, set v\mathchar58=vxv\mathrel{\mathop{\mathchar 58\relax}}=vx.

The two lines in the inner loop will use the squaring function ff from Section 3.1 and the multiplication function gg from Section 3.1, each with accuracy cϵc\epsilon where c\mathchar58=1/y2c\mathrel{\mathop{\mathchar 58\relax}}=1/y^{2}. At the end, the network returns σr(v)−σr(v−1)\sigma_{\textup{r}}(v)-\sigma_{\textup{r}}(v-1) to ensure the output lies in $;thisprocedurecannotincreasetheerror.Sincetheloopisinvoke; this procedure can not increase the error. Since the loop is invoke\mathcal{O}(\ln(y))timesandeachinnerlooprequiresanetworkofsizetimes and each inner loop requires a network of size\mathcal{O}(\ln(1/(c\epsilon)))=\mathcal{O}(\ln(y/\epsilon)),thefullnetworkhassize, the full network has size\mathcal{O}(\ln(y/\epsilon)^{2})$.

It remains to show that the network computes a function hh which satisfies

Let zjz_{j} denote the integer corresponding to the first jj bits of yy when read left-to-right; it will be shown by induction (on the bits of yy from left to right) that, at the end of the jjth invocation of the loop,

This suffices to establish the claim since then ∣v−xy∣≤y2cϵ=ϵ|v-x^{y}|\leq y^{2}c\epsilon=\epsilon.

For the base case, consider j=0j=0; then v=1=xz0=x0v=1=x^{z_{0}}=x^{0} as desired. For the inductive step, let ww denote vv at the end of the previous iteration, whereby the inductive hypothesis grants

The error after the approximate squaring step can be upper bounded as

The reverse inequality is proved analogously, thus

If the bit bb in this iteration is 0, then 2zj−1=zj2z_{j-1}=z_{j} and the proof for this loop iteration is complete. Otherwise b=1b=1, and

The proof of the reverse inequality is analogous, which establishes the desired error bound on vv for this loop iteration. ∎

Using the preceding exponentiation lemma, the proof of polynomial approximation is as follows.

It will be shown momentarily that a single monomial term can be approximating to accuracy ϵ/s\epsilon/s with a network of size O(min⁡{rln⁡(sr/ϵ),dln⁡(dsr/ϵ)2})\mathcal{O}\mathinner{\left(\min\{r\ln(sr/\epsilon),d\ln(dsr/\epsilon)^{2}\}\right)}. This implies the result by summing ≤s\leq s monomials comprising a polynomial, along with their errors.

For a single monomial, here are two constructions.

One approach is to product together ≤r\leq r individual variables (and lastly multiple by a fixed scalar coefficient), with no concern of the multiplicities of individual variables. To this end, let (y1,…,yk)(y_{1},\ldots,y_{k}) with s≤rs\leq r denote coordinates of the input variable so that ∏i=1kyi\prod_{i=1}^{k}y_{i} is the desired multinomial. Let gg denote multiplication with error ϵ0\mathchar58=ϵ/(rs)\epsilon_{0}\mathrel{\mathop{\mathchar 58\relax}}=\epsilon/(rs) as provided by Section 3.1. The network will compute αgi(y)\alpha g_{i}(y), where α∈[−1,+1]\alpha\in[-1,+1] is the scalar coefficient on the monomial, and gig_{i} is recursively defined as

The base case is immediate since g1(y)=y1=∏j=11yjg_{1}(y)=y_{1}=\prod_{j=1}^{1}y_{j}. For the inductive step,

and the reverse inequality is proved analogously.

Alternatively, the network uses the fast exponentiation routine from Section 3.1, and then multiplies together the terms for individual coordinates. In particular, the exponentiation for each coordinate with accuracy ϵ1\mathchar58=ϵ/(ds)\epsilon_{1}\mathrel{\mathop{\mathchar 58\relax}}=\epsilon/(ds) requires a network of size O(ln⁡(r/ϵ1)2)\mathcal{O}(\ln(r/\epsilon_{1})^{2}). By an analysis similar to the preceding construction, multiplying ≤d\leq d such networks will result in a network approximating the monomial with error ϵ/s\epsilon/s and size O(dln⁡(r/ϵ1)2)\mathcal{O}(d\ln(r/\epsilon_{1})^{2}).

Next, the proof that ReLU networks can efficiently compute reciprocals, namely Section 3.1. As stated in the text, it is first necessary to establish Section 3.1, which gives computes reciprocals at a choice of magnitude, and then Section 3.1, which combines these circuits across scales.

For each i∈{1,…,n}i\in\{1,\ldots,n\}, define the function

The functions (pi)i=1n(p_{i})_{i=1}^{n} have the following properties.

Each pip_{i} can be represented by a ReLU network with three nodes in 2 layers.

For any x∈[a1,an]x\in[a_{1},a_{n}], there exists j∈{1,…,n}j\in\{1,\ldots,n\} so that i∈{j,j+1}i\in\{j,j+1\} implies pi(x)≥0p_{i}(x)\geq 0 and i∉{j,j+1}i\not\in\{j,j+1\} implies pi(x)=0p_{i}(x)=0. Indeed, it suffices to let jj be the smallest element of {1,…,n−1}\{1,\ldots,n-1\}. satisfying x∈[aj,aj+1]x\in[a_{j},a_{j+1}].

For any x∈[a1,an]x\in[a_{1},a_{n}], ∑i=1npi(x)=1\sum_{i=1}^{n}p_{i}(x)=1.

The family (pi)i=1n(p_{i})_{i=1}^{n} thus forms a partition of unity over [a1,an][a_{1},a_{n}], moreover with the property that at most two elements, necessarily consecutive, are nonzero at any point in the interval.

By construction, gg is a ReLU network with O(ln⁡(B/ϵ)+max⁡iki)\mathcal{O}(\ln(B/\epsilon)+\max_{i}k_{i}) layers and O(nln⁡(B/ϵ)+∑imi)\mathcal{O}(n\ln(B/\epsilon)+\sum_{i}m_{i}) nodes.

It remains to check the approximation properties of gg. Let x∈[a1,an]x\in[a_{1},a_{n}] be given, and set j\mathchar58=min⁡{j∈{1,n−1}\mathchar58x∈[aj,aj+1]}j\mathrel{\mathop{\mathchar 58\relax}}=\min\mathinner{\left\{j\in\{1,n-1\}\mathrel{\mathop{\mathchar 58\relax}}x\in[a_{j},a_{j+1}]\right\}}. Then

By construction, qq is a ReLU network with O(rln⁡(1/ϵ0)2)\mathcal{O}(r\ln(1/\epsilon_{0})^{2}) nodes and O(ln⁡(1/ϵ0)2)\mathcal{O}(\ln(1/\epsilon_{0})^{2}) layers.

For the approximation property of qq, let x∈[a,b]x\in[a,b] be given, and note

Putting the pieces together gives the proof of the second part of the main theorem.

Define ϵ0\mathchar58=ϵ/22k+3\epsilon_{0}\mathrel{\mathop{\mathchar 58\relax}}=\epsilon/2^{2k+3}, and use Sections 3.1, 3.1 and 3.1 to choose ReLU network approximations fpf_{p} and fqf_{q} to pp and qq at resolution ϵ0\epsilon_{0}, as well as ReLU network ff for multiplication along 2^{2} and gg to approximate x↦1/xx\mapsto 1/x along [2−k−1,1][2^{-k-1},1], again at resolution ϵ0\epsilon_{0}. The desired network will compute the function hh, defined as

Combining the size bounds from the preceding lemmas, hh itself has size bound

Before verifying the approximation guarantee upon hh, it is necessary to verify that the inputs to ff and gg are of the correct magnitude, so that Sections 3.1 and 3.1 may be applied. Note firstly that g(fq(x))∈[1,2k+1]g(f_{q}(x))\in[1,2^{k+1}], since q(x)∈[2−k,1]q(x)\in[2^{-k},1] implies fq(x)∈[2−k−ϵ0,1]⊆[2−k−1,1]f_{q}(x)\in[2^{-k}-\epsilon_{0},1]\subseteq[2^{-k-1},1]. Thus 2−k−1g(fq(x))∈2^{-k-1}g(f_{q}(x))\in, and so both arguments to ff within the definition of hh are within $$. Consequently, the approximation guarantees of Sections 3.1, 3.1 and 3.1 all hold, whereby

The proof of the reverse inequality is analogous. ∎

B.2 Proof of Section 1.2

Let (U1,…,UN)(U_{1},\ldots,U_{N}) denote this final partition of [1/2,3/4][1/2,3/4], and let (δ1,…,δN)(\delta_{1},\ldots,\delta_{N}) denote the corresponding interval lengths. Let S⊆{1,…,N}S\subseteq\{1,\ldots,N\} index the subcollection of intervals with length at least 1/(8N)1/(8N), meaning S\mathchar58={j∈{1,…,N}\mathchar58δj≥1/(8N)}S\mathrel{\mathop{\mathchar 58\relax}}=\{j\in\{1,\ldots,N\}\mathrel{\mathop{\mathchar 58\relax}}\delta_{j}\geq 1/(8N)\}. Then

Consider now any interval UjU_{j} with endpoints {a,b}\{a,b\}. Since 1/2≤a<b≤3/41/2\leq a<b\leq 3/4, then ff satisfies 128/27≤f′′≤16128/27\leq f^{\prime\prime}\leq 16. In order to control the difference between ff and gg along UjU_{j}, consider two cases: either f≥gf\geq g along this interval, or f≤gf\leq g along this interval (these are the only two cases due to the subdivisions above).

If f≥gf\geq g, then gg can be taken to be a tangent to ff at some point along the interval [a,b][a,b] (otherwise, the distance can always be only decreased by moving gg up to be a tangent). Consequently, g(x)\mathchar58=f(c)+f′(c)(x−c)g(x)\mathrel{\mathop{\mathchar 58\relax}}=f(c)+f^{\prime}(c)(x-c) for some c∈[a,b]c\in[a,b], and by convexity and since f′′≥128/27f^{\prime\prime}\geq 128/27 over this interval,

On the other hand, if g≥fg\geq f, then gg passes above the secant line hh between (a,f(a))(a,f(a)) and (b,f(b))(b,f(b)). The area between ff and gg is at least the area between ff and hh, and this latter area is bounded above by a triangle of width (b−a)(b-a) and height

Combining this with b−a≤1/4b-a\leq 1/4, the triangle has area at least 3(b−a)/16≥3(b−a)33(b-a)/16\geq 3(b-a)^{3}.

Combining these two cases and summing across the intervals of SS (where j∈Sjj\in S_{j} implies δj≥1/(8N)\delta_{j}\geq 1/(8N)),