Verba/Rapida

Esperimenti #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

Il testo degli esperimenti resta in inglese, come l'ha scritto il laboratorio.

Cosa è stato provato

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

Modello e configurazione

the best

Guadagno atteso

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

Da dove viene l'idea

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

Esito

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)

Lezione

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).

Adottato

no (a diagnostic)

Vuoi vedere cosa hanno prodotto questi esperimenti? Lesto, il motore di inferenza per Gemma 4 sui Mac con Apple silicon, è su lestoengine.com

Creato da Federico Andrioli, @fedeandri su X Le misure di un laboratorio di ricerca, ricavate direttamente dai suoi file. Dati aggiornati al