Verba/Rapida

Experiments #117

A head-dim-512 flash prefill kernel for Gemma 4's 5 full-attention layers on chips without NAX (Lesto today...

queued

What was tested

A head-dim-512 flash kernel for Gemma 4's 5 full-attention layers on chips without NAX (Lesto today runs MLX's composed fallback there, materialising the qL x kL scores: `src/transformer.zig:2935`, `:2033`; row 111 found no upstream kernel); first, timing-free, size those layers' share of an 8k first from a trace, then a kernel modelled on `msv_attn_p256` only if the share is worth it

Model and setup

the best

Expected gain

first token: unknown until sized (guess -2 to -5% of an 8k first token)

Where the idea came from

row 111

Outcome

queued 2026-11-02; closed 2026-11-04 before any work: the sizing was already done by row 106 (`2026-10-31-mac-engine-audit/README.md` ยง , row 106): the full hd-512 SDPA is 1.11 s of a 10.35 s 8k first token and already runs at about 6.1 TFLOP/s against the 7.0 of the dense matmuls, so a flash kernel can remove only the masked half of each diagonal block, about 0.22 s (2.1% of the first token, about -1.5% of a first-turn reply) and nothing on ; at 8 h, rounding risk and a decode-only Mac adoption rule it cannot become the best

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