Experiments #154
Prefill chunks stop evaluating the last layer's output: the MoE forward's cadence evaluates `h` after layer...
done
What was tested
Prefill: the model reading the whole prompt before it can write the first token. Read more chunks stop evaluating the last layer's output: the Mixture of experts: a model made of many specialist sub-networks where only a few run per token. Read more forward's cadence evaluates `h` after layer 29 of every chunk of 1,024 The unit of text a model reads and writes: roughly a short word or a piece of a longer one. 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 Cold means the server has never seen this prompt start; warm means part of it is already remembered from before. 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 The text you send to the model before it starts answering. 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 The middle value when results are sorted: half the requests were faster, half slower. reply -0.6% to -0.7% (row 109a's ratio); The writing phase: the model produces the reply one token at a time. Read more 0
Where the idea came from
engine audit 2026-11-13
Outcome
done 2026-11-13: A valid experiment that did not beat the best score by more than the noise. 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)