Md. Asif Uddin
Problem I.5.B06

Relabelling the hidden units, and what that forbids

proof▲▲△

Symbolic, with one order-of-magnitude count.

STATEMENT

Prove that permuting a hidden layer leaves a network’s function unchanged. Count how many such relabellings a layer of width 512 admits. Then state, as consequences rather than opinions, three things that may not be done with the weights of two independently trained networks.

GIVEN

f(x)=φ(xW(1)+b(1))W(2)+b(2)f(\vec{x}) = \varphi(\vec{x}\mat{W}^{(1)} + \vec{b}^{(1)})\mat{W}^{(2)} + \vec{b}^{(2)} with φ\varphi applied elementwise, and P{0,1}n×n\mat{P} \in \{0,1\}^{n \times n} a permutation matrix, where n=d1n = d_1 is the hidden width. Recall PPT=I\mat{P}\mat{P}^{\mathsf T} = \mat{I}.

FIND

A proof that the substitution (W(1)P, b(1)P, PTW(2))(\mat{W}^{(1)}\mat{P},\ \vec{b}^{(1)}\mat{P},\ \mat{P}^{\mathsf T}\mat{W}^{(2)}) leaves ff unchanged at every input; the number of such substitutions at n=512n = 512; and three consequences.

STRATEGY

The proof turns on one property of φ\varphi and one of P\mat{P}. Identify both before writing anything: the argument is three lines once they are named, and unavailable without them.

SOLUTION

Step 1 — the property of φ\varphi. φ\varphi is elementwise, so applying it and then reordering the coordinates gives the same vector as reordering and then applying it. In matrix form, for any permutation P\mat{P} and any row z\vec{z}:

φ(z)P=φ(zP)\varphi(\vec{z})\mat{P} = \varphi(\vec{z}\mat{P})

This is exactly the statement that φ\varphi does not mix coordinates, and it is the only property of the activation the proof uses. It holds for ReLU, sigmoid, tanh and GELU alike; it fails for softmax.

Step 2 — the property of P\mat{P}. A permutation matrix is orthogonal: PPT=I\mat{P}\mat{P}^{\mathsf T} = \mat{I}. Reordering and then undoing the reorder is the identity.

Step 3 — the substitution. Write f~\tilde f for the network with the substituted weights:

f~(x)=φ ⁣(xW(1)P+b(1)P)PTW(2)+b(2)\tilde f(\vec{x}) = \varphi\!\left(\vec{x}\mat{W}^{(1)}\mat{P} + \vec{b}^{(1)}\mat{P}\right) \mat{P}^{\mathsf T}\mat{W}^{(2)} + \vec{b}^{(2)}

Factor P\mat{P} out of the argument, since xW(1)P+b(1)P=(xW(1)+b(1))P\vec{x}\mat{W}^{(1)}\mat{P} + \vec{b}^{(1)}\mat{P} = (\vec{x}\mat{W}^{(1)} + \vec{b}^{(1)})\mat{P}:

f~(x)=φ ⁣((xW(1)+b(1))P)PTW(2)+b(2)\tilde f(\vec{x}) = \varphi\!\left((\vec{x}\mat{W}^{(1)} + \vec{b}^{(1)})\mat{P}\right) \mat{P}^{\mathsf T}\mat{W}^{(2)} + \vec{b}^{(2)}

Apply Step 1 to pull P\mat{P} out of φ\varphi, then Step 2 to cancel it:

=φ ⁣(xW(1)+b(1))PPTW(2)+b(2)=f(x) (I.5.6)= \varphi\!\left(\vec{x}\mat{W}^{(1)} + \vec{b}^{(1)}\right)\mat{P}\mat{P}^{\mathsf T}\mat{W}^{(2)} + \vec{b}^{(2)} = f(\vec{x}) \qquad \blacksquare \ \text{(I.5.6)}

At every input, to every digit. Not an approximation and not a symmetry of the loss only — a symmetry of the function.

Step 4 — how many. There are n!n! permutation matrices of size nn, and they give distinct parameter vectors whenever the hidden units are distinct. At n=512n = 512:

log10(512!)1166.5,512!101166\log_{10}(512!) \approx 1166.5, \qquad 512! \approx 10^{1166}

For scale, the observable universe holds on the order of 108010^{80} atoms. The number is not large in a way that admits a comparison; it is large in the way that makes exhaustive search a category error.

And permutations are not the only symmetry. ReLU is positively homogeneous, so scaling the jj-th column of W(1)\mat{W}^{(1)} and the jj-th entry of b(1)\vec{b}^{(1)} by any c>0c > 0 while scaling the jj-th row of W(2)\mat{W}^{(2)} by 1/c1/c is another one, and that family is continuous.

Step 5 — three consequences.

Averaging two trained networks’ weights is not averaging two models. Unit jj of one has no relation to unit jj of the other, so the mean is a network neither of them trained, and it typically performs worse than both.

A per-unit correlation between two runs measures the seed. Any such statistic is computed over an arbitrary labelling. It can be repaired — match the units first — but not ignored.

A distance in parameter space between checkpoints from different runs is uninterpretable. It is dominated by the permutation, not by any difference in behaviour. Two networks computing the identical function can sit arbitrarily far apart in weight space.

Answer

The substitution leaves ff unchanged because φ\varphi commutes with permutations and PPT=I\mat{P}\mat{P}^{\mathsf T} = \mat{I}; the two facts are the whole proof. A hidden layer of width nn therefore admits at least n!n! parameter vectors realising each function, which at n=512n = 512 exceeds 10116610^{1166}.

Consequently, across independently trained networks: weight averaging, per-unit correlation and parameter-space distance are all meaningless until the units are matched.

Check — sanity

Check it at n=2n = 2 by hand. Swap the two hidden units: exchange the columns of W(1)\mat{W}^{(1)} and the entries of b(1)\vec{b}^{(1)}, and exchange the rows of W(2)\mat{W}^{(2)}. The output is a sum of two terms, and a sum does not care in which order it is written. The general proof is that observation with the bookkeeping done.

The proof uses one property of φ\varphi, and it is worth naming exactly. Step 1 needs φ(z)P=φ(zP)\varphi(\vec{z})\mat{P} = \varphi(\vec{z}\mat{P}) — equivariance to permutation. Being elementwise is sufficient for that but not necessary: softmax mixes coordinates and is still permutation-equivariant, so the argument covers it. What would break the proof is an activation that treats its coordinates asymmetrically, such as one applying a different function to each. That is why the property to check is equivariance, not elementwiseness.

The count is sane. log10(2!)=0.30\log_{10}(2!) = 0.30, log10(8!)=4.6\log_{10}(8!) = 4.6, log10(512!)=1166.5\log_{10}(512!) = 1166.5 by Stirling. The growth is faster than exponential, which is why width makes the redundancy worse rather than better.

Where this breaks

The symmetry constrains what comparisons mean; it does not say the comparisons cannot be made. Git Re-Basin is the constructive version: find the permutation aligning one network to the other, apply it, and only then interpolate. When the alignment is right, the interpolated network can match its endpoints; when it is skipped, the same interpolation collapses. The symmetry did not go away, it was paid for.

Nor does the result say anything about a single run. Comparing a checkpoint with its own earlier state is fine, because no relabelling occurred between them. The failure is specific to comparing across independent initialisations, which is exactly the comparison people most want to make.

Variation

Count the symmetries of a two-hidden-layer network of widths (n1,n2)(n_1, n_2). Then decide whether the positive-rescaling family survives if the activation is GELU instead of ReLU, and say which property of ReLU that family depended on.

Draws on