Esperimenti #175dk
A multi-query vector attention kernel for the drafter's verify (row 175da: at 8k MLX's 2-pass vector kernel...
done
Il testo degli esperimenti resta in inglese, come l'ha scritto il laboratorio.
Cosa è stato provato
A multi-query vector The step where each token looks back at the earlier tokens to decide what matters. Approfondisci kernel for the The small guessing model used in speculative decoding. Approfondisci's verify (row 175da: at 8k MLX's 2-pass vector kernel costs 490 us a global layer at 3 queries against 202 at one, 72 against 40 a sliding layer, because each simdgroup walks the K/V itself for its own query and head, `kernels/sdpa_vector.h:234-237`, `:263`): a Lesto Metal kernel that reads each K/V block once a threadgroup and applies it to all 2 to 8 queries and every head of a KV group (MLX's `_gqa_` variant's structure, `sdpa_vector.h:326`, extended to several queries, head dims 256 and 512, the causal test and the band mask). Step 1: the kernel and a microbench against row 175da's 3-row call on the same shapes, outputs within A 16-bit number format for model weights; the full-quality baseline here. of MLX's; then Keeping a model loaded on a machine so it can answer requests over the network. behind a switch, an identity count against the best (other summation order, so rounding class) and a pair
Modello e configurazione
the drafter verify's attention
Guadagno atteso
up to about +9% The writing phase: the model produces the reply one token at a time. Approfondisci at k = 3 (a ceiling: 2.2 ms of a 23.8 ms round, the gap to one row's time)
Da dove viene l'idea
row 175da
Esito
done 2026-11-20 20:14 (engine-rows): correct (12 checks, one bf16 step) but slower than MLX's 3-row call in every configuration, global 8k 1,054 to 3,206 us against 497, sliding 87 to 365 against 73; confirmations -551 [-558, -536] and -13.6 [-13.8, -12.5] us, line not met; cause from the code: scalar `lane + 32 i` loads (16 a K row at hd 512) against MLX's contiguous per-lane chunks, a third of MLX's simdgroups, staging barriers; row 175dk2 rewrites the body (`2026-11-20-mac-r175dk-mq-attention/README.md` § Result)
Lezione
a shared-K/V attention kernel that reads each K/V row once can still be 2 to 6 times slower than MLX's per-pair walk, because the cost on the M4 tracked load instructions per row (scalar `lane + 32 i` loads against MLX's contiguous per-lane chunks) and simdgroups in flight, not bytes read. Match MLX's per-lane layout and key split first, then share.
Adottato
no (below the step 1 line; no served step).