Commit 07e474e
committed
[gpt_oss] Move YaRN attention mscale from rope cos/sin to softmax scale
CosSinRoPE is now a pure rotation (no mscale baked into cos/sin).
gpt-oss, which was the only CosSinRoPE+YaRN user, instead folds
mscale^2 into its softmax_scale.
Mathematically equivalent: applying mscale to cos/sin scaled q and k
each by m, so the attention logit was scaled by m^2. Applying m^2 to
the softmax scale produces the same logit. Verified logit-neutral to
~1e-6 on gpt-oss params.1 parent f67ed61 commit 07e474e
2 files changed
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| |||
282 | 281 | | |
283 | 282 | | |
284 | 283 | | |
285 | | - | |
286 | | - | |
287 | 284 | | |
288 | 285 | | |
289 | 286 | | |
290 | 287 | | |
291 | | - | |
292 | 288 | | |
293 | 289 | | |
294 | 290 | | |
| |||
307 | 303 | | |
308 | 304 | | |
309 | 305 | | |
310 | | - | |
311 | | - | |
| 306 | + | |
| 307 | + | |
312 | 308 | | |
313 | 309 | | |
314 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
| |||
0 commit comments