Verba/Rapida

Experiments #175da

Row 175d step 2, the attention: the 3-row verify's SDPA takes 4,275 us a round at 8k against 2,162 us for...

done

What was tested

Row 175d step 2, the : the 3-row verify's SDPA takes 4,275 us a round at 8k against 2,162 us for one row's (+2,113 us), for the same KV under ideal reuse. Microbench, in normal mode, the verify's sliding (head dim 256, 1,024 keys) and global (head dim 512) SDPA at 3 queries against one query at 8k and 1k: how many times the 3-query call reads the KV, and which variant it dispatches; a kernel row (one KV read for all queries) only where it reads more than once

Model and setup

the best

Expected gain

+3% to +9% (inferred: up to the 2.1 ms excess)

Where the idea came from

`2026-11-20-mac-r175d-verify-anatomy/README.md` § Row 175d step 1 result

Outcome

done 2026-11-20 11:47: at 8k a 3-query call costs 2.42 times one query on global layers (490 against 202 us) and 1.78 times on sliding ones (72 against 40); three one-query calls cost more (602, 104), so no split; the per-query K/V walk leaves up to about 2.2 ms a round to a shared-K/V kernel, row 175dk (`2026-11-20-mac-r175d-verify-anatomy/README.md` § Row 175da step 1 result)

Lesson

on the 8k shapes MLX's 2-pass vector kernel costs 2.4 times one query for 3 global queries and 1.8 times for 3 sliding ones, for the same K/V, while three separate calls cost 3.0 and 2.6 times; the per-query K/V walk is the verify's attention excess, and only a kernel that shares the K/V read across queries can recover it (up to about 2.2 ms a round, a ceiling).

Adopted

no (a diagnostic)

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