Replace a stack of linear layers with their matrix product, and every prediction stays the same. Take one gradient step, though, and the two models can disagree.

The difference comes from what we train: one matrix, or the factors that multiply into it. Working through two layers is enough to see how that choice changes the update—and why the learning rate alone cannot describe it.

Combining two layers into one matrix

In the previous article, each column of a weight matrix gave the destination of one input basis vector. Now send those destinations through another layer:

h=Ax,y=Bh=BAx.(1)h=Ax,\qquad y=Bh=BAx. \tag{1}

Here x∈Rnx\in\mathbb R^n, the hidden vector h∈Rkh\in\mathbb R^k, and the output y∈Rmy\in\mathbb R^m. The matrices have shapes A∈Rk×nA\in\mathbb R^{k\times n} and B∈Rm×kB\in\mathbb R^{m\times k}. We use no biases or activations.

The first layer sends the basis vector eje_j to AejAe_j. The second sends it to B(Aej)B(Ae_j). These final destinations are the columns of a single effective matrix,

W=BA.(2)W=BA. \tag{2}

The hidden width still matters. Every output is a combination of the kk columns of BB, so the output can span at most kk independent directions:

rank⁡(BA)≤min⁡{rank⁡(A),rank⁡(B)}≤k.(3)\operatorname{rank}(BA) \leq \min\{\operatorname{rank}(A),\operatorname{rank}(B)\} \leq k. \tag{3}

A network that goes from 100100 coordinates to 55 and back to 100100 still produces outputs in a subspace of dimension at most 55. Widening the last layer cannot recover directions that the first layer removed.

So two layers always reduce to one matrix, but a narrow hidden layer restricts which matrices they can represent. Even when width is sufficient to represent any m×nm\times n matrix, training the two factors introduces another difference.

Different weights, identical predictions

Double AA and halve BB:

A~=2A,B~=12B,B~A~=BA.(4)\widetilde A=2A,\qquad \widetilde B=\frac12B, \qquad \widetilde B\widetilde A=BA. \tag{4}

The hidden vector doubles. The output does not change, for any input.

Scaling is one instance of a larger freedom. For any invertible k×kk\times k matrix SS,

A~=SA,B~=BS−1,B~A~=BA.(5)\widetilde A=SA,\qquad \widetilde B=BS^{-1},\qquad \widetilde B\widetilde A=BA. \tag{5}

The first layer changes the hidden coordinates; the second compensates. We can therefore know the network’s entire input-output function without knowing its individual weight matrices.

The product determines the predictions. The factors also determine how those predictions respond to training. To see the second part, we need their gradients.

How each layer gets its gradient

Start with one example, a target tt, and the squared loss

ℓ=12∥y−t∥2.(6)\ell=\frac12\|y-t\|^2. \tag{6}

Write the output error as r=y−tr=y-t. A small output change δy\delta y changes the loss to first order by r⊤δyr^\top\delta y.

For the second layer, changing BB gives δy=δB h\delta y=\delta B\,h. In coordinates,

δℓ=∑i,jrihj δBij,∇Bℓ=rh⊤.(7)\delta\ell =\sum_{i,j}r_i h_j\,\delta B_{ij}, \qquad \nabla_B\ell=rh^\top. \tag{7}

Each weight’s gradient is the error at its output multiplied by the input that passed through it.

For the first layer, a hidden change δh\delta h reaches the output as BδhB\delta h. Its effect on the loss is

r⊤Bδh=(B⊤r)⊤δh.(8)r^\top B\delta h=(B^\top r)^\top\delta h. \tag{8}

That is where the transpose comes from. B⊤rB^\top r gives the loss sensitivity at each hidden coordinate. Since δh=δA x\delta h=\delta A\,x,

∇Aℓ=(B⊤r)x⊤.(9)\nabla_A\ell=(B^\top r)x^\top. \tag{9}

If we trained the effective matrix WW directly, its gradient would be rx⊤rx^\top. For a loss L(W)L(W) averaged over examples, let G=∇WLG=\nabla_W L. Summing the same calculations gives

∇AL=B⊤G,∇BL=GA⊤.(10)\nabla_A L=B^\top G, \qquad \nabla_B L=GA^\top. \tag{10}

These identities also hold for other differentiable losses that depend on the factors through W=BAW=BA. A separate penalty on AA or BB would contribute its own gradient.

The first layer’s update depends on the second layer’s weights. The second layer’s update depends on the hidden inputs produced by the first. Backpropagation keeps track of both dependencies.

What one training step does to the product

Update both factors with learning rate η\eta, using gradients evaluated before either update:

A+=A−ηB⊤G,B+=B−ηGA⊤.(11)A^+=A-\eta B^\top G, \qquad B^+=B-\eta GA^\top. \tag{11}

Their new product is

W+=(B−ηGA⊤)(A−ηB⊤G)=W−η(BB⊤G+GA⊤A)+η2GW⊤G.(12)\begin{aligned} W^+ &=(B-\eta GA^\top)(A-\eta B^\top G)\\ &=W-\eta\bigl(BB^\top G+GA^\top A\bigr) +\eta^2GW^\top G. \end{aligned} \tag{12}

