Proposition 1I.5.P0118 of 100 in the corpus
A linear layer performs an affine transformation, and nothing more.
A dense layer multiplies by a matrix and adds a vector. Every property of it — what it can express, how it composes, why it needs help — follows from that one sentence.
Demonstration
The whole operation:
y = Wx + b
W is a matrix of shape (out, in) and b a vector of length out. Reading it row by row, output j is the dot product of the j-th row of W with the input, plus a bias. That dot product is a similarity measure, which gives the row an interpretation: it is a direction in input space, and the output says how much of the input lies along it.
Two things follow immediately.
The map is affine, not linear. Without b the origin would be pinned: W·0 = 0 always. The bias is what lets the layer place its decision boundary somewhere other than through zero, which is why removing biases is a decision and not a simplification.
It composes into itself. Two layers back to back:
W₂(W₁x + b₁) + b₂ = (W₂W₁)x + (W₂b₁ + b₂) = W′x + b′
A single affine map. Not approximately — exactly. A hundred stacked linear layers have precisely the expressive power of one, with a hundred times the parameters and a hundred times the opportunity for numerical trouble. Depth alone buys nothing.
That last fact is the reason the next proposition exists, and it is worth noticing that it is a theorem rather than an empirical finding. No amount of training data changes it.
Corollary
When a layer’s output is described as a feature, the concrete meaning is: the projection of the input onto a learned direction, offset by a learned constant. Everything the layer knows is in those directions. Inspecting them — their norms, their angles to one another — is a legitimate way to read a model, and one of the few that requires no interpretation machinery at all.
Sources
Depends on
Used by
- I.3.P01 — Non-linearity is what makes depth worth having.
- I.5.P02 — Depth multiplies what width adds.
- I.5.P03 — A hidden layer is a learned coordinate system, not a summary.
- I.6.P01 — Backpropagation is the chain rule with the intermediate results kept.
- I.11.P01 — A convolution reuses one local rule across a grid.
- I.12.P02 — A linear autoencoder finds the principal subspace, and not its axes.
Problems using this
- I.5.B01 — Three inputs, two regions, one networknumeric▲△△
- I.5.B02 — Every region is one matrix, and its rank is the count of live unitssymbolic▲▲△
- I.5.B03 — A shape and parameter audit of a four-layer MLPshape▲△△
- I.5.B04 — Width costs a square, depth costs a linecomplexity▲▲△
- I.5.X02 — The same budget, two shapesshape▲△△
- I.5.X03 — What the bias buys, in one sentence and one counterexamplesymbolic▲△△
- I.5.X06 — Inside a region the gradient is one matrix productgradient▲▲△
- I.5.X08 — A dense layer is memory-bound until the batch is largecomplexity▲▲△