Start from the trained layer and put in one bug at a time:
Bug
What runs
Output
Correct
none
xW⊤+2xA⊤B⊤
[5, 3]
[5, 3]
B starts at [0.1, -0.2]
at creation, [7,−1]+2⋅(−2)⋅[0.1,−0.2]
[6.6, -0.2]
[7, -1]
no α/r
[7,−1]+[−1,2]
[6, 1]
[5, 3]
merge without α/r
x(W+BA)⊤
[6, 1]
[5, 3]
branch still on after merge
xW′⊤+[−2,4]
[3, 7]
[5, 3]
base not frozen
same outputs
13 trainable numbers
5
The unscaled merge does more damage on the way out.
Predict
After an unscaled merge, unmerge() subtracts 2 B A and leaves W − B A. What does the base alone give now?
Every wrong row is a plausible pair of numbers, and none of them errors. That's why the practice checks each one against the exact formula.
The gradients at creation tell the story of the start
The first gradients, with G=[1,−1] arriving at the output:
Start
∂L/∂A
∂L/∂B
B=0, A=[1,0,−1]
[0, 0, 0]
[-4, 4]
A=0, B⊤=[0.1,−0.2]
[0.6, 1.2, 1.8]
[0, 0]
both zero
[0, 0, 0]
[0, 0]
With B=0: ∂L/∂A=0, and ∂L/∂B=2⋅G⊤(xA⊤)=2⋅(−2)⋅[1,−1]⊤=[−4,4]⊤.
Flip the start to A=0 and B⊤=[0.1,−0.2]. Now ∂L/∂B=0, and ∂L/∂A=2⋅(GB)⋅x=2⋅0.3⋅[1,2,3]=[0.6,1.2,1.8].
Zero both, and both gradients are zero.
In the editor are the worked example's layer and its right output, right, which is [5, 3]. Make each bug on purpose. Set no_scale: the trained output without the scale. Set still_on: the merged layer with the branch still on. Set unscaled_merge: x through a weight merged without the scale.
Pick an answer above to see the rest
Instructions
1
Set no_scale: the trained layer's output without the alpha / r scale.
2
Set still_on: the output when the update is merged into W but forward still adds the branch.
3
Set unscaled_merge: the output of a layer whose merge left out the scale.