Tutorials › Statistical Learning (Graduate) › Depth-Width Tradeoffs In Function Approximation

Neural Approximation Theory · Tutorial 902 of 989

Depth-Width Tradeoffs In Function Approximation

Learn how depth and width budgets affect approximation constructions, including explicit comparisons for polynomial targets and a smooth function.

Advanced 13 min read

What You'll Learn

  • Distinguish network depth, width, and total hidden-unit count when comparing approximation budgets.
  • Derive the one-dimensional ReLU spline error bound and its unit cost.
  • Track approximation error when composing ReLU multiplication modules to build powers.
  • Compare shallow and deep constructions for quadratic and quartic targets.
  • Build a deep approximation to sine from a Taylor polynomial and controlled power errors.
  • Recognize why these construction bounds do not imply that deeper networks always need fewer units.

Why Compare Depth and Width?

An approximation bound is only part of an architecture choice. Two networks can attain the same error with very different numbers of hidden layers, maximum layer sizes, and total hidden units. Depth can let a network reuse a small operation many times; a shallow network may instead need many units in parallel. The tradeoff depends on the target and the construction, so it is important to compare explicit budgets rather than treat depth as an automatic advantage.

This tutorial compares ReLU spline approximations with constructions based on the multiplication module established in the earlier material on ReLU networks for multiplication. The comparison is for particular targets and explicit upper bounds. It is not a general lower bound for shallow networks, nor does it say that every deeper architecture is more efficient.

Definition: For a feedforward network, depth is the number of hidden layers, width is the largest number of units in any hidden layer, and size is the total number of hidden units. A budget may constrain any one or all of these. The constructions below use ReLU hidden units, sparse connections, and an affine output.

We use the following form of the multiplication approximation result from the earlier material: there is a constant \(C\) such that, for every \(0<\delta\leq 1\), a ReLU network \(M_\delta\) approximates \(uv\) uniformly on \([-2,2]^2\) with error at most \(\delta\), has width bounded by a constant, and has depth and size at most \(C(1+\log(1/\delta))\). The added \(1\) is important: at \(\delta=1\), a zero-unit bound would not describe a valid multiplication approximation. We use the module as a building block, keeping track of the range of every input passed to it.

A Shallow Baseline: Piecewise-Linear Approximation

Let \(f\) be twice continuously differentiable on \([a,b]\), with \(|f''(x)|\leq M\). Divide the interval into \(N\) equal subintervals and linearly interpolate \(f\) at the \(N+1\) endpoints. On a subinterval \([u,v]\) of length \(h=(b-a)/N\), the interpolation error satisfies

$$ |f(x)-L(x)|\leq \frac{M}{2}|(x-u)(x-v)| \leq \frac{Mh^2}{8}. $$

For the first inequality, when \(x\) is interior to \([u,v]\), the interpolation remainder formula gives \(f(x)-L(x)=f''(\xi)(x-u)(x-v)/2\) for some \(\xi\in(u,v)\). The endpoints have zero error. The second inequality follows because \(|(x-u)(x-v)|\leq h^2/4\). Thus \(N\geq \sqrt{M(b-a)^2/(8\varepsilon)}\) suffices for uniform error at most \(\varepsilon\).

A continuous piecewise-linear function with knots \(t_1,\ldots,t_{N-1}\) can be represented as an affine function plus a weighted sum of \(\sigma(x-t_j)\), where \(\sigma(z)=\max\{z,0\}\). The coefficient of each ReLU term is the change in slope at that knot. Hence this interpolant is represented by a one-hidden-layer network with \(N-1\) hidden units.

Worked Example: Approximating the Square

Approximate \(f(x)=x^2\) on \([-1,1]\) to uniform error at most \(\varepsilon=0.01\). Since \(f''(x)=2\), take \(M=2\), \(b-a=2\). The interpolation bound is \(Mh^2/8=1/N^2\), so \(N=10\) intervals suffice:

$$ \|f-L\|_\infty\leq \frac{1}{10^2}=0.01. $$

The interpolant uses \(N-1=9\) hidden units in one hidden layer. Alternatively, apply \(M_\delta\) to \((x,x)\) with \(\delta=0.01\). Both inputs lie in \([-2,2]\), and the output approximates \(x^2\) within \(0.01\). This deep construction has constant width and depth and size at most \(C(1+\log 100)\). The comparison is between two valid upper bounds; the constant \(C\) is not specified, so these bounds alone do not establish which network has fewer units at this particular tolerance.

