QK normalization divides each query and key by its own RMS norm before the attention scores are computed. Treating this denominator as a constant during backpropagation leaves the forward pass unchanged but alters the parameter gradients. We derive a closed form for the difference between the gradient under this detached rule and the gradient under the standard rule. For a single token, this difference is parallel to the token's own query; it changes only the query norm and has no first-order effect after normalization. The queries, however, are computed by a projection matrix WQ shared across all tokens. The gradient difference on WQ therefore equals WQ right-multiplied by a weighted second moment of the inputs, and it decomposes exactly into three components: a radial component that changes only the norm of WQ, a tangential component that changes the query directions of other tokens, and an upstream component that changes the gradient passed to earlier layers. Under AdamW, the radial component drives WQ to a larger equilibrium norm and reduces its angular update per step. Paired experiments on a small Transformer language model are consistent with this analysis. Detaching the query denominator consistently raises the test loss, and the gap persists across hardware, evaluation datasets and learning rates. All three components remain non-negligible throughout training, with the tangential component the largest. Norm growth and the smaller angular update appear only on the detached projection matrix, while the other projection matrix is essentially unchanged. With a learnable scale, however, we observe no resolvable loss gap.
Figures & tables
Dataset
Comparison
Mean
95% CI
FineWeb-Edu
QD − S
0.0600
[0.0546,0.0653]
FineWeb-Edu
QD − S (replication)
0.0596
[0.0544,0.0648]
FineWeb-Edu
KD − S
0.0528
[0.0497,0.0559]
WikiText-103
QD − S
0.0732
[0.0505,0.0959]
Table 1: Paired differences in test negative log-likelihood at the end of training (six seeds). The remaining comparisons are given in Appendix C .
Figure 1: Loss gap between QD and S. Left: gap on the validation subset over training; the curve is the mean over six seeds and the shaded band is the min–max range. Right: test-loss gap at the end of training; red dots are individual seeds and black shows the mean and 95% confidence interval (replication, six seeds).
Figure 2: Norm ratios of the radial, tangential and upstream components of the gradient difference to the standard gradient over training, computed along the S and QD trajectories. Curves are means over six seeds, shaded bands are the min–max range, and the dotted line marks 1%.
Quantity
S
QD
QD versus S
Norm of WQ
8.6
36.5
ratio 4.26 [4.03,4.50]
Norm of WK
–
–
ratio 1.036 [1.020,1.052]
Radial cosine of the update, c
0.033
0.200
difference 0.167 [0.157,0.177]
Angular update per step
–
–
ratio 0.48 [0.45,0.50]
Query collinearity
0.289
0.553
difference 0.263 [0.239,0.288]
Stable rank of WQ
9.11
4.73
difference −4.37[−4.94,−3.80]
Table 2: Geometric quantities for S and QD (replication, six seeds). Norms, query collinearity and stable rank are taken at the end of training; c and the angular update per step are averaged after warmup. Ratios are QD over S.
Figure 3: Left: norms of WQ and WK over training (log scale). Middle: cosine c between the actual update direction of WQ and WQ ; the dotted line is the threshold 2ηλ at the peak learning rate. Right: ratio of the angular update per step of WQ in QD to that in S. Curves are means over six seeds and shaded bands are the min–max range (replication).
Figure 4: Left: test loss of S and QD at three peak learning rates; light points are individual seeds and dark markers are means over three seeds. Right: test-loss difference QD − S without and with a learnable scale; red dots are individual seeds and black shows the mean and 95% confidence interval (three seeds each).
Arm
Components kept
Test loss − S
WQ norm ratio
Angular-update ratio
Query collinearity
S
none
0
1
1
0.296
QR
radial
0.0030 [−0.0045,0.0104]
3.52
0.52
0.283
QTU
tangential, upstream
0.0741 [0.0645,0.0836]
0.70
1.25
0.592
QD
all three
0.0581 [0.0474,0.0689]
4.22
0.49
0.543
Table 3: Component interventions (three seeds). Brackets give 95% confidence intervals; norm and angular-update ratios are relative to S and defined as in Table 2 ; query collinearity is taken at the end of training.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
Comparison
Mean
95% CI
FineWeb-Edu
QD − S
0.0600
[0.0546,0.0653]
FineWeb-Edu
KD − S
0.0528
[0.0497,0.0559]
FineWeb-Edu
QD − KD
0.0071
[0.0015,0.0128]
FineWeb-Edu
QD − S (replication)
0.0596
[0.0544,0.0648]
WikiText-103
QD − S
0.0732
[0.0505,0.0959]
WikiText-103
KD − S
0.0721
[0.0431,0.1011]
Appendix
Table C.1: All paired differences in test negative log-likelihood at the end of training (step 21,400), six seeds.
Component
Trajectory
Step 500
Step 5,000
Step 10,000
Step 21,400
Minimum
Radial
S
0.028
0.086
0.058
0.035
0.021
Radial
QD
0.029
0.063
0.043
0.024
0.014
Tangential
S
0.323
0.516
0.482
0.473
0.301
Tangential
QD
0.285
0.464
0.457
0.488
0.240
Upstream
S
0.076
0.186
0.168
0.138
0.067
Upstream
QD
0.108
0.162
0.164
0.187
0.093
Appendix
Table C.2: Norm ratios of the three components of the gradient difference to the standard gradient. The radial and tangential components are compared with the standard gradient on WQ of each layer; the upstream component is the gradient difference on all parameters other than WQ and is compared with the standard gradient on those parameters. Values at each step are means over six seeds; the minimum is taken over all seeds and checkpoints.
Trajectory
Step 5,000
Step 10,000
Step 15,000
Step 21,400
QD
1.42
1.09
1.01
0.93
S
1.10
0.86
0.60
0.28
Appendix
Table C.3: Ratio of the norm of WQ predicted by equation ( 4 ) to the measured norm, median over heads (replication, six seeds). The prediction substitutes the averages of u , c and the learning rate over the preceding 1,000 steps into equation ( 4 ).
Peak learning rate
Val. loss, S
Val. loss, QD
QD − S test loss
95% CI
0.0012
4.2035
4.2500
0.0469
[0.0364,0.0574]
0.0024
4.2011
4.2592
0.0581
[0.0474,0.0689]
0.0048
4.2281
4.2863
0.0589
[0.0534,0.0645]
Appendix
Table C.4: S and QD at three peak learning rates (three seeds). Validation losses are seed means and are used to select the learning rate for each rule.
Figure C.1: Test-loss difference relative to S against the norm ratio of WQ for each arm of Section 6.6 (log scale on the horizontal axis). Light points are individual seeds and dark points are means over three seeds.
Transformer attention lets models relate tokens by weighting information from other positions, enabling context-dependent sequence and multimodal processing.
School of Computer Science, Peking University · Key Laboratory of High Confidence Software Technologies, Ministry of Education · Zhejiang University +2