Verba/Rapida

Experiments #175dr3va

Fused per-row verify attention for the row-exact verify: one dispatch runs every row's decode-shaped...

done

What was tested

Fused per-row verify for the row-exact verify: one dispatch runs every row's decode-shaped attention (copies of MLX's `sdpa_vector_2pass_1`/`_2` with a per-row key window, key count and block count from MLX's host formula at the call's gqa, and of the one-pass `sdpa_vector`), so each row is bit for bit its own decode call, replacing one MLX call a row plus a concatenate (`sdpaRowsAsDecode`, LESTO 0437d9b `transformer.zig:18808`); target the attention's +1,083 us a round (39% of the verify delta) in [mac diag175dr3vt29]; a narrow gate (after three rounds) fuses only the traced shapes on an s-class : sliding layers (head dim 256, gqa 2, window 1,024) with every row past the window (two-pass, float mask) or every row inside it (one-pass), and global layers (head dim 512, gqa 8) with every row at 1,024 keys or more; every other block keeps the per-row path. Opt-in `MLX_SERVE_VERIFY_ATTN_ROWS=1`, Lesto `row/175dr3va` 0e59ae80. First steps: unit exactness (Bf16Tally over a million outputs) and a timing ubench on the M4, cost sheet `2026-11-29-verify-attn-rows` (measure-first)

Model and setup

the row-exact (lesto_r175dr3v_rowl)

Expected gain

about +3% decode (sheet: -3.6% session, -2.0% Codex, budget -2%)

Where the idea came from

[mac diag175dr3vt29]

Outcome

done 2026-11-30 03:39 M4: exact (0 of 2,031,616 elements differ, 96 fused calls) and the fused call saves 893 to 1,743 us a 30-layer batch of 3 rows (26 to 33%) in the isolated ubench; measure-first again, Codex agreed; the pair is [mac gen175dr3va] (`docs/experiments/2026-11-28-mac-r175dr3v-row-exact-verify/README.md` ยง Result, row [mac 175dr3va])

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