This is an exact expression for the simultaneous step. Directly training WW would instead give W+=W−ηGW^+=W-\eta G.

For small η\eta, the leading change in the factored model is

ΔW≈−η(BB⊤G+GA⊤A).(13)\Delta W\approx-\eta\bigl(BB^\top G+GA^\top A\bigr). \tag{13}

The term BB⊤GBB^\top G comes from changing the first layer and passing that change through the second. The term GA⊤AGA^\top A comes from changing the second layer, whose inputs were formed by the first.

These matrix multiplications can scale different directions differently, changing the direction of the overall update as well as its size. Factoring WW changes the step taken in WW-space. As the factors learn, that effect changes with them.

We can see the difference without any matrices at all. Take a scalar input x=1x=1, target t=0t=0, and prediction w=baw=ba. The loss is L=12w2L=\tfrac12w^2. Start at w=1w=1 and use η=0.1\eta=0.1:

Trainable parametersInitial valuesValues after one stepNew prediction
www=1w=1w+=0.9w^+=0.90.90.9
a,ba,ba=1, b=1a=1,\ b=1a+=0.9, b+=0.9a^+=0.9,\ b^+=0.90.810.81
a,ba,ba=2, b=0.5a=2,\ b=0.5a+=1.95, b+=0.3a^+=1.95,\ b^+=0.30.5850.585

All three models start with the same prediction and loss. The last two even have the same architecture. Their different factor scales are enough to produce different predictions after one step.

In the scalar case, writing g=dL/dwg=dL/dw, equation (12) becomes

w+=w−η(a2+b2)g+η2wg2.(14)w^+=w-\eta(a^2+b^2)g+\eta^2wg^2. \tag{14}

The leading step depends on a2+b2a^2+b^2, which the product abab does not determine. In the two factorizations above, that quantity is 22 and 4.254.25.

Why rescaling changes training

Return to the matrix network and rescale the factors by a positive number cc:

A~=cA,B~=B/c.(15)\widetilde A=cA,\qquad \widetilde B=B/c. \tag{15}

The effective matrix and its gradient GG stay the same. But the leading product update becomes

ΔW~≈−η(1c2BB⊤G+c2GA⊤A).(16)\Delta\widetilde W \approx-\eta\left( \frac{1}{c^2}BB^\top G +c^2GA^\top A \right). \tag{16}

One layer’s contribution shrinks while the other grows. In general, a single adjustment to η\eta cannot restore the original update: the two contributions need not point in the same matrix direction.

This is the connection to effective learning rate. Equal predictions do not imply equal training steps. Here the symmetry rescales two adjacent layers together, and the product update exposes a directional effect that a single scalar step size need not capture.

How a weight change travels through a deeper network

For dd linear layers, the effective matrix is

W=Wd⋯W1.(17)W=W_d\cdots W_1. \tag{17}

Focus on layer ℓ\ell. Call the product after it Pℓ=Wd⋯Wℓ+1P_\ell=W_d\cdots W_{\ell+1} and the product before it Qℓ=Wℓ−1⋯W1Q_\ell=W_{\ell-1}\cdots W_1. At the endpoints, an empty product is the identity.

If only this layer changes, the effective matrix changes exactly by

ΔW=Pℓ ΔWℓ Qℓ.(18)\Delta W=P_\ell\,\Delta W_\ell\,Q_\ell. \tag{18}

The same calculation used for two layers gives

∇WℓL=Pℓ⊤GQℓ⊤.(19)\nabla_{W_\ell}L=P_\ell^\top GQ_\ell^\top. \tag{19}

Updating every layer simultaneously and keeping the first-order terms therefore gives

ΔW=−η∑ℓ=1dPℓPℓ⊤ G Qℓ⊤Qℓ+O(η2).(20)\Delta W =-\eta\sum_{\ell=1}^{d} P_\ell P_\ell^\top\,G\,Q_\ell^\top Q_\ell +O(\eta^2). \tag{20}

Each layer contributes a change shaped by all the layers around it. Depth adds more such contributions and longer products on either side.

A diagonal example makes their effect visible. Suppose every layer currently has the matrix

D=(1000.8).(21)D=\begin{pmatrix}1&0\\0&0.8\end{pmatrix}. \tag{21}

Then W=Dd=diag⁡(1,0.8d)W=D^d=\operatorname{diag}(1,0.8^d). Change the bottom-right weight of any one layer by ε\varepsilon. The bottom-right entry of the product changes by

ΔW22=0.8d−1ε.(22)\Delta W_{22}=0.8^{d-1}\varepsilon. \tag{22}

For this diagonal setup, the corresponding gradient entry is 0.8d−1G220.8^{d-1}G_{22}. The surrounding layers attenuate both the effect of that weight and the gradient reaching it. Replacing 0.80.8 with a number above 11 reverses the effect and amplifies that direction. For general matrices, the directions can also rotate between layers, so individual entries no longer tell the whole story.

The network remains linear in its input throughout. Its weights enter through a product, and training moves those factors separately. Combining them preserves today’s predictions; it does not preserve the next training step.