Minimum Width for Universal Approximation
Sejun Park, Chulhee Yun, Jaeho Lee, Jinwoo Shin
Introduction
The study of the expressive power of neural networks investigates what class of functions neural networks can/cannot represent or approximate. Classical results in this field are mostly focused on shallow neural networks. An example of such results is the universal approximation theorem (Cybenko, 1989; Hornik et al., 1989; Pinkus, 1999), which shows that a neural network with fixed depth and arbitrary width can approximate any continuous function on a compact set, up to arbitrary accuracy, if the activation function is continuous and nonpolynomial. Another line of research studies the memory capacity of neural networks (Baum, 1988; Huang and Babri, 1998; Huang, 2003), trying to characterize the maximum number of data points that a given neural network can memorize.
After the advent of deep learning, researchers started to investigate the benefit of depth in the expressive power of neural networks, in an attempt to understand the success of deep neural networks. This has led to interesting results showing the existence of functions that require the network to be extremely wide for shallow networks to approximate, while being easily approximated by deep and narrow networks (Telgarsky, 2016; Eldan and Shamir, 2016; Lin et al., 2017; Poggio et al., 2017). A similar trade-off between depth and width in expressive power is also observed in the study of the memory capacity of neural networks (Yun et al., 2019; Vershynin, 2020).
General activations.
Limitations of prior arts.
Note that none of the existing works succeeds in closing the gap between the upper bound (at least ) and the lower bound (at most ). This gap is significant especially for applications with high-dimensional codomains (i.e., large ) such as image generation (Kingma and Welling, 2013; Goodfellow et al., 2014), language modeling (Devlin et al., 2019; Liu et al., 2019), and molecule generation (Gómez-Bombarelli et al., 2018; Jin et al., 2018). In the prior arts, the main bottleneck for proving an upper bound below is that they maintain all neurons to store the input and all neurons to construct the function output; this means every layer already requires at least neurons. In addition, the proof techniques for the lower bounds only consider the input dimension regardless of the output dimension .
2 Summary of results
We mainly focus on characterizing the minimum width of ReLU networks for universal approximation. Nevertheless, our results are not restricted to ReLU networks; they can be generalized to networks with general activation functions. Our contributions can be summarized as follows.
Our proof techniques for tight upper bounds are not restricted to ReLU networks. In Theorem 4, we extend our results to general activation functions covered in Kidger and Lyons (2020).
3 Organization
We first define necessary notation in Section 2. In Section 3, we formally state our main results and discuss their implications. In Section 4, we present our “coding scheme” for proving upper bounds on the minimum width in Theorems 1, 3 and 4. In Section 5, we prove the lower bound in Theorem 2 by explicitly constructing a counterexample. Finally, we conclude the paper in Section 6. We note that all formal proofs of Theorems 1–4 are presented in Appendix.
Problem setup and notation
Throughout this paper, we consider fully-connected neural networks that can be described as an alternating composition of affine transformations and activation functions. Formally, we consider the following setup: Given a set of activation functions , an -layer neural network of input dimension , output dimension , and hidden layer dimensions For simplicity of notation, we let and . is represented as
where . While we mostly consider the cases where is a singleton (e.g., ), we also consider the case where contains both ReLU and Step activation functions as in Theorem 3. We denote a neural network with by a “ network” and a neural network with by a “+ network.” We define the width of as the maximum over .
For describing the universal approximation of neural networks, we say networks (or + networks) of width are dense in if for any and , there exists a network (or a + network) of width such that . Likewise, we say networks (or + networks) are dense in if for any and , there exists a network (or a + network) such that .
Minimum width for universal approximation
Notably, using our new proof technique, we overcome the limitation of existing upper bounds that require width at least . Our construction first encodes the dimensional input vectors into one-dimensional codewords, and maps the codewords to target codewords using memorization, and decodes the target codewords to dimensional output vectors. Since we construct the map from input to target using scalar codewords, we bypass the need to use hidden nodes. More details are found in Section 4. Proofs of the lower bounds are deferred to Appendices B.1, B.3.
Uniform approximation with ReLU.
Theorem 2 translates to , and the upper bound is given by Hanin and Sellke (2017). The key is to prove a lower bound , i.e., width is not sufficient. Recall from Section 1.1 that all the known lower bounds are limited to showing that width is insufficient for universal approximation. A closer look at their proof techniques reveals that they heavily rely on the fact that the hidden layers have the same dimensions as the input space. As long as the width , their arguments break because such a network maps the input space into a higher-dimensional space.
Although only for and , we overcome this limitation of the prior arts and show that width is insufficient for universal approximation, by providing a counterexample. We use a novel topological argument which comes from a careful observation on the image created by ReLU operations. In particular, we utilize the property of ReLU that it projects all negative inputs to zero, without modifying any positive inputs. We believe that our proof will be of interest to readers and inspire follow-up works. Please see Section 5 for more details.
Uniform approximation with ReLU+Step.
Theorem 2 and Theorem 3 indicate that the minimum width for universal approximation is indeed dependent on the choice of activation functions. This is also in contrast to the classical results where ReLU networks of depth are universal approximators (Leshno et al., 1993), i.e., the minimum depths for universal approximation are identical for both ReLU networks and ReLU+Step networks.
Theorem 3 comes from a similar proof technique as Theorem 1. Due to its discontinuous nature, the Step activation can be used in our encoder to quantize the input without introducing uniform norm errors. Lower bounds on can be proved in a similar way as Theorem 1 (see Appendices B.1, B.2).
General activations.
Our proof technique for upper bounds in Theorems 1 and 3 can be easily extended to networks using general activations. Indeed, we prove the following theorem, which shows that adding a width of is enough to cover the networks with general activations.
Please notice that unlike other theorems, Theorem 4 only proves an upper bound . We note that Theorem 4 significantly improves over the previous upper bound of width by (Kidger and Lyons, 2020, Remark 4.10).
Tight upper bound on minimum width for universal approximation
In this section, we present the main idea for constructing networks achieving the minimum width for universal approximation, and then sketch the proofs of upper bounds in Theorems 1, 3, and 4.
We now illustrate the main idea underlying the construction of neural networks that achieve the minimum width. To this end, we consider an approximation of a target continuous function ; however, our main idea can be easily generalized to other domain, codomain, and functions. Our construction can be viewed as a coding scheme in essence, consisting of three parts: encoder, memorizer, and decoder. First, the encoder encodes an input vector to a one-dimensional codeword. Then, the memorizer maps the codeword to a one-dimensional target codeword that is encoded with respect to the corresponding target . Finally, the decoder maps the target codeword to a target vector which is sufficiently close to . Note that one can view the encoder, memorizer, and decoder as functions mapping from -dimension to -dimension, then to -dimension, and finally to -dimension.
The spirit of the coding scheme is that the three functions can be constructed using the idea of the prior results such as (Hanin and Sellke, 2017). Recall that Hanin and Sellke (2017) approximate any continuous function mapping -dimensional inputs to -dimensional outputs using ReLU networks of width . Under this intuition, we construct the encoder, the memorizer, and the decoder by ReLU+Step networks (or ReLU networks) of width , respectively; these constructions result in the tight upper bound . Here, the decoder requires width instead of , as we only construct the first coordinates of the output, and recover the last output coordinate from a linear combination of the target codeword and the first coordinates.
Next, we describe the operation of each part. We explain their neural network constructions in subsequent subsections.
In other words, given any , preserves the first bits in the binary representation of and discards the rest; is mapped to . Note that the error from the quantization is always less than or equal to .
In other words, quantizes each coordinate of by a -bit binary representation and concatenates the quantized coordinates into a single scalar value having a -bit binary representation. Note that if one “decodes” a codeword back to a vector asHere, denotes the preimage of and is the Cartesian product of copies of .
then . Namely, the “information loss” incurred by the encoding can be made arbitrarily small by choosing large .
Memorizer.
where is applied coordinate-wise for a vector. We note that is well-defined as each corresponds to a unique . Here, one can observe that the target of the memorizer contains the information of the target value since \mathtt{encode}_{M}\big{(}f^{*}\circ q_{K}(x)\big{)} contains information of at a quantized version of , and the information loss due to quantization can be made arbitrarily small by choosing large enough and .
Decoder.
The decoder decodes each codeword generated by the memorizer by the function defined as
Combining , , and completes our coding scheme for approximating . One can observe that our coding scheme is equivalent to which can approximate the target function within any error, i.e.,
In the remainder of this section, we discuss how each part of the coding scheme can be implemented with a neural network using ReLU+Step activations (Section 4.2), ReLU activation (Section 4.3), and other general activations (Section 4.4).
2 Tight upper bound on minimum width of ReLU+Step networks (Theorem 3)
First, the encoder consists of quantization functions and a linear transformation. However, as is discontinuous and cannot be uniformly approximated by any continuous function, we utilize the discontinuous Step activation to exactly construct the encoder via a ReLU+Step network of width . On the other hand, the memorizer and the decoder maps a finite number of scalar values (i.e., and , respectively) to their target values/vectors. Such maps can be easily implemented by continuous functions (e.g., via linear interpolation), and hence, can be exactly constructed by ReLU networks of width and , respectively, as discussed in Section 4.1. Note that Step is used only for constructing the encoder.
In summary, all parts of our coding scheme can be exactly constructed by ReLU+Step networks of width , , and . Thus, the overall ReLU+Step network has width . Furthermore, it can approximate the target continuous function within arbitrary uniform error by choosing sufficiently large and . We present the formal proof in Appendix A.1.
3 Tight upper bound on minimum width of ReLU networks (Theorem 1)
Since the memorizer and the decoder can be exactly constructed by ReLU networks, we only discuss the encoder here. As we discussed in the last section, the encoder cannot be uniformly approximated by continuous functions (i.e., ReLU networks). Nevertheless, it can be implemented by continuous functions except for a subset of the domain around the discontinuities, and this subset can be made arbitrarily small in terms of the Lebesgue measure. That is, we construct the encoder using a ReLU network of width for except for a small subset, which enables us to approximate the encoder in the -norm. Combining with the memorizer and the decoder, we obtain a ReLU network of width that approximates the target function in the -norm. We present the formal proof in Appendix A.2.
4 Tightening upper bound on minimum width for general activations (Theorem 4)
Tight lower bound on minimum width for universal approximation
If , then .
If , then .
Lemma 5 follows from the fact that output of ReLU is identity to nonnegative coordinates, and is zero to negative coordinates. In particular, and in Lemma 5 correspond to the axes of the “modified” coordinate system before applying . Under the same property of ReLU, Lemma 6 states that if a point is surrounded by a set , after applying , either the point stays at the same position and surrounded by the image of or intersects with the image of . Based on these observations, we are now ready to introduce our counterexample.
2 Counterexample
Conclusion
The universal approximation property of width-bounded networks is one of the fundamental problems in the expressive power theory of deep learning. Prior arts attempt to characterize the minimum width sufficient for universal approximation; however, they only provide upper and lower bounds with large gaps. In this work, we provide the first exact characterization of the minimum width of ReLU networks and ReLU+Step networks. In addition, we observe interesting dependence of the minimum width on the target function classes and activation functions, in contrast to the minimum depth of classical results. We believe that our results and analyses would contribute to a better understanding of the performance of modern deep and narrow network architectures.
Acknowledgements
CY acknowledges financial supports from NSF CAREER Grant Number 1846088 and Korea Foundation for Advanced Studies.
References
Appendix A Proofs of upper bounds
In this section, we first provide proofs of upper bounds in Theorems 1, 3, 4. Throughout this section, we denote the coordinate-wise ReLU by and we denote the -th coordinate of an output of a function by .
Our construction is based on the three-part coding scheme introduced in Section 4.1. First, consider constructing a ReLU+Step network for the encoder. From the definition of , one can observe that the mapping is discontinuous and piece-wise constant. Hence, the exact construction (or even the uniform approximation) of the encoder requires the use of discontinuous activation functions such as Step (recall its definition ). We introduce the following lemma for the exact construction of . The proof of Lemma 8 is presented in Appendix A.4.
For constructing the encoder via a ReLU+Step network of width , we apply to each input coordinate, by utilizing the extra width and using Lemma 8. Once we apply for all input coordinates, we apply the linear transformation to obtain the output of the encoder.
On the other hand, the memorizer only maps a finite number of scalar inputs to the corresponding scalar targets, which can be easily implemented by piece-wise linear continuous functions. We show that the memorizer can be exactly constructed by a ReLU network of width 2 using the following lemma. The proof of Lemma 9 is presented in Appendix A.5.
Likewise, the decoder maps a finite number of scalar inputs in to corresponding target vectors in . Here, each coordinate of a target vector corresponds to some consequent bits of the binary representation of the input. Under the similar idea used for our implementation of the memorizer, we show that the decoder can be exactly constructed by a ReLU network of width using the following lemma. The proof of Lemma 10 is presented in Appendix A.6.
A.2 Proof of tight upper bound in Theorem 1
Namely, if we construct a ReLU network such that , then it completes the proof. Throughout this proof, we assume that the support of is a subset of and its codomain to be which can be easily generalized to arbitrary compact support and arbitrary codomain, respectively.
We approximate by a ReLU network using the three-part coding scheme introduced in Section 4.1. We will refer to our implementations of the three parts as , , and . That is, we will approximate by a ReLU network
However, unlike our construction of ReLU+Step networks in Section A.1, Step is not available, i.e., uniform approximation of is impossible. Nevertheless, one can approximate with some continuous piece-wise linear function by approximating regions around discontinuities with some linear functions. Under this idea, we introduce the following lemma. The proof of Lemma 11 is presented in Appendix A.7.
By Lemma 11, there exist a ReLU network of width and such that ,
We approximate the encoder by . Here, we note that inputs from would be mapped to arbitrary values by . Nevertheless, it is not critical to the error as can be made arbitrarily small by choosing a sufficiently small .
To achieve this, we design the memorizer for using Lemma 9 and based on (4) as
We note that such a design incurs an undesired error that a subset of might be mapped to zero after applying . Nevertheless, mapping to zero is not critical to the error as can be made arbitrarily small by choosing a sufficiently large .
Finally, we bound the error utilizing the following inequality:
By choosing sufficiently large and sufficiently small , one can make the RHS smaller than as . This completes the proof of the tight upper bound in Theorem 1.
A.3 Proof of Theorem 4
Before describing our construction, we first introduce the following lemma.
We note that Proposition 4.9 by Kidger and Lyons (2020) only ensures ; however, its proof provides as well.
The proof of Theorem 4 also utilizes our coding scheme; here, we approximate ReLU network constructions , , and in Appendix A.2 by networks. Using Lemma 12, for any , we approximate by a network of width so that
and . We note that is possible as there exists (i.e., a ReLU network) such that by Lemma 9.
For approximating the decoder, we introduce the following lemma. The proof of Lemma 13 is presented in Appendix A.8.
Namely, .
and .
We approximate by a network of width defined as
Here, for any , by choosing sufficiently large , sufficiently large , and sufficiently small so that and \omega_{\mathtt{decode}_{M}^{\ddagger}}\big{(}\omega_{\mathtt{memorize}_{K,M}^{\ddagger}}(\varepsilon_{1})+\varepsilon_{2}\big{)}+\varepsilon_{3}\leq\frac{\eta}{2}, we have
where and are defined on and , respectively.
Finally, we bound the error utilizing the following inequality:
By choosing sufficiently small , sufficiently large , and sufficiently large , one can make the RHS smaller than due to (5) and the fact that . This completes the proof of Theorem 4.
A.4 Proof of Lemma 8
This directly implies that for all and completes the proof of Lemma 8.
A.5 Proof of Lemma 9
Then, from Lemma 14, there exists a ReLU network of width 2 such that for all . Since and f^{\dagger}(\mathcal{I})\subset\big{[}\min f^{*}(\mathcal{X}),\max f^{*}(\mathcal{X})\big{]}, this completes the proof of Lemma 9.
Suppose that is linear on intervals and parametrized as
Then, the following construction of completes the proof of the mathematical induction:
where . This completes the proof of Lemma 14. ∎
A.6 Proof of Lemma 10
Before describing our proof, we first introduce the following lemma. The proof of Lemma 15 is presented in Appendix A.9.
and Furthermore, it holds that
A.7 Proof of Lemma 11
To begin with, we introduce the following Lemma. The proof of Lemma 16 is presented in Appendix A.10.
Note that we use for denoting the coordinate-wise for a vector .
Now, we define . Then, from constructions of and , we have
where we use the fact that and .
Finally, we construct a ReLU network of width as
In addition, if we choose sufficiently small and so that , then satisfies all conditions in Lemma 11. This completes the proof of Lemma 11.
A.8 Proof of Lemma 13
The proof of Lemma 13 is almost identical to that of Lemma 10. In particular, we approximate the ReLU network construction of iterative applications of (see Appendix A.6 for the definition of ) by a network of width . To this end, we consider a network of width approximating on some interval within error using Lemma 12. Then, one can observe that iterative applications of (as in Appendix A.6) results in a network of width . Here, passing through the identity function can be approximated using a network of width , i.e., same width to ReLU networks (see Lemma 4.1 by Kidger and Lyons (2020) for details). Furthermore, since is uniformly continuous on , it holds that for all and by choosing sufficiently large and sufficiently small so that .We consider on . This completes the proof of Lemma 13.
A.9 Proof of Lemma 15
We first clip the input to be in $1$.
completes the proof. Note that as for all , . Now, we describe how to construct by a ReLU network. One can observe that and
for all , i.e., alternating applications of and . Finally, we introduce the following definition and lemma.
We note that Proposition 2 by Hanin and Sellke (2017) itself only ensures ; however, its proof provides as well.
From the definition of the max-min string, one can observe that is a max-min string. Hence, by Lemma 17, there exists a ReLU network of width such that for all . This completes the proof of Lemma 15.
A.10 Proof of Lemma 16
Appendix B Proofs of lower bounds
where denotes the projection onto . As projection is contraction and the distance between any two points are at most , it holds that for any ,
for . This completes the proof of Lemma 18. ∎
B.2 Proof of tight lower bound in Theorem 3
Without loss of generality, we assume that has hidden neurons at each layer except for the output layer and all affine transformations in are invertible (see Section 5.1).
Our main idea is to utilize properties of level sets of width- ReLU+Step networks (Hanin and Sellke, 2017) defined as follows: Given a network of width , we call a connected component of for some as a level set. Level sets of ReLU+Step networks have a property described by the following lemma. We note that the statement and the proof of Lemma 19 is motivated by Lemma 6 of (Hanin and Sellke, 2017).
Let be a Step+ReLU network of width containing at least one Step. Then, for any level set of , is unbounded unless it is empty.
Now, we continue the proof of the tight lower bound in Theorem 3 based on Lemma 19. We note that our argument is also from the proof of the lower bound in Theorem 1 of (Hanin and Sellke, 2017).
Then, for and , one can observe that is a sphere of radius centered at . Namely, any path from to infinity must intersect with . Now, suppose that a ReLU+Step network of width satisfies that . Then, the level set of containing must be unbounded by Lemma 19, and hence, must intersect with . However, as and , this contradicts with . This completes the proof of the tight lower bound in Theorem 3.
B.3 Proof of tight lower bound in Theorem 1
Note that this statement can be easily generalized to an arbitrary codomain. To derive the statement, we prove a stronger statement: For any ReLU network of width , either
where denotes that is a constant function mapping any input to zero. Then it leads us to the desired result directly. Without loss of generality, we assume that has hidden neurons at each layer except for the output layer and all affine transformations in are invertible (see Section 5.1).
This completes the proof of the tight upper bound in Theorem 1.
B.4 Proof of Lemma 5
i.e., , then . Hence, the first statement of Lemma 5 holds.
Now, consider the second statement of Lemma 5. Suppose that but . Then, one can easily observe that maps a ray
containing to a single point \phi^{-1}\big{(}(\langle a_{1},x\rangle+b_{1},0)\big{)}, which is on . In addition, similar arguments hold for cases that , and , . This completes the proof of Lemma 5.
B.5 Proof of Lemma 6
Let be the first point in in the trajectory of starting from . Then, the preimage of contains a ray starting from (see the proof of Lemma 5 for the details) which must not intersect with ; had the ray intersected with , then must have mapped to , which contradicts and the definition of . Furthermore, from the definition of , the subpath of from to excluding satisfies . Hence, the preimages of and under stay identical by Lemma 5. This implies that there exist a path from to , and then a path from to infinity, not intersecting with . This contradicts the assumption of Lemma 6. This completes the proof of the first statement of Lemma 6.
Now, consider the second statement of Lemma 6. By Lemma 5, implies that and . Here, as the preimage of contains a ray from containing , this ray must intersect with from the assumption of Lemma 6. Hence, and this completes the proof of the second statement of Lemma 6.
By combining the proofs of the first and the second statements of Lemma 6, we complete the proof of Lemma 6.
B.6 Proof of Lemma 7
Before starting our proof, we first introduce the following definitions and lemma. The proof of Lemma 21 is presented in Appendix B.7.
is a “curve” if there exists .
is a “simple curve” if there exists injective .
is a “loop” if there exists such that .
is a “simple loop” if there exists such that and is injective on .
is a “polygon” if there exists piece-wise linear such that .
is a “simple polygon” if there exists piece-wise linear such that and is injective on .
which is illustrated by the red dot in Figure 3. Then, we claim the following statement:
To prove the claim (11), we first introduce the following lemma.