Verba/Rapida

Experiments #154

Prefill chunks stop evaluating the last layer's output: the MoE forward's cadence evaluates `h` after layer...

done

What was tested

chunks stop evaluating the last layer's output: the forward's cadence evaluates `h` after layer 29 of every chunk of 1,024 or more (`src/transformer.zig:9920-9921`), though the chunk loop frees the chunk's logits unevaluated and reads only the KV entries (`src/generate.zig:1831-1836`, `:1847-1861`); so every chunk computes layer 29's head-dim-512 composed SDPA, `o_proj`, dense MLP and MoE for all its rows and drops them. Fix: in a chunk whose output nothing reads (no logprobs, no DFlash or hidden capture) skip that eval, so the KV eval computes only layer 29's K and V; kill switch `MLX_SERVE_R154_OFF`; lossless, identical replies by construction (`2026-11-13-mac-engine-audit/README.md` F1)

Model and setup

the best

Expected gain

cold first token -4% to -5% (0.29 to 0.36 s of 7.26 s, inferred from row 106's split), turn-1 reply -3.3% to -4.1%, per-turn paired reply -0.6% to -0.7% (row 109a's ratio); 0

Where the idea came from

engine audit 2026-11-13

Outcome

done 2026-11-13: on the pre-registered metric, reply median per turn -0.0% [-0.1, -0.0] against 0.3% (turn 1 -4.0%, summed reply -2.72%, cold first token -4.8%), 150 of 150 identical; a lossless stack candidate (LESTO `row/154` 079d832b on lesto-dev, with rows 158 and 159) (`2026-11-13-mac-engine-audit/README.md`)

Lesson

skipping the last layer's eval on prefill chunks whose output nothing reads cuts every cold prompt by 4.8% (0.35 s at 6k tokens) with all 150 replies identical, but a per-turn median cannot see a change that touches only turn 1; a cold-prompt saving is scored on turn 1 or on summed time, and is kept as a lossless stack component.

Adopted

no (no gain on the pre-registered metric; a lossless stack candidate kept on lesto-dev, scored stacked with rows 158 and 159)

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