Verba/Rapida

Esperimenti #90f

8-bit KV read packed in SDPA's single pass: an `sdpa_vector_2pass` decode variant that takes K and V as...

done

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

Cosa è stato provato

8-bit KV read packed in SDPA's single pass: an `sdpa_vector_2pass` variant that takes K and V as affine 8-bit triples and dequantizes in registers, wired into `gemma4MoeAttnWith` for head dims 256 and 512 with the dense view removed (row 90e: the view is 2.2 to 3.4 ms a step); row 90b's two-`quantized_matmul` read recovered nothing, so the single pass is the point; first step a unit test against the dense view's output on the M4, then the step profile; lossy (row 90c's read of the 8-bit cache passed)

Modello e configurazione

the best

Guadagno atteso

the view's 2.2 to 3.4 ms back, plus half the KV bytes in : about 0.4 to 0.8 ms a step under the dense best at 8k (row 149v sizing), and 2.5 GB less peak memory

Da dove viene l'idea

row 90e

Esito

done 2026-11-13: loss, the in-register 8-bit kernel is bit-identical to the dense 8-bit view in rounded mode and 18% under on the sliding layers (folded), but 46% over bf16 on the head-dim-512 global layers at 8k, so with the 0.6 ms write the 8-bit cache stays 0.4 to 0.9 ms a step slower; no pair (`2026-11-07-mac-reopened-rows/README.md`)

Lezione

an 8-bit KV kernel that dequantizes in registers beats bf16 only where the head dimension is small (256: -18%); at head dim 512 its per-element dequantization makes it 46% slower than bf16 for half the bytes, and the 8-bit write's 0.6 ms then sinks the cache, so the global layers' kernel decides whether an 8-bit cache can pay on Gemma 4.

Adottato

no (the 8-bit cache stays slower than the bf16 best; no pair, no read)

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