Experiments #137
Head dim 512's fused kernel at decode below 1,024 keys: `MLX_SDPA_D512_MIN_KL` lowered, so the 5 full...
done
What was tested
Head dim 512's fused kernel at The writing phase: the model produces the reply one token at a time. Read more below 1,024 keys: `MLX_SDPA_D512_MIN_KL` lowered, so the 5 full layers stop running five unfused dispatches per call at 1k (`2026-11-07-mac-profile-best` § row 104m); rounding changes, so a blind read before any race
Model and setup
the best
Expected gain
-0.25 ms at 1k, nothing at 8k (inferred from the audit's 49 us per call); row 28 found this kernel 5.8x slower at 8k keys on another engine, so test the time first
Where the idea came from
row 104m
Outcome
done 2026-11-13: A valid experiment that did not beat the best score by more than the noise., 1k decode +0.05% (block pairs +0.01, -0.01, +0.08, +0.05), 8k +0.12%, 7 of 10 1k replies changed; only 23.4% of 1k steps are below 1,024 keys, about 0.02 ms a step there (`2026-11-13-mac-r137-d512-1k/README.md`)
Lesson
lowering `MLX_SDPA_D512_MIN_KL` to 0 on the best moves 1k decode by +0.05% (+0.2% on the steps below 1,024 keys) and changes 7 of 10 replies, so head dim 512's five unfused dispatches cost about 0.02 ms a step, not the 0.25 ms the audit's per-call figure implied. The bench's 1k The text you send to the model before it starts answering. are 1,001 The unit of text a model reads and writes: roughly a short word or a piece of a longer one., so only their first 23 decode steps are below the threshold.
Adopted
no (no gain, and lossy)