Md. Asif Uddin
Problem I.5.B02

Every region is one matrix, and its rank is the count of live units

symbolic▲▲△

Symbolic.

STATEMENT

Derive, in general, the affine map a two-layer ReLU network applies inside a single linear region. Then read two facts off the derivation: that the network is piecewise affine, and that the rank of the map on a region is bounded by the number of units switched on in it.

GIVEN

A network y^=φ(xW(1)+b(1))W(2)+b(2)\hat{\vec{y}} = \varphi(\vec{x}\mat{W}^{(1)} + \vec{b}^{(1)})\mat{W}^{(2)} + \vec{b}^{(2)} with φ=ReLU\varphi = \mathrm{ReLU}, W(1)Rd0×d1\mat{W}^{(1)} \in \R^{d_0 \times d_1} and W(2)Rd1×d2\mat{W}^{(2)} \in \R^{d_1 \times d_2}.

Fix an input x\vec{x}_\star and let D=diag ⁣(1[zj(1)>0])\mat{D} = \mathrm{diag}\!\left(\mathbf{1}[z^{(1)}_j > 0]\right) be the diagonal matrix of its activation pattern, with k=tr(D)k = \mathrm{tr}(\mat{D}) units on.

FIND

The effective W\mat{W}_\star and b\vec{b}_\star with y^=xW+b\hat{\vec{y}} = \vec{x}\mat{W}_\star + \vec{b}_\star for every x\vec{x} in the region containing x\vec{x}_\star, and a bound on rank(W)\operatorname{rank}(\mat{W}_\star).

STRATEGY

The one step that matters is replacing ReLU\mathrm{ReLU} by D\mat{D}. That substitution is exact — not an approximation — precisely on the set where the pattern does not change, and everything after it is matrix algebra.

SOLUTION

Step 1 — ReLU becomes a matrix. On the region, every unit’s sign is fixed. For a unit that is on, ReLU(z)=z\mathrm{ReLU}(z) = z; for one that is off, ReLU(z)=0\mathrm{ReLU}(z) = 0. Applying ReLU is therefore the same as multiplying on the right by D\mat{D}:

φ(z)=zDfor every z in the region\varphi(\vec{z}) = \vec{z}\mat{D} \quad \text{for every } \vec{z} \text{ in the region}

This is an identity on that set, not a linearisation.

Step 2 — substitute and expand.

y^=(xW(1)+b(1))DW(2)+b(2)=xW(1)DW(2)W+b(1)DW(2)+b(2)b\hat{\vec{y}} = \left(\vec{x}\mat{W}^{(1)} + \vec{b}^{(1)}\right)\mat{D}\,\mat{W}^{(2)} + \vec{b}^{(2)} = \vec{x}\underbrace{\mat{W}^{(1)}\mat{D}\,\mat{W}^{(2)}}_{\mat{W}_\star} + \underbrace{\vec{b}^{(1)}\mat{D}\,\mat{W}^{(2)} + \vec{b}^{(2)}}_{\vec{b}_\star}

which is equation (I.5.3). The network is affine on the region, with a W\mat{W}_\star and b\vec{b}_\star that depend on D\mat{D} and on nothing else.

Step 3 — piecewise affine. The regions are indexed by the finitely many patterns D\mat{D} that occur. Each contributes one affine map, and the maps agree on shared boundaries because a unit crossing zero contributes zero on both sides. So the network is a continuous piecewise affine function — a statement about the whole model, obtained without any assumption about the weights.

Step 4 — the rank bound. Rank cannot exceed that of any factor, and rank(D)=k\operatorname{rank}(\mat{D}) = k:

rank(W)min ⁣(rankW(1), k, rankW(2))min(d0, k, d2)\operatorname{rank}(\mat{W}_\star) \le \min\!\left(\operatorname{rank}\mat{W}^{(1)},\ k,\ \operatorname{rank}\mat{W}^{(2)}\right) \le \min(d_0,\ k,\ d_2)

using Rank, eigenvalues and the singular value decomposition 0.LA.04. So on a region where only kk units are live, the network’s output lies in a subspace of dimension at most kk, whatever the widths are elsewhere.

Step 5 — what that means. Width d1d_1 does not act on a single input. On any one input only the live units count, and the network behaves like a much smaller model. Width buys variety across regions, not capacity within one.

Answer

W=W(1)DW(2),b=b(1)DW(2)+b(2)\mat{W}_\star = \mat{W}^{(1)}\mat{D}\,\mat{W}^{(2)}, \qquad \vec{b}_\star = \vec{b}^{(1)}\mat{D}\,\mat{W}^{(2)} + \vec{b}^{(2)}

exactly, on the whole region; and rank(W)min(d0,k,d2)\operatorname{rank}(\mat{W}_\star) \le \min(d_0, k, d_2) where kk is the number of units switched on. The network is continuous and piecewise affine, with one such map per realised activation pattern.

Check — sanity

It reproduces I.5.B01. There d0=2d_0 = 2, d1=3d_1 = 3, d2=1d_2 = 1, D=diag(1,1,0)\mat{D} = \mathrm{diag}(1,1,0) and k=2k = 2. The formula gives w=(3,0)\vec{w}_\star = (3, 0) and b=0.5b_\star = -0.5, which is what the direct forward pass returned.

The rank bound is not vacuous there. min(2,2,1)=1\min(2, 2, 1) = 1, and w=(3,0)\vec{w}_\star = (3,0) has rank 1. The bound is tight in that case.

Every ReLU disappears. If any survived, the expression would not be affine, and the substitution in Step 1 would have been wrong. Counting them is a real check: three units in, three columns of D\mat{D}, none left over.

Where this breaks

Two assumptions are load-bearing, and both fail for activations other than ReLU.

φ\varphi must be piecewise linear for D\mat{D} to exist at all. With GELU or tanh there is no diagonal matrix of ones and zeros that reproduces the activation on any open set, so the network has no linear regions, is not piecewise affine, and none of the region-counting in I.5.B07 applies to it. What survives is a local statement — the Jacobian at a point — which is a different and weaker object.

φ\varphi must be elementwise for D\mat{D} to be diagonal. Softmax is not, so the same substitution would produce a dense matrix and the rank argument would say nothing. That is I.3.X08 seen from the other side.

Variation

Extend the derivation to LL layers: show that on a region the network is xW(1)D(1)W(2)D(2)W(L)\vec{x}\,\mat{W}^{(1)}\mat{D}^{(1)}\mat{W}^{(2)}\mat{D}^{(2)}\cdots\mat{W}^{(L)} plus a bias, and state the rank bound in terms of the smallest live count across layers. Then say which single layer decides it.

Draws on