Experiments #51
Gemma 4's experts on mlx-serve's fused affine-4 decode kernels (PATCHED: the SiLU-only epilogue gets a...
done
What was tested
Gemma 4's experts on mlx-serve's fused affine-4 The writing phase: the model produces the reply one token at a time. Read more kernels (PATCHED: the SiLU-only epilogue gets a GELU-tanh table flag, `src/moe_affine4.zig`), two dispatches per layer instead of three `gather_qmm` plus the activation and the sum; unit test, then an alternating A/B screen on the best, then a race
Model and setup
gemma-4-26b-a4b mixed 4/8 (the best)
Expected gain
+3% to +6% decode (**code read**, row 49 kernel rates)
Where the idea came from
rows 49, 50
Outcome
done 2026-10-30: +3.5% decode [+3.4, +3.6] on the 50 sessions, API A number measuring how different two probability distributions are; 0 means identical. +0.0008; replication row 51r2 and the meaning read running
Lesson
mlx-serve's fused 4-bit Mixture of experts: a model made of many specialist sub-networks where only a few run per token. Read more kernels opened to Gemma 4's GELU-tanh give +3.5% decode on the 50 sessions at an API KL change of +0.0008: an engine's fast path closed to one activation is a cheap patch worth the build.
Adopted
no (meaning read pass; pending the flipped-order replication, row 51r2)