§6.3.1–6.4.1Hidden Units · Architecture · Universal Approximation & Depth

Part II DL pp. 193–200 · ~5 min read

  • absolute value rectification
  • leaky relu
  • parametric relu
  • maxout unit
  • catastrophic forgetting
  • hyperbolic tangent
  • universal approximation theorem

§6.3.1 Rectified linear units and their generalizations

The ReLU g(z)=max{0,z}g(z) = \max\{0, z\} is easy to optimize precisely because it is so nearly linear: its derivative is 1 wherever the unit is active and its second derivative is 0 almost everywhere, so gradients stay large and consistent — far more useful than activations that introduce curvature. (Tip: initialize biases to a small positive value like 0.1 so units start active.) The one drawback: a unit whose activation is 0 gets no gradient. Its generalizations fix that with a nonzero slope αi\alpha_i for z<0z < 0, hi=max(0,zi)+αimin(0,zi)h_i = \max(0, z_i) + \alpha_i \min(0, z_i):

  • Absolute value rectification fixes α=1\alpha = -1g(z)=zg(z) = |z| (polarity-invariant image features).
  • Leaky ReLU fixes α\alpha small (≈ 0.01).
  • Parametric ReLU (PReLU) makes α\alpha a learned parameter.

Compare them all — toggle curves, drag the probe, and watch which units go “flat” (saturate) where:

The hidden-unit catalog — ReLU family, sigmoid/tanh, softplus, and maxout
-505z (pre-activation)

A curve tagged "flat" at the probe has a near-zero derivative there — a saturating unit that starves gradient-based learning.

Maxout

Maxout units go further: divide z\boldsymbol{z} into groups of kk and output each group’s maximum, g(z)i=maxjG(i)zjg(\boldsymbol{z})_i = \max_{j \in G^{(i)}} z_j (toggle it on above). A maxout unit learns the activation function itself — a piecewise-linear convex function of up to kk pieces — so with k=2k = 2 it can become ReLU, absolute-value rectification, or leaky/parametric ReLU, or something new.

What maxout buys, and costs

Each unit is now kk weight vectors, so maxout needs more regularization (unless the dataset is large and k small). Upsides: it can save parameters (max over k filters lets the next layer use k× fewer weights), and its filter redundancy resists catastrophic forgetting — losing previously-learned tasks. The whole ReLU family rests on one principle: models optimize more easily when their behavior is closer to linear — the same reason the LSTM propagates information through time by summation (§10.10).

§6.3.2 Sigmoid and tanh — usually the wrong hidden unit

g(z)=σ(z)g(z) = \sigma(z) and g(z)=tanh(z)g(z) = \tanh(z) (related by tanh(z)=2σ(2z)1\tanh(z) = 2\sigma(2z) - 1) saturate across most of their domain — flat, gradient-killing everywhere except near 0 — so their use as hidden units is now discouraged (as output units, paired with a log-based cost that undoes the saturation, they’re fine). When a sigmoidal unit is required, the hyperbolic tangent beats the logistic sigmoid: tanh(0)=0\tanh(0) = 0 (vs σ(0)=12\sigma(0) = \tfrac12), so it resembles the identity near 0 and a small-activation tanh network trains much like a linear one. Sigmoidal units remain common in recurrent nets, probabilistic models, and some autoencoders, whose extra requirements rule out piecewise-linear units.

§6.3.3 Other hidden units — and a cautionary tale

Many differentiable functions work fine; new types are published only when clearly better (the authors got under 1% MNIST error with g=cos(Wx+b)g = \cos(Wx+b)). Notable ones: linear/identity hidden units (factor a layer low-rank, h=g(VUx+b)\boldsymbol{h} = g(\boldsymbol{V}\boldsymbol{U}^\top\boldsymbol{x}+\boldsymbol{b}) with (n+p)q<np(n+p)q < np parameters), softmax as a memory switch, RBF (saturates to 0, hard to optimize), hard tanh, and — a warning — softplus: smooth and differentiable everywhere, yet empirically worse than ReLU. “The performance of hidden unit types can be very counterintuitive”; smoothness is no guarantee.

§6.4 Architecture · §6.4.1 Universal approximation and depth

Architecture = how many units and how they connect. The common chain arranges layers h(k)=g(k)(W(k)h(k1)+b(k))\boldsymbol{h}^{(k)} = g^{(k)}(\boldsymbol{W}^{(k)\top}\boldsymbol{h}^{(k-1)} + \boldsymbol{b}^{(k)}); the main choices are depth and per-layer width. Remarkably, one hidden layer already suffices to represent anything:

Term by term

(universal approximation theorem)\text{(universal approximation theorem)}
Hornik/Cybenko 1989\text{Hornik/Cybenko 1989}a feedforward net with a linear output and ≥1 hidden layer of a squashing activation can approximate ANY Borel-measurable function (e.g. any continuous function on a closed bounded set) to any nonzero error — given enough hidden units. Also holds for ReLU (Leshno 1993)representability
learnability\ne \text{learnability}it does NOT promise the training algorithm will FIND that function: optimization can fail, or overfit (NFL, §5.2.1)the gap
no size bound\text{no size bound}the theorem says a big-enough net exists, not how big — worst case, exponentially many units (2^(2ⁿ) binary functions on n bits)the catch

So why go deep? Because depth buys exponential efficiency:

1 fold → 2 regions2 folds → 4 regions3 folds → 8 regionseach added layer (absolute-value / maxout fold) can DOUBLE the linear regions — O(n^(d(l−1))·nᵈ), exponential in depth l(fig 6.5, Montufar et al. 2014)

Fig 6.5 (recreated) — an absolute-value rectification unit gives the same output for mirror-image inputs; composing these folds yields exponentially many piecewise-linear regions, so a deep rectifier net can need exponentially fewer units than a shallow one.

There is also a statistical reason. Choosing a deep model encodes a prior: that the target is a composition of simpler functions (a representation built of simpler representations — corners from edges) or a multi-step program (each step uses the previous step’s output). Empirically, greater depth generalizes better across many tasks (figs 6.6–6.7 — and crucially, adding depth beats adding the same number of parameters as width). Depth expresses a genuinely useful prior over functions.

Next: the rest of architecture (skip/sparse connections) and the algorithm that computes all these gradients — back-propagation.

Check yourself — hidden units, depth, universal approximation

1.Why is the ReLU easy to optimize, and what is its one drawback?

2.In ActivationLab, drag the probe to z = −3 with sigmoid, tanh, and ReLU shown. Which get tagged 'flat', and what does that mean?

3.What can a maxout unit do that a single ReLU cannot?

4.The universal approximation theorem says one hidden layer can approximate any Borel-measurable function. What does it NOT guarantee?

5.Give one reason — beyond the region-folding count — to prefer a deep model.

5 questions