Verba/Rapida

Experiments #82

Engine code audit of the best's decode step: host time per step (mlx-serve `MLX_SERVE_STEP_TRACE`), a Metal...

done

What was tested

Engine code audit of the best's step: host time per step (mlx-serve `MLX_SERVE_STEP_TRACE`), a Metal System Trace of 8k decode, and a read of every serialized weight read per layer in `src/transformer.zig`; each lossless fix found becomes a row (`docs/experiments/2026-10-31-mac-engine-audit/README.md`)

Model and setup

the best

Expected gain

accounts for the ~3 ms overhead the 2.3 ms gap to 100 lies in (diagnostic)

Where the idea came from

rows 57p, 59, 61, 80

Outcome

done 2026-10-31: 98% busy in decode, host build 0.6 ms hidden; the overhead is dependent barrier levels per layer; candidates C (KV write in the RoPE kernel), B+F (router in seam1, GeGLU epilogue), G (norms in the matmul tail) queued as rows 83 to 85

Lesson

on the M4 Pro the Mac best's decode GPU is 98% busy and the host build is hidden, so the overhead is the GPU's dependent levels inside a layer (full-scope barriers between small kernels), not host time or dispatch count: count barrier levels per layer, not dispatches, when sizing a fusion.

Adopted

no (diagnostic).

Want to see what these experiments produced? Lesto, the Gemma 4 inference engine for Apple silicon Macs, is on lestoengine.com

Made by Federico Andrioli, @fedeandri on X A research lab's own measurements, generated from its files. Data built