Part 1 measured one laptop and built a map: which operations fall short of the ceilings the machine sustains. Part 2 pointed an evolutionary search at that map and shipped a private speedup. Both end the same way: the kernels are shape-specific and will age out. The one place kernel work outlives the hardware it was tuned on is upstream, in the library itself. So this part moves the work upstream: the findings from the private measurement rig, applied to kernels inside MLX itself, where every user of the library runs them.
What transferred was not any particular kernel. It was the instruments. Every contribution below was built and defended with the same rig Parts 1 and 2 forced into existence: ceilings measured on the actual machine, A/Bs run inside one binary so build noise cannot vote, causal controls that separate mechanism from correlation, and correctness judged against an independent reference rather than against the code under test. Each section shows the mechanism first and the measurement that pinned it down second.
The short version: five changes merged into MLX between August and the start of September. A block-size heuristic for MoE prefill, worth 1.30–1.45× at the shape a real model runs, built on a one-line law the tiles obey. A small-batch matmul tuning validated at 1.32–1.60× on M5 Max silicon. Two correctness fixes in MLX's JIT build path, which no automated test compiles. An independent verification of a third-party one-line fix for a kernel that silently returned wrong results above 32,767 rows. And a two-line dispatch change that lets head-dimension-256 prefill with an array mask run the fused NAX kernel, worth 1.44–1.56× at kernel level and 5–6% of time-to-first-token on Gemma-3-12B.
The fix is small: pick the tile height from rows-per-expert instead of hardcoding 64. The evidence was not small. A same-binary A/B with an environment hook so both arms ran one build; the tile-phase control above, which turns a throughput curve into a mechanism; and an end-to-end number, 62.8 → 58.9 s of time-to-first-token on the real model, against a predicted 5.1 s saving.
Coverage was checked empirically, not by argument: dispatch logging across the model zoo confirmed the heuristic never selects the wrong kernel for shapes other models run. The change was then replicated independently: the maintainer measured 2.74 → 2.23 ms on their own benchmark before merging, a fourth data point from a machine this project never touched.
The same audit surfaced a sibling: the quantized matmul's tiles are wrong for small row counts, the regime chunked serving visits. The validation worth noting came from elsewhere: a third contributor ran the change on an M5 Max and posted 1.32–1.60× on their own model shapes. Cross-machine replication is the one measurement a single-laptop rig cannot produce for itself.
MLX's GPU kernels reach users through two build paths: a precompiled library, and a source path that compiles each kernel the first time it runs. The precompiled path looks kernels up by name and never reads the source templates again; only the source path re-instantiates them. So a whole class of typo survives every test run on the normal build and detonates only for source-path users. A user reported one such breakage; verifying their diagnosis against a source build reproduced it exactly, and the verification pass found a second, unreported bug of the same class sitting next to it: a one-character template-name typo that made a kernel reference a function that does not exist.
The fix is eight lines added, five removed, across both bugs, verified by running the full quantized suite on both build paths: the source path exercised for the first time, the precompiled path with a structural argument that the diff cannot change it, since it touches no instantiation the binary library contains. The bug class remains open upstream: until an automated build compiles the source path, template-level typos keep surviving every test run.
The fourth merged change contains none of this project's code: it is a measurement campaign on someone else's one-line fix for a wrong-results bug in the sorted MoE path. The kernel stores a remaining-row count in a 16-bit integer; above 32,767 rows it wraps negative and whole blocks of output are skipped silently.
The verification method matters more than the result. The fix was applied to current main, the state a merge would actually produce, rather than to the PR's months-old base. On that frame the outputs are simply wrong (off by 31 where the test allows 0.05), the fix makes them correct, and the full quantized suite passes on both build paths. The last check was new information for everyone: a later change had rewritten the same loop, and the fix's interaction with that rewrite had never been tested anywhere.
MLX gained a fused NAX kernel for head-dimension-256 prefill on 2026-08-19 (#3842). Its dispatch gate admitted only a causal mask passed as the string "causal". The same causal mask passed as a boolean array, which is what every sliding-window layer produces, fell to the unfused path: the score tensor materialized in full, the mask applied afterwards. Measured at the Gemma-3 shape, the array form ran at less than half the fused form's throughput, and a window mask did no better than a causal array because the unfused path ignores sparsity.
The change is two lines: the gate do_causal && !has_arr_mask becomes do_causal || has_arr_mask. The masked kernel instantiations already shipped in the metal library, so nothing new is compiled. The !has_arr_mask was conservatism, not a guard against a defect: 50 correctness cases against an independent fp32 reference (f16 and bf16; bool, float, window and random masks; key lengths that are not multiples of 32) all pass, worst error 0.0081 in bf16, no NaN or Inf. Kernel-level A/B in one binary: 1.44× at 4k, 1.51× at 32k, 1.56× for a window mask at 32k; the string path unchanged. Upstream's own sdpa_bench.py shows the same rows at 1.46–1.66× (for example 324 → 206 ms per call at the largest shape), which gave the PR a one-command reproduction.
End to end on Gemma-3-12B, 4-bit, same binary with an environment hook, alternating arms, three pairs per context: 1.064× time-to-first-token at 8k and 1.050× at 16k. The modest end-to-end figure was predicted: Gemma's 1,024-token window bounds the keys each masked layer sees per chunk, so a 1.5× kernel compresses to 5–6% of the whole. What remains, named in the PR as future work: the array form still walks every key block and reads the mask, where the string form skips past the diagonal.
Every merged change above passed through the measurement rig Parts 1 and 2 built, and the rig's rules are written down in the project's methodology file, each with the incident that created it. The ones that did the work this month: performance A/Bs run same-binary where possible, with an environment hook selecting old or new behavior inside one build, because two separate builds differ by more than most kernel wins. Where two builds are unavoidable, arms alternate within one session, because this machine's day-to-day drift was measured and absolute numbers do not survive it. Kernel probes time dependent chains, report σ per cell, and repeat a drift-control cell last.
Correctness gets the same treatment as speed: outputs compared against an independent float32 reference built from basic operations, not against the code under test's own relatives; suites run on both build paths after #4372 proved they diverge; and for #3922, the fix was verified on a copy of current main with the patch applied, the state a merge would actually produce, rather than on the PR's stale base.
Numbers quoted from the public threads (the maintainer's 2.74 → 2.23 ms, the M5 Max 1.32–1.60×) are theirs, labeled as theirs, and were not re-derived here.
Findings. Five changes merged into MLX in a month, each carrying its mechanism and its measurement. The MoE prefill collapse traces to a single quantity, rows per expert, that the serving loop chooses and the kernel silently punishes; keying the tile height on it recovered 1.30–1.45× at the shape one real model runs. The small-batch matmul tuning replicated at 1.32–1.60× on M5 Max silicon. The JIT build path harbored two bugs invisible to the precompiled build every test exercises. A one-line third-party fix was confirmed against the exact state a merge would produce, including an interaction with a later rewrite nobody had tested. And a two-line gate change gave every array-masked head-dimension-256 prefill the fused kernel it was already entitled to.
Lessons. The engineering lessons generalize past MLX. Parameters chosen by the caller can dominate a kernel's throughput while belonging to nobody's benchmark: rows-per-expert moved this kernel 16× across its range, and no fixed-shape suite would ever have seen it. A claim is strongest where three independent levels agree: kernel probe, end-to-end run, and a replication on foreign hardware. And a codebase with two build paths has two behaviors: correctness proven on one says nothing about the other, as two silent template bugs demonstrated.
Next. A correctness fix for the head-dimension-256 causal path is staged on a local branch, and the decode-attention work it extends is measured and written up in the project's private records. The kernels in this story will be superseded like the ones before them. The instruments that produced and defended them are the part built to last.