Composing Multiplication Modules to Build Powers

A multiplication module can be reused to form powers. The key is to control how local errors accumulate and to check that approximate intermediate values stay in the module’s input range.

Lemma: Let \(x\in[-1,1]\), \(0<\eta\leq1\), and define \(q_1=x\) and \(q_{k+1}=M_\eta(x,q_k)\). If \(m\eta\leq1\), then, for \(1\leq k\leq m\), the construction is well-defined and \(\lvert q_k-x^k\rvert\leq(k-1)\eta\), with \(q_k\in[-2,2]\).

Proof. The claim holds for \(k=1\): \(q_1=x\), so its error is zero and \(q_1\in[-1,1]\). Suppose it holds at \(k\). Then \(q_k\in[-2,2]\), and \(x\in[-1,1]\subset[-2,2]\), so the multiplication module applies. Its error guarantee gives

$$ |q_{k+1}-x^{k+1}| \leq |q_{k+1}-xq_k|+|x|\,|q_k-x^k| \leq \eta+(k-1)\eta=k\eta. $$

Also, \(|q_{k+1}|\leq |x|^{k+1}+k\eta\leq1+m\eta\leq2\). Induction proves both claims. \(\square\)

Worked Example: A Deep Approximation to the Fourth Power

For \(x\in[-1,1]\), use two modules with tolerance \(\eta\): set \(q_1=M_\eta(x,x)\), then \(q_2=M_\eta(q_1,q_1)\). The first output satisfies \(|q_1-x^2|\leq\eta\), and \(|q_1|\leq1+\eta\leq2\), so both inputs to the second module are in range. Therefore

$$ \begin{aligned} |q_2-x^4| &\leq |q_2-q_1^2|+|q_1^2-x^4|\\ &\leq \eta+|q_1-x^2|\,|q_1+x^2|\\ &\leq \eta+\eta(2+\eta) \leq 4\eta, \end{aligned} $$

where the last inequality uses \(\eta\leq1\). For \(0<\varepsilon\leq4\), taking \(\eta=\varepsilon/4\) gives error at most \(\varepsilon\). The two modules have total size at most \(2C(1+\log(4/\varepsilon))\), constant width, and depth at most \(2C(1+\log(4/\varepsilon))\), up to the wiring needed to compose them.

For comparison, \(f(x)=x^4\) has \(|f''(x)|=|12x^2|\leq12\) on \([-1,1]\). The spline bound gives error at most \(6/N^2\), so \(N\geq\sqrt{6/\varepsilon}\) intervals suffice, using \(N-1\) hidden units in one layer. In this example the deep construction has logarithmic size as a function of \(1/\varepsilon\), whereas the displayed shallow construction has size proportional to \(\varepsilon^{-1/2}\). These are sufficient budgets, not a claim that every shallow network must use that many units.

A Smooth Target: From Taylor Approximation to a Network

For a smooth function, a deep construction can combine two savings: a polynomial may approximate the target rapidly, and a multiplication-based network can evaluate that polynomial using controlled intermediate errors. We work through \(f(x)=\sin x\) on \([-1,1]\). This target is infinitely differentiable, and every derivative has absolute value at most one.

Let \(P_m(x)=\sum_{k=0}^{m}a_kx^k\) be the Taylor polynomial of \(\sin x\) at zero, with \(m\) odd. Taylor’s theorem with remainder gives

$$ \|\sin-P_m\|_\infty\leq\frac{1}{(m+1)!}. $$

Choose an odd \(m\) for which \((m+1)!\geq2/\varepsilon\); the Taylor error is then at most \(\varepsilon/2\). To evaluate the polynomial, construct approximate powers \(q_k\) as in the lemma and form \(\widetilde P_m(x)=\sum_{k=0}^{m}a_kq_k(x)\), taking \(q_0=1\). Because the nonzero coefficients have absolute values \(1/k!\), the power errors obey

$$ |\widetilde P_m(x)-P_m(x)| \leq \eta\sum_{\substack{1\leq k\leq m\\ k\text{ odd}}}\frac{k}{k!} \leq \eta\cosh(1) < \eta(e-1) <e\eta. $$

