Recently, Steven Weng (a rising Sophomore at University of British Columbia and an intern at Slipbox.ai) asked me about the ability of a neural network to approximate any function arbitrarily close. His question got me to rethink about neural network approximation of continuous functions, and I wondered if there is a depth analogue to the width version of the universal approximation theorem for neural networks. Sure enough, there are some nice results in the literature. Let me explain.
In the case of arbitrary width in the Universal Approximation Theorems, the number of neurons in the hidden layer is allowed to grow without bound while the depth remains fixed. It has been shown that a neural network with a single hidden layer and a suitable non-polynomial activation function such as sigmoid, ReLU, or tanh can approximate any continuous function on a compact domain to arbitrary precision. Increasing the number of neurons increases the number of folds or linear segments in the output, enabling increasingly accurate approximations. These results establish that shallow networks are universal approximators in theory, although the required width for complex functions can be very large.
In the case of arbitrary depth, the width is fixed and the number of layers can grow. Research has shown that networks with width n+1 (“n” is the input dimension) and arbitrary depth can approximate any continuous function in a compact domain arbitrarily well. However, extremely narrow networks, such as those with width one using ReLU activation, have limited expressibility and cannot represent most functions. Increasing depth allows more complex piecewise-linear approximations, and with a minimum sufficient width, deep networks become universal approximators.
What is the intuition behind why the width version seems to work differently from the depth version? A reasonable answer to this question, that I can think of, is as follows.
A wide network with a single hidden layer and a large number of neurons essentially acts like a sum of simple functions, which are the activations of each neuron. Each neuron can be viewed as a basis function, similar to sine waves in Fourier series or polynomials in Taylor series. The network forms a linear combination of these basis functions after the nonlinear activation. By increasing the number of neurons, or the width, one can obtain a richer and more flexible basis set that can closely approximate or tile any target function’s shape on the input domain.
In the depth version, deep networks reuse neurons across layers to build hierarchical or compositional features. Even when the depth is unlimited but the width is very small, the network has fewer basis functions to combine, so it may not approximate arbitrary functions as flexibly as a very wide network can. This is why some universality results for deep networks require a certain minimum width.