Verba/Rapida

Esperimenti #49

Achieved bandwidth of each matmul kernel of a Gemma 4 decode step at one token (row 48: the step is...

done

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

Cosa è stato provato

Achieved bandwidth of each matmul kernel of a Gemma 4 step at one (row 48: the step is GPU-bound): `gather_qmm` for the experts (128 x 704 x 2816, top 8) and `quantized_matmul` for the dense MLP, projections and LM head, 4- and 8-bit affine, over 30 layers' distinct weights in MLX 0.32.4 (`kernel_bw49.py`), against a plain 2 GiB read; the kernels far below 259 GB/s name the patch target

Modello e configurazione

gemma-4-26b-a4b shapes

Guadagno atteso

names the kernel to patch (**measured**, diagnostic)

Da dove viene l'idea

row 48

Esito

done 2026-10-30: 2k-row 4-bit matmuls reach 62 to 66% of read bandwidth, fused shapes 90 to 95%; mlx-serve already joins q/k/v and dense gate/up at load (49 groups in the best's log); only the experts' gate/up join is left (about 1%)

Lezione

on the M4 Pro a 4-bit matmul of about 2k x 2.8k reaches only 62% to 66% of read bandwidth at one token, a fused 8k-row one 95%; mlx-serve already joins Gemma 4's q/k/v and dense gate/up at load (49 groups), so the remaining gap is the 4-bit single-row kernels themselves and the small ops, not missing fusions.

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