Twenty units deep against a thousand wide
counterexample▲▲▲Exact integer counts.
STATEMENT
Exhibit a function that a deep ReLU network computes with twenty hidden units and that no single hidden layer computes with fewer than a thousand and twenty-three. Build it explicitly, count its pieces, prove the shallow lower bound, and then say precisely what the example does and does not establish.
GIVEN
The triangle map on :
and its -fold composition .
FIND
A ReLU expression for ; the number of linear pieces of ; the hidden units and parameters a depth- network needs for ; and the minimum hidden units a network with a single hidden layer needs to represent it, at .
STRATEGY
Three separate jobs. Write with rectifiers, which is a small algebra exercise. Count the pieces of , which is an induction. Bound the shallow network, which is the only step that needs an argument rather than a construction.
SOLUTION
Step 1 — the triangle, in two ReLU units.
Check both branches. For the second term vanishes and the expression is . For it is . Two hidden units, four weights and two biases in, one row of two weights out.
Step 2 — the pieces multiply. maps each of and onto the whole of , once each. So every linear piece of is traversed twice by — once on the rising half and once on the falling half — and
At that is pieces, and breakpoints.
Step 3 — the deep cost. Stacking copies gives hidden units. At : 20 hidden units, and parameters counting every weight and bias of each block.
Step 4 — the shallow lower bound. This is the part that has to be proved rather than constructed. Let be any network on with a single hidden layer of ReLU units:
Each term is affine except at the single point where its slope changes, so is piecewise constant and can change value at no more than points. A function with linear pieces has points where its slope changes. Hence
At : hidden units, and parameters.
Step 5 — the comparison. units against ; parameters against . The gap is against , so it widens without limit: at the shallow network needs more than a million units to represent what twenty layers of two units represent exactly.
Answer
, and has exactly linear pieces.
At : the deep network uses hidden units and parameters. Any network with one hidden layer needs at least units — a factor of — and the factor grows as .
Check — numeric · i-5-b05-sawtooth.py
def tooth(x): # one triangle, written with exactly two ReLU units
return 2.0 * relu(x) - 4.0 * relu(x - 0.5)Counts slope changes of on a grid sixteen times finer than the pieces, and prints for — the induction of Step 2, confirmed by exhaustion rather than assumed.
Executed in CI. The digits above are the digits it printed.
Check — sanity
The ReLU form agrees with the definition at three points. , , , and the snippet prints all three. If the were a , the third would come out as instead.
The counted pieces match the predicted at every tested, including , where the count is over sample intervals. A miscount of even one piece would break the doubling.
The lower bound is tight, not merely valid. A shallow network with exactly well-placed units can represent : put one breakpoint at each of the interior kinks and solve for the coefficients. So is the answer, not a weak bound that a cleverer construction would beat.
Where this breaks
Everything above is about representation, and it is worth being blunt about how far that is from a recommendation.
It is one function. The sawtooth was chosen because it is the extreme case. Nothing here says the functions in any application oscillate like this, and for smooth targets the depth advantage can vanish entirely.
It says nothing about training. The deep network representing has specific parameters. Gradient descent from a random start does not find them: the loss surface of a composition of ten triangle maps is close to pathological, and this is the standard demonstration that expressivity and trainability are unrelated properties.
It is one-directional. “Some functions are exponentially cheaper deep” is not “deeper is better”. The converse fails: many functions are equally cheap at either depth, and depth brings vanishing gradients (I.9), conditioning problems (I.7) and a need for normalisation (I.8) that width does not.
The honest summary is that the theorem removes an argument rather than supplying one. Nobody can any longer say a wide shallow network is as good as a deep one because both are universal approximators. I.3.T2 and this problem are about different quantities, and the second is the one that decides cost.
Variation
Modify to a three-piece map with two peaks and count the pieces of its -fold composition. Then generalise: for a map with pieces, how many hidden units does the shallow network need at depth , and what does that do to the ratio in the answer?