← Lab
attnscale
mixedC++ · CPUSystems, numerics & scientific librariesJuly 9, 2026
the question
What does the 1/sqrt(d) scaling in attention do at inference, beyond the gradient argument?
what came out
It keeps logits O(1) so exp doesn't overflow fp16 (unscaled logits cross the 11.09 threshold from d=64 up) and softmax doesn't collapse to one-hot: the same fact the gradient argument names, seen from a 16-bit datapath. Two pre-registered predictions held; the third (a bf16 accuracy gain) was falsified.
method & receipts
- Result: mixed
- Pre-registered: the prediction was written down and committed before the run.
→ read the code and re-run it
github.com/v-code01/attnscale