Verba/Rapida

Experiments #156

SDPA block count per head dim on GPU class `s`: row 149v's trace names show the M4 Pro is class `s`...

done

What was tested

SDPA block count per head dim on class `s`: row 149v's trace names show the M4 Pro is class `s` (sliding `..._nosinks_64`, global `..._128` at 1k and 8k; `scaled_dot_product_attention.cpp:572-584`), not neither-`s`-nor-`d` as rows 149g and 149h read it; so row 149g's 128 arm moved only the sliding layers (-0.92% at 1k, -0.95% at 8k: the sliding layers are block-sensitive, never tuned), and the global layers take 256 blocks above 8,192 keys (28% of session turns, 20% of ), the regime row 149g's 256 arm (-3.53% at 8k) priced. A switch per head dim (`MLX_SDPA_BLOCKS` split at `:603-607`), screened as row 149g: sliding 32 against 64; global 64, 128, 256 at 8k and at a 10k (row 149m: at 8k pass 1 reads 129, 149, 171 GB/s at forced 32, 64, 128 blocks and gains at each doubling, so 256 may beat the default 128 there too); then the length and head-dim table, rounding-class (partials' sum order), the Mac quality before a race; supersedes row 149h; class `s` covers the M3 Pro too (`2026-11-13-mac-engine-audit/README.md` F2)

Model and setup

the best

Expected gain

decode +0.3% to +1.1% (inferred from row 149g's arms), reply -0.2% to -0.6%

Where the idea came from

rows 149v, 149g; engine audit 2026-11-13

Outcome

done 2026-11-19 01:51: screen passed by the sliding arm: 32 blocks for head dim 256 decode +0.53% at 1k, +0.69% at 8k, +0.80% at 16k (paired, bench first turns); every global count loses (default best); the race is row 156s, the global contradiction with row 149m is row 156g (`2026-11-13-mac-engine-audit/README.md` ยง Row 156 screen result). Earlier: runnable 2026-11-13: screen bar an arm +0.5% at 1k and 8k (sliding) or +0.8% at 10k (global)

Want to see what these experiments produced? Lesto, the Gemma 4 inference engine for Apple silicon Macs, is on lestoengine.com

Made by Federico Andrioli, @fedeandri on X A research lab's own measurements, generated from its files. Data built