Set \(\eta=\varepsilon/(4e)\), and require \(m\eta\leq1\), as needed for the lemma. Then the network’s polynomial-evaluation error is less than \(\varepsilon/4\). Combined with the Taylor error, its total error is less than \(3\varepsilon/4\), hence at most \(\varepsilon\). For sufficiently small \(\varepsilon\), the condition \(m\eta\leq1\) holds for the least odd \(m\) meeting the factorial condition.

For the budget, compute each power \(q_k\) along a chain of \(k-1\) multiplication modules. These chains can run in parallel; there are at most \(m\) active modules at a stage. With constant-width modules, the resulting network has width \(O(m)\), depth \(O(m(1+\log(1/\eta)))\), and size \(O(m^2(1+\log(1/\eta)))\). Here \(O(\cdot)\) hides constants independent of \(m\) and \(\varepsilon\); carrying the inputs and combining the polynomial terms is included in these bounds. The factorial condition allows \(m\) to grow much more slowly than \(\varepsilon^{-1/2}\), so these construction budgets can be far smaller than the one-hidden-layer spline budget for this target.

Worked Example: Sine at Tolerance 0.01

Take \(m=5\), so \(P_5(x)=x-x^3/3!+x^5/5!\). The Taylor remainder on \([-1,1]\) is at most \(1/6!=1/720\), which is less than \(0.005\), the allocated Taylor-error budget. Set \(\eta=0.01/(4e)\), approximately \(0.00092\). Then \(m\eta\) is approximately \(0.0046<1\), so the power lemma applies. The polynomial-evaluation error is at most \(e\eta=0.0025\). Thus the total error is at most

$$ \frac{1}{720}+0.0025 <0.00139+0.0025 <0.01. $$

The construction uses chains for powers through degree five, with at most \(1+2+3+4=10\) multiplication modules, each with depth and size bounded by \(C(1+\log(1/\eta))\). In contrast, linear interpolation for sine has \(|f''|\leq1\), so \(N\geq\sqrt{1/(2\varepsilon)}\) intervals suffice by the spline bound; for \(\varepsilon=0.01\), \(N=8\) suffices, using seven hidden units. The bounds have different constants and architecture costs, so the example illustrates the tradeoff rather than proving a numerical winner.

What the Tradeoff Does—and Does Not—Say

The examples show one mechanism by which depth can reduce the number of units: a small nonlinear module is reused to build a more complicated expression. For \(x^4\), repeated multiplication gives a logarithmic-in-accuracy size bound, compared with the \(\varepsilon^{-1/2}\) size of the stated spline construction. For sine, Taylor approximation followed by power construction gives a deep upper bound that grows slowly with increasing accuracy. The benefits depend on targets having useful algebraic or smooth structure.

These are approximation constructions, not universal architecture rankings. The spline calculation gives a sufficient shallow budget, not a lower bound for every one-hidden-layer network. Conversely, the deep bounds rely on the multiplication module, input-range control, and permitted depth. Constants, constraints on weights, connectivity, or training may change practical comparisons. A rigorous comparison must specify the target, error norm, domain, and which resource—depth, width, or total units—is being counted.

Common Pitfall

A common mistake is to say, “The deep network has logarithmic size, so it is always more efficient.” That conclusion does not follow. The logarithmic bound above applies to a specific construction on a specified domain, and the multiplier’s constant and architectural assumptions matter. Also, an error guarantee for each multiplication cannot simply be quoted without checking that approximate intermediate values remain in the multiplier’s domain. The power lemma supplies that check; the fourth-power example verifies it directly.

Key takeaway: Compare explicit approximation constructions under the same target, domain, and error criterion. Depth can reduce unit requirements when a target can be built by reusing accurate operations, but the resulting bounds are upper bounds—not universal claims that depth always wins.

Check Your Understanding

Answer each question using the target, domain, and error budget in the statement.

  1. For a twice continuously differentiable function on \([a,b]\) with \(|f''|\leq M\), how many equal spline intervals suffice for interpolation error at most \(\varepsilon\)?
  2. Why must the approximate powers in the multiplication-module construction be checked to lie in \([-2,2]\)?
  3. For the fourth-power construction, what tolerance should each of the two multiplication modules use to guarantee final error at most \(\varepsilon\)?
  4. Why does the sine construction require both a Taylor remainder bound and a polynomial-evaluation error bound?
  5. Does a smaller sufficient size bound for one deep construction prove that every shallow network requires more units? Explain.
Clinical Biostats