Universal Approximation
One hidden layer with a non-polynomial activation can approximate any continuous function on a compact set to arbitrary accuracy: the universal approximation theorem. We prove it constructively (two sigmoids make a bump; sums of bumps make any curve), then show the limitation: existence is not efficiency.
╌╌╌╌
The multilayer perceptron
solved XOR by inserting one nonlinear hidden layer. The natural next question is
how much a single hidden layer can represent. The answer: a net with one hidden
layer is already a universal approximator. The limitation is that can represent
says nothing about can represent cheaply,
and the gap between the
two is exponential.
The theorem
Let be continuous on a compact set . A single-hidden-layer network with units computes
an affine readout of nonlinear features, each a neuron with weights , bias , and output coefficient . The classical result (Cybenko 1989 for the sigmoid; Hornik, Stinchcombe & White 1989; Hornik 1991 for the general activation; Leshno et al. 1993 for the sharp condition) says this family is dense in the continuous functions on .1
Leshno, Lin, Pinkus & Schocken (1993) sharpened this to an iff: a single-hidden-layer network with a continuous activation is dense in if and only if is non-polynomial, so non-polynomiality is the exact boundary, not merely one sufficient condition.
The theorem has two hypotheses, and dropping either breaks the result.
| Hypothesis | Why it is needed | What breaks without it |
|---|---|---|
| non-polynomial | a degree- polynomial activation keeps a degree- polynomial in — a finite-dimensional space, never dense | the net can only ever output polynomials |
| compact, continuous | uniform approximation needs uniformly continuous; on unbounded domains the tails escape | error blows up off the compact set |
The non-polynomial hypothesis is quick to see in one line. If is a polynomial of degree , then each feature is a polynomial of degree in the coordinates of , and a finite sum of degree- polynomials is again a polynomial of degree . So lives in the space of polynomials of degree at most in variables, a fixed -dimensional subspace of , no matter how large grows. A fixed finite-dimensional subspace cannot be dense in the infinite-dimensional : pick any outside its closure (say degree ) and no width helps. The moment has a non-vanishing derivative of every order at some point (as , , and piecewise effectively do), the features are no longer confined to a finite-dimensional subspace and their span is dense in .
Note what the theorem does not promise: nothing about how large must be, nothing about whether gradient descent can find the parameters, and nothing about behavior off . It is a statement of pure expressivity.2
A constructive proof: bumps from sigmoids
Cybenko's original argument is a functional-analysis duality (a measure that annihilates every must be zero). But the constructive proof is more instructive and generalizes to ReLU: build a localized bump from two opposed sigmoids, then tile the domain with bumps.
Work in one dimension and write the logistic sigmoid . A single steep sigmoid approximates a step: as the gain ,
a unit step rising at . Subtract a second step that rises later, at , and the difference is a bump, a feature that is on inside and off everywhere else:
Scaling the bump by a height and placing it over a thin interval gives a single rectangular tile of any height. Now partition into slabs of width at grid points , and choose each tile's height to match the target there, . The sum of tiles is a step function shadowing :
This is precisely a Riemann sum rendered as a network. Each tile uses two hidden units, so has units; uniform continuity of controls the error.3
For example, take a bump centred on with gain : the network computes . At the left edge the first sigmoid sits at while the second is , so the bump reads ; at the centre both arguments are , giving ; outside both sigmoids are saturated the same way and cancel to under . The transition band where the bump is neither nor its plateau has width , and it shrinks as . That transition band is the only source of the per-bump error, which is why the proof sends after fixing the grid: first choose the grid fine enough for the staircase to track , then choose large enough for each bump to track its indicator.
The ReLU version: ramps, not bumps
The modern activation is the ReLU, which is piecewise linear, so the natural building block is a ramp rather than a step. A single ReLU is a hinge that turns on at ; differences of shifted ReLUs build a basis of hinges, and any combination of hinges is a continuous piecewise-linear function with at most breakpoints:
The coefficient measures the change in slope at the breakpoint . To see this: to the left of the term is flat at ; to the right it contributes slope . So the slope of jumps by exactly as crosses , and the slope on the piece after the -th breakpoint is the running sum . To interpolate a target sampled on a uniform grid , match slopes: the desired slope on piece is the forward difference , so the required jump is the second difference
a discrete curvature. Where is convex the jumps are positive, where concave negative, and where is already linear they vanish: units are needed only where the target bends. The network becomes a linear spline through the sampled points, using one hidden unit per interior grid point.
The accounting is exact: one hidden unit adds one breakpoint, hence at most one extra linear piece. A shallow ReLU net's expressivity is linear in its width. The depth-separation results below rest on this fact.
Existence is not efficiency
The theorem is an existence statement: some width works. It is silent on how large must be, and for many natural functions is exponentially large unless the network is deep. This is the content of depth-separation theorems.4
Recall the shallow bound: a one-layer ReLU net of width produces at most linear pieces. Now compose. Let be the sawtooth / tent map, , a single fold built from two ReLUs. Written out, on : two units of positive slope and a middle unit that reverses it, giving the rising-then-falling tent.
The folding mechanism is the point. maps onto but sends both halves and across the full range , folding the interval in half like paper. So if a function has linear pieces on , the composition replays all pieces on each half, giving pieces. A network that applies a second time folds the already-folded line, doubling the number of linear segments; layers of folding produce teeth from a linear seed.
A depth- folding net produces linear pieces with units; a single-layer net, capped at pieces, needs width to match — an exponential separation, and not an isolated example.
The mechanism is region-counting, and the arithmetic is worth stating precisely. In input dimensions, a single hidden layer of width places hyperplanes (one activation boundary per unit); the number of regions hyperplanes carve into is , which for fixed is polynomial in (additive-flavoured growth, roughly ). Stacking layers composes the partition instead of unioning it: each new layer of width re-cuts every region the earlier layers produced, so the counts multiply. The sharpest known bound for an -layer, width- ReLU net is on the order of
exponential in depth but only polynomial in width . The asymmetry — depth in the exponent, width in the base — decides the comparison: reaching regions costs layers or units, and the former is exponentially cheaper.
Shallow versus deep
The two regimes represent the same function class (both are universal) but at very different cost in units.
| Property | Shallow (1 hidden layer) | Deep ( layers) |
|---|---|---|
| Universal approximator | yes (Cybenko/Hornik) | yes |
| Linear regions (ReLU) | — additive in width | — multiplicative in depth |
| Units for -piece sawtooth | ||
| Parameter / sample efficiency | poor — width must explode | strong — reuse of features |
| Optimization | one convex-ish layer, easy to fit | non-convex, but trains in practice |
| Inductive bias | none beyond smoothness | compositional structure |
The deep column wins on representation and statistics; the shallow column wins on optimization simplicity. Real-world functions are overwhelmingly compositional (an object is parts of edges of pixels), and that compositional structure is what depth encodes cheaply while width can only imitate at exponential cost.5
Necessary, but not sufficient
Universal approximation is a statement about the existence of good parameters, and it is silent on the two questions that actually decide whether a network works in practice.
| Question | What universality says | Where it is settled |
|---|---|---|
| Can the function be represented? | yes — that is the theorem | this lesson |
| Will gradient descent find the parameters? | nothing | optimization landscape |
| Will it generalize from finite data? | nothing | generalization theory |
A net that can represent the target may still be impossible to train (the loss surface is non-convex) or may memorize the training set without generalizing (too much capacity, too little data). The expressivity question closed here hands off to the optimization question (can we reach the good parameters?) and the generalization question (do they say anything about unseen data?).
Sharper approximation bounds
Goodfellow states universality and depth separation; the surrounding literature sharpens both the width bound and the rate, and reframes what the theorem does not buy.
How the width scales matters as much as that it is finite. The bare theorem lets as with no rate, but Barron (1993) proved a rate for functions whose Fourier transform has a bounded first moment: a one-hidden-layer sigmoid net achieves error with units, independent of the input dimension . This is why neural nets can avoid the curse of dimensionality on structured targets — a grid-based approximator would need units, exponential in , while a Barron-class function needs only . Depth separation (Telgarsky 2016; Eldan & Shamir 2016 exhibited a function deep nets fit with polynomial width that any shallow net needs exponential width to match) is the complementary result: not just how many units, but how the count depends on depth.
Universality also holds with bounded width and unbounded depth. The classical statement fixes depth at one and grows width. Lu et al. (2017) and Hanin & Sellke (2017) proved the dual: a ReLU network of bounded width (roughly to for inputs in ) is a universal approximator if allowed to grow deep. So both knobs reach every continuous function; the region-counting argument of the last section explains why the deep-narrow route is usually the efficient one.
Existence is not the limiting question in modern practice. The modern view, sharpened by the double-descent and overparameterization literature (Belkin et al., 2019; the neural-tangent-kernel analysis of Jacot et al., 2018), is that real networks operate far past the point where they can fit the data — they can fit random labels outright (Zhang et al., 2017). What decides success is not the approximation floor this lesson establishes but the implicit bias of gradient descent toward particular solutions among the infinitely many that interpolate. Universality tells you the target is reachable; it says nothing about which of the many perfect fits the optimizer will actually land on, which is the subject the generalization lessons take up.6
Takeaways
- Universal approximation (Cybenko 1989 / Hornik 1991): one hidden layer with any continuous non-polynomial activation approximates any continuous on a compact set to arbitrary uniform accuracy. Non-polynomial and compact are the two load-bearing hypotheses.
- The constructive proof builds a localized bump from two opposed sigmoids, , then sums scaled bumps into a Riemann-style staircase shadowing . The ReLU version sums shifted ramps into a linear spline, one unit per breakpoint.
- Existence is not efficiency. A shallow ReLU net has linear regions (additive in width); a deep net has (multiplicative in depth).
- Depth separation (Telgarsky 2016; parity): the sawtooth needs units deep but units shallow — an exponential gap.
- Universality is necessary but not sufficient: it crushes approximation error to but says nothing about trainability or generalization.
Footnotes
- Goodfellow, Deep Learning, §6.4.1 — Universal Approximation Properties and Depth: a single hidden layer with a non-polynomial activation is dense in , with no bound on the width required. ↩
- Goodfellow, Deep Learning, §6.4 — Architecture Design: the theorem promises only existence — not the width, not that gradient descent finds the weights, not behavior off the compact set. ↩
- Chollet, Deep Learning with Python, Ch. 4–5 — model capacity: enough units can represent (and overfit) any target, so capacity must be balanced against data, not maximized. ↩
- Goodfellow, Deep Learning, §6.4.1 — depth-separation: functions a deep ReLU net represents with units force a shallow net to width ; depth multiplies linear regions, width only adds them. ↩
- Goodfellow, Deep Learning, §6.4.1 / §15.4 — the compositional prior: real-world targets factor as parts-of-parts, the structure depth encodes cheaply and a shallow net must pay exponentially to imitate. ↩
- Primary sources: Barron,
Universal Approximation Bounds for Superpositions of a Sigmoidal Function
(1993) for the dimension-independent rate; Eldan & Shamir,The Power of Depth for Feedforward Neural Networks
(2016) and Telgarsky,Benefits of Depth in Neural Networks
(2016) for depth separation; Lu et al.,The Expressive Power of Neural Networks: A View from the Width
(2017) and Hanin & Sellke (2017) for bounded-width universality; Zhang et al.,Understanding Deep Learning Requires Rethinking Generalization
(2017), Jacot et al.,Neural Tangent Kernel
(2018), and Belkin et al.,Reconciling Modern Machine Learning and the Bias-Variance Trade-off
(2019) for why interpolation, not existence, is the live question. ↩
╌╌ END ╌╌