mlx-bun 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/README.md +57 -32
  2. package/docs/README.md +58 -42
  3. package/docs/archive/investigations/benchmark-ledger-through-v0.4.0.md +3617 -0
  4. package/docs/archive/investigations/openjarvis-fit.md +198 -0
  5. package/docs/archive/investigations/qwen38-27b-campaign-log.md +1092 -0
  6. package/docs/archive/planning/release-notes-v0.4.0.md +45 -0
  7. package/docs/archive/planning/release-notes-v0.5.0.md +37 -0
  8. package/docs/design/batching.md +1535 -50
  9. package/docs/design/decode-speed-program.md +394 -1171
  10. package/docs/design/generic-model-support.md +195 -3
  11. package/docs/design/kv-cache.md +538 -225
  12. package/docs/design/speculative-decoding.md +552 -50
  13. package/docs/design/turboquant.md +140 -17
  14. package/docs/design/unified-engine-frontier-plan.md +259 -150
  15. package/docs/planning/PRODUCT_ROADMAP.md +21 -6
  16. package/docs/planning/public-readiness-handoff.md +244 -0
  17. package/docs/planning/public-readiness.md +149 -0
  18. package/docs/reference/benchmarks.md +3537 -1112
  19. package/docs/reference/cli.md +102 -2
  20. package/docs/reference/distribution.md +45 -13
  21. package/docs/reference/environment.md +159 -13
  22. package/docs/reference/library-api.md +18 -4
  23. package/docs/reference/memory.md +1 -1
  24. package/docs/reference/models.md +28 -7
  25. package/docs/reference/server-api.md +257 -33
  26. package/docs/reference/server-config.md +372 -151
  27. package/docs/reference/troubleshooting.md +13 -21
  28. package/package.json +2 -2
  29. package/src/audio/audiotoolbox.ts +112 -0
  30. package/src/audio/conformer.ts +8 -0
  31. package/src/audio/mic-capture.ts +98 -0
  32. package/src/audio/silero-vad.ts +379 -0
  33. package/src/audio/whisper-decode.ts +774 -0
  34. package/src/audio/whisper-fast.ts +732 -0
  35. package/src/audio/whisper-format.ts +73 -0
  36. package/src/audio/whisper-mel.ts +185 -0
  37. package/src/audio/whisper-timing.ts +274 -0
  38. package/src/audio/whisper-tokenizer.ts +239 -0
  39. package/src/audio/whisper-transcribe.ts +410 -0
  40. package/src/backends/mlx/assistant-target.ts +46 -0
  41. package/src/backends/mlx/autoregressive-draft-rows.ts +120 -0
  42. package/src/backends/mlx/autoregressive.ts +22 -1
  43. package/src/backends/mlx/batch-group.ts +464 -236
  44. package/src/backends/mlx/cache-attachment.ts +67 -0
  45. package/src/backends/mlx/cache-layout.ts +31 -0
  46. package/src/backends/mlx/checkpoint-state.ts +53 -0
  47. package/src/backends/mlx/continuation-persistence.ts +107 -0
  48. package/src/backends/mlx/continuation-request.ts +43 -0
  49. package/src/backends/mlx/continuation.ts +77 -0
  50. package/src/backends/mlx/draft-target.ts +7 -22
  51. package/src/backends/mlx/encoder-cache.ts +25 -0
  52. package/src/backends/mlx/fill-append.ts +21 -8
  53. package/src/backends/mlx/fill-group.ts +497 -0
  54. package/src/backends/mlx/full-kv-row-append.ts +32 -0
  55. package/src/backends/mlx/full-kv-row-donor.ts +54 -0
  56. package/src/backends/mlx/full-transitioning-kv-rows.ts +65 -0
  57. package/src/backends/mlx/gateway-binding.ts +122 -19
  58. package/src/backends/mlx/kv-codec.ts +9 -0
  59. package/src/backends/mlx/kv-maintenance.ts +161 -0
  60. package/src/backends/mlx/kv-tensor-rows.ts +212 -0
  61. package/src/backends/mlx/mixed-iteration.ts +62 -0
  62. package/src/backends/mlx/model-prompt.ts +46 -32
  63. package/src/backends/mlx/model-serving.ts +5 -4
  64. package/src/backends/mlx/paged-cache-codec.ts +27 -0
  65. package/src/backends/mlx/prefill-cohort.ts +100 -0
  66. package/src/backends/mlx/prefill-policy.ts +26 -0
  67. package/src/backends/mlx/prefill-rows.ts +244 -0
  68. package/src/backends/mlx/prefill.ts +1 -1
  69. package/src/backends/mlx/projected-context-rows.ts +72 -0
  70. package/src/backends/mlx/prompt-input.ts +29 -0
  71. package/src/backends/mlx/qwen-prompt-input.ts +40 -0
  72. package/src/backends/mlx/request-state-policy.ts +54 -0
  73. package/src/backends/mlx/rollback.ts +45 -4
  74. package/src/backends/mlx/row-sampling.ts +49 -0
  75. package/src/backends/mlx/serial-executor.ts +51 -73
  76. package/src/backends/mlx/speculative-group.ts +438 -0
  77. package/src/backends/mlx/speculative-round.ts +161 -0
  78. package/src/backends/mlx/speculative.ts +24 -7
  79. package/src/backends/mlx/state-rows.ts +104 -0
  80. package/src/backends/mlx/state-views.ts +21 -1
  81. package/src/backends/mlx/target-layout-capability.ts +35 -0
  82. package/src/backends/mlx/transitioning-kv-rows.ts +173 -0
  83. package/src/cli.ts +333 -36
  84. package/src/contracts/execution.ts +21 -0
  85. package/src/contracts/object-cache.ts +8 -0
  86. package/src/contracts/pi-provider.ts +1 -1
  87. package/src/contracts/pi.ts +3 -1
  88. package/src/contracts/prefix-cache.ts +33 -0
  89. package/src/contracts/resources.ts +7 -0
  90. package/src/contracts/sampling.ts +23 -0
  91. package/src/contracts/scheduling.ts +27 -0
  92. package/src/engine/execution-plan.ts +38 -25
  93. package/src/engine/execution-tasks.ts +44 -0
  94. package/src/engine/namespaced-cache.ts +13 -0
  95. package/src/engine/resources.ts +12 -1
  96. package/src/engine/scheduler.ts +32 -7
  97. package/src/fill/fill-session.ts +14 -3
  98. package/src/fit.ts +29 -15
  99. package/src/generate.ts +105 -195
  100. package/src/grammar.ts +13 -0
  101. package/src/inference/draft-acceptance.ts +41 -0
  102. package/src/inference/draft-output.ts +49 -0
  103. package/src/inference/prefill.ts +6 -0
  104. package/src/inference/rollback.ts +2 -2
  105. package/src/kv-scheme.ts +92 -12
  106. package/src/kv-store.ts +183 -93
  107. package/src/lab/README.md +5 -1
  108. package/src/lab/paged-kv/paged-attention.ts +117 -0
  109. package/src/lab/paged-kv/paged-kv-rows.ts +111 -0
  110. package/src/lab/paged-kv/paged-kv.ts +126 -46
  111. package/src/md-modules.d.ts +5 -0
  112. package/src/mlx/array.ts +39 -1
  113. package/src/mlx/ffi.ts +19 -0
  114. package/src/mlx/normalized-argmax.ts +116 -0
  115. package/src/mlx/ops.ts +97 -10
  116. package/src/model/artifact-identity.ts +73 -0
  117. package/src/model/batched-kv.ts +235 -0
  118. package/src/model/batched-mask.ts +12 -4
  119. package/src/model/batched-quant.ts +8 -2
  120. package/src/model/batched-quantized-kv.ts +144 -0
  121. package/src/model/batched-rotating-quant.ts +76 -15
  122. package/src/model/batched-rotating-state.ts +76 -0
  123. package/src/model/batched-rotating.ts +64 -22
  124. package/src/model/batched-row-storage.ts +52 -0
  125. package/src/model/batched-ssm.ts +52 -0
  126. package/src/model/batched-turboquant-kv.ts +94 -0
  127. package/src/model/compiled-decode.ts +7 -1
  128. package/src/model/decoded-kv-donor.ts +12 -0
  129. package/src/model/delayed-quantized-kv.ts +72 -0
  130. package/src/model/delayed-rotating-quantized-kv.ts +93 -0
  131. package/src/model/delayed-turboquant-kv.ts +57 -0
  132. package/src/model/factory.ts +26 -0
  133. package/src/model/fingerprint.ts +12 -0
  134. package/src/model/full-prefill-padding.ts +56 -0
  135. package/src/model/full-prefill-row.ts +105 -0
  136. package/src/model/gemma4-base.ts +183 -82
  137. package/src/model/gemma4.ts +116 -28
  138. package/src/model/generated/gemma4-12b.ts +4 -1
  139. package/src/model/generated/gemma4-26b.ts +4 -1
  140. package/src/model/generated/gemma4-e4b.ts +4 -1
  141. package/src/model/glm52-cache.ts +80 -4
  142. package/src/model/glm52-mla.ts +12 -6
  143. package/src/model/glm52.ts +19 -40
  144. package/src/model/kv-attention-view.ts +70 -0
  145. package/src/model/minicpm5.ts +11 -7
  146. package/src/model/profile.ts +29 -4
  147. package/src/model/quantized-append-attention.ts +31 -0
  148. package/src/model/qwen3-delta-state.ts +74 -0
  149. package/src/model/qwen3-delta.ts +59 -36
  150. package/src/model/qwen3-mrope.ts +7 -9
  151. package/src/model/qwen3_5.ts +177 -75
  152. package/src/model/rotating-kv-donor.ts +35 -0
  153. package/src/model/rotating-kv-layout.ts +262 -0
  154. package/src/model/rotating-row-transaction.ts +35 -0
  155. package/src/model/speculative-rotating-kv.ts +101 -0
  156. package/src/model/ssm-prefill-padding.ts +39 -0
  157. package/src/model/support.ts +8 -0
  158. package/src/model/token-groups.ts +66 -0
  159. package/src/model/trellis-linear.ts +4 -4
  160. package/src/model/turboquant-codec.ts +89 -0
  161. package/src/model/universal/dense.ts +14 -13
  162. package/src/model/whisper.ts +435 -0
  163. package/src/native/mic_capture.swift +92 -0
  164. package/src/native-pack.ts +6 -5
  165. package/src/pi-web.ts +9 -1
  166. package/src/preflight.ts +31 -15
  167. package/src/prompt-cache.ts +306 -86
  168. package/src/runtime-config.ts +1 -5
  169. package/src/safetensors.ts +9 -2
  170. package/src/sampler.ts +37 -25
  171. package/src/serve/audio-routes.ts +323 -0
  172. package/src/serve/chat-request.ts +2 -0
  173. package/src/serve/chat-stage.ts +19 -14
  174. package/src/serve/completion-executor.ts +9 -1
  175. package/src/serve/discovery-routes.ts +17 -1
  176. package/src/serve/generated-token-history.ts +57 -0
  177. package/src/serve/generation-gateway.ts +88 -38
  178. package/src/serve/model-binding.ts +7 -1
  179. package/src/serve/model-host.ts +3 -4
  180. package/src/serve/preparation.ts +3 -3
  181. package/src/serve/prompt-response-trace.ts +14 -0
  182. package/src/serve/request-plan.ts +6 -3
  183. package/src/serve/request-prep.ts +40 -25
  184. package/src/serve/text-completion-stage.ts +2 -2
  185. package/src/serve/transcription-server.ts +64 -0
  186. package/src/serve/transcription-service.ts +502 -0
  187. package/src/server.ts +185 -261
  188. package/src/spec/assistant-rows.ts +93 -0
  189. package/src/spec/assistant-source.ts +28 -18
  190. package/src/spec/cache-identity.ts +22 -0
  191. package/src/spec/deepspec-rows.ts +29 -0
  192. package/src/spec/deepspec-source.ts +12 -10
  193. package/src/spec/dflash-source.ts +28 -4
  194. package/src/spec/drafter.ts +153 -142
  195. package/src/spec/dspark/deepspec-module.ts +95 -120
  196. package/src/spec/dspark/module-dflash.ts +126 -170
  197. package/src/spec/glm52-mtp-graph.ts +29 -0
  198. package/src/spec/glm52-mtp-rows.ts +132 -0
  199. package/src/spec/glm52-mtp-source.ts +54 -136
  200. package/src/spec/glm52-mtp-state.ts +33 -0
  201. package/src/spec/ngram-source.ts +115 -21
  202. package/src/spec/projected-draft-rows.ts +73 -0
  203. package/src/spec/qwen-mtp-module.ts +171 -0
  204. package/src/spec/qwen-mtp-rows.ts +230 -0
  205. package/src/spec/qwen-mtp-source.ts +84 -226
  206. package/src/spec/qwen-mtp-state.ts +30 -0
  207. package/src/spec/serve-loop.ts +73 -69
  208. package/src/spec/source.ts +93 -15
  209. package/src/spec/two-model-rows.ts +62 -0
  210. package/src/spec/two-model.ts +45 -103
  211. package/src/ssd-cache.ts +107 -36
  212. package/src/ssd-durability.ts +29 -27
  213. package/src/storage/host-buffer.ts +24 -0
  214. package/src/storage/kv-writer.ts +83 -0
  215. package/src/storage/kv-writer.worker.js +264 -0
  216. package/src/storage/retention-policy.ts +37 -0
  217. package/src/tiered-prompt-cache.ts +45 -0
  218. package/src/vision/embedder.ts +8 -0
  219. package/src/vision/prompt.ts +101 -65
  220. package/src/vision/qwen3vl-prompt.ts +101 -64
  221. package/src/vision/qwen3vl-tower.ts +11 -0
  222. package/src/vision/siglip.ts +8 -0
  223. package/src/web/app.html +12 -0
  224. package/src/web/app.js +217 -57
  225. package/src/web/src/chat.ts +4 -1
  226. package/src/web/src/composer.ts +3 -0
  227. package/src/web/src/voice.ts +141 -0
  228. package/src/web/sw.js +1 -1
  229. package/src/backends/mlx/memory-guard.ts +0 -40
  230. package/src/spec/prefix-state.ts +0 -45
  231. /package/docs/{planning → archive/planning}/release-notes-v0.3.0.md +0 -0
@@ -3,7 +3,7 @@ status: active
3
3
  axis: ON
4
4
  canonical-for: decode-speed-levers
5
5
  plan-anchor: "Phase 6 — Speed: change what gets computed `[~]`"
6
- last-verified: 2026-09-07
6
+ last-verified: 2026-09-08
7
7
  ---
8
8
 
9
9
  # Inference performance program
@@ -12,9 +12,11 @@ This is the canonical performance research plan. The current priority is the
12
12
  Qwen3.8-27B program in section 7, covering quants, the complete execution graph,
13
13
  custom kernels, deterministic token replay, prefill, decode, and serving.
14
14
  Sections 1–6 retain the earlier cross-model research and the
15
- **port ledger vs oMLX** (§6, folded in from `docs/design/decode-speed-program.md` on
16
- 2026-08-23). Status and run logs live in PLAN.md (Phase 6 and the serve
17
- h2h phases); the architecture the levers plug into is
15
+ **port ledger vs oMLX** (§6, folded in from `docs/design/omlx-adoption-map.md`
16
+ in `2b571ff`, 2026-08-24). Open status lives in PLAN.md (Phase 6); the
17
+ campaign run log is
18
+ [qwen38-27b-campaign-log.md](../archive/investigations/qwen38-27b-campaign-log.md)
19
+ and its outcome ledger is §7.13; the architecture the levers plug into is
18
20
  `unified-engine-frontier-plan.md`; curated numbers are
19
21
  `docs/reference/benchmarks.md`. Every lever here has evidence, an expected
20
22
  win, and a trigger; pick them up in order. No number below is new — each
@@ -27,8 +29,8 @@ decode tok/s ≈ bandwidth ÷ bytes-touched-per-token. The earlier mode-matrix b
27
29
  (`scripts/bench-matrix.ts modes`) confirmed what the roofline work predicted:
28
30
  the then-tested L1 decode paths approached the memory-bandwidth wall
29
31
  at short context, so tier levers cannot buy single-stream decode speed
30
- (PLAN.md "Decision: naked default = --l1": decode parity with mlx-lm on every
31
- model; no output-changing lever beat it). Faster therefore means one of five
32
+ (naked default = `--l1`, decided 2026-07-05, `git show 3199c75:PLAN-archive.md`:
33
+ decode parity with mlx-lm on every model; no output-changing lever beat it). Faster therefore means one of five
32
34
  physical moves:
33
35
 
34
36
  1. read the weight bytes ONCE for several tokens — speculation, batching;
@@ -96,14 +98,15 @@ What remains is drafters worth running, in this order:
96
98
  exist in `src/`. The measured motivation stands: acceptance dropped 51%→29%
97
99
  under grammar with a blind drafter (our own matrix). (iii) grammar-pruned
98
100
  draft TREES (XGrammar-2's `traverse_draft_tree`) — idea only.
99
- - **Per-slot drafting under batching** — the composition-matrix row in the
100
- architecture doc; a mounted draft routes every request serial today.
101
+ - **Drafting under batching** — grouped provider execution is implemented at
102
+ B1/B>1, with method-owned candidate generation, verification and companion
103
+ state. Remaining compositions and evidence live in [batching](batching.md#consolidation-matrix).
101
104
 
102
105
  ### Lever 2 — native MLX updates against the pinned control
103
106
 
104
- We are pinned to the oracle stack in PLAN.md "Reference environment" (mlx
105
- 0.31.2). The July audit below identified upstream changes absent from that
106
- pin. Recheck current releases and the native libraries actually loaded before
107
+ The runtime and oracle now use MLX 0.32.2 / native pack 0.4.0; see §7.12 and
108
+ [environment](../reference/environment.md). The historical July audit below
109
+ identified upstream changes absent from its then-current MLX 0.31.2 pin. Recheck current releases and the native libraries actually loaded before
107
110
  an upgrade experiment. A new mlx/mlx-c build also needs matching oracles;
108
111
  retain the pinned installation and test the new stack in isolation.
109
112
  Upstream refs are full URLs on purpose (a bare `#NNNN` here resolves to our
@@ -322,15 +325,12 @@ contracts; oMLX is a Python appliance ON mlx-lm:
322
325
 
323
326
  Josh requested a complete inference optimization campaign on 2026-09-04.
324
327
  Optimize useful completed work at a measured quality and memory budget.
325
- The deliverable is a frontier of configurations for the M4 Pro, with a reason
326
- to keep or reject every investigated method. A smaller artifact, a faster
328
+ The deliverable is a frontier of configurations, with a reason
329
+ to keep or reject every investigated method; every number records the
330
+ host/chip/RAM it was measured on. A smaller artifact, a faster
327
331
  microkernel, and a higher draft acceptance rate are intermediate results.
328
332
  Each must survive the full application measurement.
329
333
 
330
- Josh narrowed the remaining hardware scope to the M4 Pro on 2026-09-06.
331
- M1 Max runs are not required for this campaign. Existing M1 Max evidence
332
- remains historical; the final report format still supports other machines.
333
-
334
334
  Single-request performance is a primary acceptance target alongside aggregate
335
335
  serving. Use the existing `scripts/bench-serve.ts all` workload, which replaced
336
336
  the root `benchmark.sh` in `7d81462`: sustained decode, cold and cached TTFT,
@@ -636,7 +636,7 @@ ledger. A candidate's priority changes when the measured graph changes.
636
636
 
637
637
  | ID | experiment | measure and deciding condition |
638
638
  |---|---|---|
639
- | R0 | Exact artifact and execution controls for performance | Freeze `673b43f` plus the integrated local diff; matched token IDs, active graph/method/quant, raw timings and actual memory. Use relevant numerical and lifetime gates; the wider refactor acceptance program is separate. Resolve the M4 delta golden cell before L1 promotion. |
639
+ | R0 | Exact artifact and execution controls for performance | Freeze `673b43f` plus the integrated local diff; matched token IDs, active graph/method/quant, raw timings and actual memory. Use relevant numerical and lifetime gates; the wider refactor acceptance program is separate. The M4 DeltaNet golden cell is resolved (§7.1; environment.md). |
640
640
  | R1 | Packed prefill tile decode plus matmul | Decode a tile into registers/threadgroup storage and consume it with supported Metal matrix operations. Compare with bounded dense expansion. Win must lower TTFT without a larger peak live working set. |
641
641
  | R2 | Bounded expansion scheduling | Compare per-projection, per-layer and bounded groups of projections; include cache outputs in dependencies. Test async evaluation and explicit memory budgets. A removed wait is a win only if memory lifetime stays bounded. |
642
642
  | R3 | Axis-0 scatter layout and split-K | Sweep splits 16/32/64/128/256, lane/output ownership, row tiling, vector loads and split-reduction fusion. Preserve the rotated coding axis. Include partial-buffer traffic and final reduction. |
@@ -652,7 +652,7 @@ ledger. A candidate's priority changes when the measured graph changes.
652
652
  | R13 | Attention and KV | Stock SDPA dispatch, tiling, grouped-query reuse, fused KV append/quantize, direct attention over compressed KV, mask specialization, RoPE fusion and paged versus contiguous storage. Measure quality, TTFT and decode by depth. |
653
653
  | R14 | Vocabulary head and sampler | Last-position-only projection, exact fused matvec/argmax for eligible greedy requests, GPU logits processors, reduced readbacks and structured-output singleton runs. Head elimination must respect logprobs and sampling contracts. |
654
654
  | R15 | Deterministic no-verification replay | Follow section 7.5. Improve proven coverage and span execution economics; report wall time and output identity independently. This is a first-class track ahead of speculative drafter training. |
655
- | R16 | MLX graph and loop | Use model-owned graph/method bindings for compiled regions, stable buffers/shapes, graph replay, cache donation, allocation removal, bounded device-side chaining and host/GPU overlap. Measure session/lease/readback costs without adding per-op evals. Preserve cancellation and ownership gates. |
655
+ | R16 | MLX graph and loop | Use model-owned graph/method bindings for compiled regions, stable buffers/shapes, graph replay, cache donation, allocation removal, bounded device-side chaining and host/GPU overlap. Measure session/lease/readback costs without adding per-op evals. Preserve cancellation and ownership gates. | | | | Early-output native, HTTP, cancellation/overlap and cached/SSD acceptance is complete; see benchmarks.md for monitored repeats and activity limits. The MLX 0.32.2 submission screen is complete: retain upstream startup defaults, with the measured M4 Llama override available explicitly. The current native API has no model-scoped setter; revisit integration if that interface becomes available. See benchmarks.md for the cross-model results and activity records.
656
656
  | R17 | Hybrid prefix and recurrent state reuse | Exact prefixes, semantic anchors, page/block storage, compact active-state updates and checkpoint cadence. Test mixed prompt edits and cancellation; no KV-only hit that loses the corresponding recurrent state. |
657
657
  | R18 | Scheduler | Solo latency, actual B-wide prefill, continuous batching, chunked-prefill/decode interleaving and shape buckets. Report per-request latency and aggregate throughput; one cannot substitute for the other. |
658
658
  | R19 | Weight-quality allocation | Measured latency-aware allocation across MLP, attention, GDN, embedding and head; GPTQ/LDLQ calibration and damping; QTIP/YAQA rounding; group size, k, L, block length, rotations and sensitive-layer exceptions. Optimize quality/bytes/time together. |
@@ -778,7 +778,7 @@ One model-owning process at a time on these Macs; restart paired server arms
778
778
  sequentially when both do not fit. Control cold-cache and warm-cache trials
779
779
  explicitly. Preserve all samples and interruptions. Do not keep retrying until
780
780
  a favorable result appears. Recheck residency, swap activity and thermal state
781
- between cells, and repeat finalists in a separate session on the M4 Pro.
781
+ between cells, and repeat finalists in a separate quiet-machine session.
782
782
 
783
783
  Estimate paired log-ratio confidence intervals with sessions/prompts as the
784
784
  independent units. A default speed win should exceed 3% and have a 95% lower
@@ -814,6 +814,9 @@ the combined and held-out gates, and a final source review finds no untested
814
814
  applicable candidate with meaningful remaining headroom. Blocked or
815
815
  unmeasured rows do not count as exhausted. This is a reproducible stopping
816
816
  rule for a finite search, not a claim that no future algorithm can be faster.
817
+ §7.13 is the outcome ledger this rule requires: one row per R0–R24 with its
818
+ outcome, retained flags, evidence, next discriminating step and reopen
819
+ condition.
817
820
 
818
821
  The scope also includes every owned kernel and native operation used by the
819
822
  project's other model paths. Maintain an inventory of dispatch sites, generated
@@ -823,8 +826,8 @@ layers, embeddings, normalization, activation, sampling, masks, cache codecs,
823
826
  media paths and streamed experts, including graph construction and host work.
824
827
  Each inventory row needs an explicit result; a Qwen-only trace cannot close
825
828
  an operation used elsewhere. Keep unavailable-model or hardware cells visible.
826
- Run the final comparison on the M4 Pro. Pin source, runtime/library
827
- versions, artifacts, request settings and
829
+ Run the final comparison on a quiet machine and record its host/chip/RAM.
830
+ Pin source, runtime/library versions, artifacts, request settings and
828
831
  cache state so kernel gains are not confused with different test conditions.
829
832
 
830
833
  The final task benchmark uses
@@ -892,7 +895,7 @@ differ across Luke's coding profiles. The selected section is
892
895
  The task uses that exact prompt and request recipe. Its first attempt was
893
896
  stopped after a serving bug discarded the preceding thinking on tool turns.
894
897
 
895
- The MTP-prefix integration, now included in the PR #47 feature branch, permits Qwen uniform KV4 with start=0
898
+ The MTP-prefix integration (merged in PR #47) permits Qwen uniform KV4 with start=0
896
899
  behind `MLX_BUN_QWEN_SPEC_KV4`. Prefill converts attention caches through
897
900
  `maybeQuantizeKv`; rollback binds after conversion, and prefix identity includes
898
901
  KV bits, group size and conversion policy. Recurrent state remains full precision.
@@ -911,7 +914,7 @@ size for MLX prefill, bounding long-context attention workspace.
911
914
  ceiling to exactly 131072, never enlarges it. Pi uses the same context and
912
915
  xhigh effort. Responses run until EOS or remaining context, with no invented
913
916
  16K cap. Task timing includes automatic tool use and retries; app scoring
914
- follows after inference exits. The completed retry is recorded later in this section.
917
+ follows after inference exits. The completed retry is recorded below.
915
918
  Raw evidence and invalid runs remain in `reports/qwen38-rd/kanban-final/`.
916
919
 
917
920
  The paired cache currently captures prompt checkpoints only. Extending it to
@@ -1016,9 +1019,9 @@ ranges across layers. Keep exact range/mask values, outstanding-view ownership
1016
1019
  and the memory bound as gates; measure complete prefill and verification rounds
1017
1020
  before retaining an allocation or dispatch optimization.
1018
1021
 
1019
- The pinned MLX 0.32.2 source also gives a specific native scheduling experiment
1022
+ The pinned MLX 0.32.2 source supplied a native scheduling experiment
1020
1023
  for the three-query KV4 verification window. Qwen's 24 query heads share four
1021
- KV heads (GQA6), with D256. `quantizedSdpaUnfused` currently presents the heads
1024
+ KV heads (GQA6), with D256. `quantizedSdpaUnfused` originally presented the heads
1022
1025
  as separate broadcast batches. In `mlx/backend/metal/quantized.cpp`, the
1023
1026
  M4-eligible affine key multiplication selects `qmv_wide`: three vectors per
1024
1027
  threadgroup, eight reduction lanes, and a separate batch for each query head.
@@ -1047,6 +1050,15 @@ causal string currently rebuilds the boolean array in each unfused attention
1047
1050
  call. Keep the bf16 and OptiQ dispatch policies intact and measure the retained
1048
1051
  mask's lifetime as well as complete-forward timing before retaining that change.
1049
1052
 
1053
+ The screen and full-model/HTTP comparisons are now complete. Three-head key
1054
+ grouping is selected on M4 Pro for the tested B1/B2, L3, GQA6/D256,
1055
+ KV4/group64, bf16/f32, N≥8192 geometry. Other geometry retains the existing
1056
+ native selection. M1 grouped key scores differ, so its key geometry remains
1057
+ unchanged. The permanent regression compares strided KV against the separate
1058
+ head composition. Exactness, complete-forward and serving measurements are
1059
+ recorded in benchmarks.md under Three-query affine attention head grouping.
1060
+ The shared causal-mask experiment remains separate, unmeasured work.
1061
+
1050
1062
  Do not apply that fold indiscriminately to the value multiplication. Its native
1051
1063
  matrix threshold is four query rows, so the same reshape would change the
1052
1064
  algorithm. At long context it uses `qvm_split_k`, with 32 partitions beyond
@@ -1111,1127 +1123,58 @@ This is a source-derived scheduling hypothesis, not a measured speed claim;
1111
1123
  each window's native arithmetic, rollback, cache reuse and completed response
1112
1124
  remain correctness and acceptance gates.
1113
1125
 
1114
- ### 7.8 Execution progress and next measurements
1115
-
1116
- Use the integrated memory safeguards and relevant numerical controls in
1117
- section 7.1, then measure the expensive computation. The existing benchmark
1118
- accepts an exact local artifact and can print its
1119
- commands without loading a model. The first prepared jobs are the affine
1120
- flagship on mlx-bun serial versus mlx-lm, followed by packed Q3 on mlx-bun
1121
- serial. Start at 4k context; widen only after the measured memory row.
1122
- The commands and preparation mode are documented in
1123
- [benchmarks.md](../reference/benchmarks.md#running-the-benchmark).
1124
-
1125
- The harness now keeps all five decode samples, uses reproducible nonces with
1126
- `--workload-seed`, pins thinking mode across arms, and saves request bodies,
1127
- counts, finish reasons, errors and wall times in a JSON companion. It rejects
1128
- missing token usage instead of counting SSE chunks as tokens. Each block
1129
- still needs an explicit AB/BA order and a distinct output path; one harness
1130
- pass is a screening block, not the full paired-session confidence interval.
1131
- Identical decoded text and prompt counts remain a smoke check; engine logit
1132
- and token-ID gates provide the stronger correctness evidence.
1133
-
1134
- The matched-prefill MTP control exposed a separate ordinary-generation
1135
- latency cost: the serial loop constructs the next decode step before yielding
1136
- token zero. A runtime-only source transform yields the first sampled token
1137
- before that construction, retaining the later pipeline and excluding fill,
1138
- grammar and resumed generation. Its initial packed-model pair preserves every
1139
- token ID, live cache state, cache key, usage count and finish reason at raw
1140
- prompt lengths 6/128/512. Native first-token latency improves while complete
1141
- generation time is approximately flat. Six lifecycle tests, the 26 existing
1142
- fill-loop tests and 15 binding tests pass with the prototype. One binding
1143
- cancellation expectation needs the new event order: token zero may arrive
1144
- before cancellation triggered inside the subsequent forward; no token arrives
1145
- after cancellation. Consumer return at that first yield leaves a correctly
1146
- described prompt-only cache. Those screens changed only the runtime-loaded module.
1147
-
1148
- The first serial HTTP pair preserves all seven warm/measured responses but
1149
- does not reproduce the native TTFT improvement. Client-visible output can lag
1150
- token zero through detokenizer buffering. A separate sink observer confirms
1151
- that these raw prompts first generate bare-space token 220, which emits no
1152
- event, followed by token 17 (`2`), which emits content and yields for network
1153
- progress. Both arms preserve that sequence; earlier delivery of the hidden
1154
- space cannot improve client TTFT. Keep this negative result and test chat
1155
- fixtures before attributing a serving win or integrating the prototype.
1156
- Both screens keep sources fixed and exit cleanly. Evidence:
1157
- `first-yield-native-screen{,-review}.json`, `first-yield-http-screen.json`,
1158
- `first-yield-http-observe.json` and its per-server `*.sink.json` records,
1159
- `first-yield-smoke-candidate-v2.txt`, `first-yield-existing-loop-tests.txt` and
1160
- `first-yield-binding-order-tests.txt` in the campaign report directory.
1161
-
1162
- The subsequent three-fixture chat HTTP screen preserves all seven paired
1163
- responses and improves first visible output on each measured fixture, with
1164
- approximately flat complete-request time. Evidence:
1165
- `first-yield-chat-http-screen{,-review}.json`. A simplified version captures
1166
- the current sample index before yielding and increments the normal generated
1167
- count immediately, avoiding a second stats counter. Its control passes eight
1168
- tests and the candidate passes 49 lifecycle, binding and fill-loop tests,
1169
- including two- and three-token budgets. The first budget test expected an
1170
- explicit native `length` reason, but the incumbent leaves budget completion
1171
- implicit; the corrected assertion preserves that contract. Evidence:
1172
- `first-yield-v2-{control-tests,tests,tests-corrected}.txt`. The simplified
1173
- prototype then completes six fresh-process native pairs. All 36 warm/measured
1174
- token, live-state, cache-key and usage comparisons agree; every measured pair
1175
- improves first-token latency at all three prompt lengths. Complete generation
1176
- time is approximately flat. All 12 children exit cleanly with fixed sources
1177
- and the same remaining active allocation after explicit cleanup. Evidence:
1178
- `first-yield-native-v2-repeat{,-review}.json`. Six chat server pairs then
1179
- complete all 84 requests with 42 exact response/count/finish comparisons.
1180
- Every measured pair improves first visible output, with approximately flat
1181
- complete-request time. The sampled native audit also preserves token IDs,
1182
- requested log probabilities and live cache state across two seeds and two
1183
- prompt lengths, with penalties enabled. Both runs keep sources fixed and
1184
- exit cleanly. Evidence: `first-yield-chat-http-v2-repeat{,-review}.json` and
1185
- `first-yield-sampled-native.json`. Other artifacts and cached/pressure
1186
- acceptance remain, including first-token consumer return and follow-up reuse.
1187
-
1188
- The serial change is now integrated behind `MLX_BUN_EARLY_FIRST_TOKEN=1`,
1189
- default off. Its scheduling decision comes from the binding's captured
1190
- runtime; request and execution interfaces are unchanged. Eight permanent
1191
- binding tests cover both settings, captured-policy isolation, short budgets,
1192
- early return, cancellation and initial EOS. The focused tests and enabled-fill
1193
- regression pass, as do all three typechecks, hygiene and the complete
1194
- model-free suite: 1,831 pass, 10 skip, zero failures. The first cancellation
1195
- test incorrectly expected final stats after an exception; the corrected test
1196
- preserves the existing null-stats contract for aborted runs. Orderly consumer
1197
- return still reports the emitted token and exact cache key. Real-model and
1198
- HTTP flag comparisons follow the prototype measurements before this thread
1199
- can close. Evidence: `first-yield-production-unit{,-v2}.txt`,
1200
- `first-yield-production-fill-enabled.txt`, `first-yield-production-typecheck.txt`,
1201
- `first-yield-production-hygiene.txt` and `first-yield-production-model-free.txt`.
1202
- The integrated packed-model native pair preserves all six warm/measured
1203
- token/state/key/usage comparisons. Its serial HTTP pair completes 14 responses
1204
- with all seven paired text/count/finish checks exact. Both reproduce earlier
1205
- first-token delivery and keep sources fixed with clean child exits. A slow
1206
- HTTP warmup is retained; these integration screens do not replace the six
1207
- balanced prototype pairs for timing evidence. Evidence:
1208
- `first-yield-production-native-r6{,-review}.json` and
1209
- `first-yield-production-http-r6{,-review}.json`. Closed source-transform and
1210
- duplicate test helpers are removed; permanent tests and raw reports remain.
1211
- The first integrated RTN4 native pair also preserves all six token/state/key
1212
- comparisons. Its apparent large complete-time difference is not accepted as
1213
- a speed gain: step intervals change substantially within the control process,
1214
- system swap grows and final preflight records substantial Chrome CPU use.
1215
- Keep this correctness result and repeat timing before attribution. Evidence:
1216
- `first-yield-production-native-rtn4{,-review}.json` and per-token arrival times
1217
- in the same report. No unrelated application was stopped.
1218
-
1219
- The continuous scheduler has its own first-output boundary: an empty group
1220
- finishes preparation and emits token zero, then advances decode before its
1221
- event-loop yield. A separate prototype adds a yield only when preparation
1222
- leaves exactly one active row and no queued arrivals. It preserves grouped
1223
- short admissions and stops immediately if the group closes during that await.
1224
- Nine scheduling tests pass for each control/candidate arm; an actual
1225
- continuous HTTP screen must verify wire placement and client arrival time.
1226
- Evidence: `first-prepare-scheduler-{control,candidate}.txt` and the frozen
1227
- `first-prepare-http-screen-plan.json` in the campaign report directory.
1228
-
1229
- Six subsequent AB/BA blocks complete on the M4 Pro with 12 clean server exits,
1230
- 84 responses and 42 exact paired responses, including counts, finish reasons
1231
- and cache usage. The actual continuous lane and submitted-row increment are
1232
- checked for every request. Median paired TTFT changes are -7.66% for code,
1233
- -7.90% for explanation and -5.63% for JSON, about 74–77 ms earlier. Complete
1234
- request time changes by +0.15%, +0.04% and +0.08%, respectively. One code pair
1235
- has 2.20% worse TTFT and remains in the report. The machine begins with Chrome
1236
- CPU activity and existing swap, so these are diagnostic measurements. Chrome
1237
- is unrelated background load; a Bun HTTP client sends requests directly to
1238
- the server without the chat UI. Source hashes remain fixed. Evidence is
1239
- `first-prepare-http-repeat{,-review}.json`; scheduler lifecycle and broader
1240
- request gates remain before integration.
1241
-
1242
- The continuous option is now integrated under `MLX_BUN_EARLY_FIRST_TOKEN`,
1243
- default off. The MLX backend reads its captured runtime and passes a boolean
1244
- to the generic scheduler. No request or execution-contract field is added.
1245
- After the early yield, the scheduler restarts its policy loop so new arrivals,
1246
- cancelled queued work, admission holds and shutdown are observed before the
1247
- next step. Eight added unit cases cover those transitions, short-admission
1248
- grouping, an existing active row and cleanup on a failed yield. All 1,839
1249
- model-free tests, the three typechecks and hygiene pass. Integrated real HTTP,
1250
- cache, pressure and quiet gates remain. The integrated native option also
1251
- passes four sampled cases per artifact on packed Q3 and RTN4, preserving all
1252
- 32 token IDs, requested log probabilities, cache keys, live KV/recurrent state
1253
- and usage. Each arm returns to the same measured native allocation baseline
1254
- after disposal. These are correctness checks, not repeated timing claims.
1255
- Evidence is `first-prepare-production-{unit,model-free,typecheck,hygiene}.txt`
1256
- and `first-yield-production-sampled-{r6,rtn4}.json`.
1257
-
1258
- The first integrated continuous HTTP attempt is retained as a setup failure.
1259
- Its driver set the new option after MLX imports had captured the runtime, so
1260
- the candidate's execution counter remained zero and rejected the run. The
1261
- corrected driver sets the flag in the child environment before imports. Both
1262
- arms then execute the same instrumented production source, with seven early
1263
- yields in the candidate and zero in the control. All seven paired responses
1264
- and usage/finish checks pass, with fixed source and clean exits. TTFT improves
1265
- by 68–90 ms across the three measured fixtures; this one-block integration
1266
- check does not replace the six prototype timing pairs. Evidence is
1267
- `first-prepare-production-http-r6-v2{,-review}.json`; the original unsuffixed
1268
- report preserves the failed path-coverage check.
1269
-
1270
- Nine packed-Q3 native cache-lifecycle pairs also pass. At prompt lengths
1271
- 6/128/512, each arm either returns after one token, returns after two, or
1272
- aborts after one, then reuses its own borrowed cache for a 16-token follow-up.
1273
- An early first-token return/abort covers the prompt alone; the incumbent has
1274
- already fed token zero. Clean-return cache keys reflect those exact positions,
1275
- and an aborted generation retains the existing null-stats contract. A
1276
- one-token follow-up suffix with ordinary tail splitting gives matched M=1
1277
- forwards for any missing emitted token. All subsequent tokens, requested log
1278
- probabilities, final live cache states and cache keys match. Both processes
1279
- return to 16,390 native active bytes after disposal, without forced GC, and
1280
- the source stays fixed. This proves the covered native reuse transitions;
1281
- HTTP cache/SSD pressure and broader suffix shapes remain. Evidence is
1282
- `first-yield-production-cache-r6.json`. The same nine pairs also pass on RTN4,
1283
- including every follow-up token, requested log probability, cache key and live
1284
- state. Both RTN4 arms return to six native active bytes after disposal. Its
1285
- separate evidence is `first-yield-production-cache-rtn4.json`.
1286
-
1287
- The broader native suffix screen completes 110 follow-ups across both Qwen
1288
- quants at suffix lengths 1/2/3/4/5/8/31/127/511/512/513. It does not pass
1289
- universal identity. After returning at token one, the early arm's prompt-only
1290
- cache makes the next prefill one token longer. Seven packed and six RTN4
1291
- cases change log probabilities or live state; two packed cases and one RTN4
1292
- case also change emitted IDs. Every two-token-return case remains exact.
1293
- Feeding the missing emitted token separately at M=1 restores exact stopped
1294
- state and all 22 aligned follow-ups, including requested log probabilities
1295
- and cache keys. Both arms return to their original active-allocation baselines.
1296
- This identifies a prefill-shape effect, not a seed mismatch or a corrupted
1297
- snapshot. Keep the option experimental; reconciling the first-token cache
1298
- boundary needs an implementation and performance gate before default
1299
- promotion. Evidence is `first-yield-suffix-qwen{,-review}.json`. The preceding
1300
- Llama smoke also records a natural 512-token suffix state/logprob difference.
1301
-
1302
- The integrated option also passes the saved seven-request agent-boundary/SSD
1303
- gate in serial and actual continuous serving on the M4 Pro 24 GB. The first
1304
- six one-token budgets retain their original path; each lane's counter proves
1305
- the new option runs once on the final 512-token request. All 14 paired choices
1306
- and complete usage records match. The longest prompt has 14,465 tokens and
1307
- reuses the same 12,953-token prefix in every arm. All four final flushes report
1308
- 14 durable entries, no pending/missing/failed snapshots, and a longest durable
1309
- prefix of 14,976 tokens. Sources stay fixed and all servers exit cleanly.
1310
- These non-streaming responses establish the covered memory/cache lifecycle,
1311
- not a TTFT result or an agent task success. Broader suffix shapes remain.
1312
- Evidence is
1313
- `first-token-production-long-{serial,continuous}{,-review}.json`.
1314
-
1315
- Actual streaming HTTP cancellation and arrival checks now pass 120 requests
1316
- across eight Qwen servers, covering packed Q3 and RTN4, serial and continuous
1317
- serving, and both option settings. Each server aborts twice at headers and
1318
- twice at first output, then completes an independent recovery request after
1319
- each abort. The server observes all 32 cancellations and settles before
1320
- consuming the 512-token budget. Every recovery response, usage record and
1321
- finish reason matches its reference. Final active MLX allocation equals the
1322
- loaded-model baseline exactly, with no cache entries or active/pending rows.
1323
- One-token budgets also remain exact. Both overlapping-arrival fixtures
1324
- observe two active rows in continuous serving, with actual admission counts;
1325
- serial serving remains serial. All sources stay fixed and servers exit
1326
- cleanly. A preceding Llama smoke adds 60 requests and 16 cancellations.
1327
- These instrumented checks establish lifecycle behavior, not speed. Concurrent
1328
- trajectories are not compared across differing admission timing and batch
1329
- shapes. Evidence is `first-token-lifecycle-{llama,qwen}{,-review}.json`.
1330
-
1331
- The first actual continuous HTTP pair then completes all 14 requests with
1332
- seven exact response/count/finish comparisons and verified batched placement.
1333
- First visible output improves on all three measured chat fixtures; complete
1334
- time varies slightly. Both servers exit cleanly with fixed sources. This
1335
- remains a prototype pending balanced repeats and broader scheduling gates.
1336
- Evidence: `first-prepare-http-screen{,-review}.json`.
1337
-
1338
- The first performance work after the pull uses the packed artifact's actual
1339
- k2/k3/k4 matrices. The M=1/2/3/4/5/8 screen identifies the gate/up crossover
1340
- and the down-projection bit-width asymmetry. Shared-M reduce and fused gate/up
1341
- kernels are retained as experimental variant 7 after exact matrix/MLP checks
1342
- and six balanced diagnostic A/B blocks. Variant 8 adds a balanced and aligned
1343
- 3-bit down kernel; it improves the observed M=1/2/4 full-model forwards while
1344
- preserving logits, live state and subsequent-token checks. A device LUT for the existing f32
1345
- code values loses on this M4 and is recorded as a negative result. Kernel
1346
- implementation, commands and evidence live in turboquant.md's packed-kernel section.
1347
-
1348
- The full packed 27B passes logits, live recurrent/KV state and subsequent-token
1349
- identity at M=1..5. Six paired native-forward blocks also retain the gain at
1350
- M=2/4, but they use a short synthetic prefix and project every output position.
1351
- They are not HTTP decode, verified MTP or strict-fill throughput measurements.
1352
- The existing exact-artifact graph/session/cache gate passes on the packed
1353
- model as well. Variant 6 remains the default.
1354
-
1355
- The packed 27B strict-fill regression passes on variants 6 and 7: nonzero
1356
- assert injection, no verification events and exactly matching emitted tokens.
1357
- This is one tool-call fixture, not a held-out determinism or timing result.
1358
- The last-position-only native append sweep covers M=1/2/3/4/5/8/9/16 with
1359
- six paired blocks, preserving candidate/current logits and live state in every
1360
- cell. It retains the small-M gain and confirms the M=4/5 whole-model cost
1361
- discontinuity. Raw evidence: `reports/qwen38-rd/shared-m-append-lengths.json`.
1362
-
1363
- Variant 10 now shares scatter decode across small M as well. It passes the
1364
- same exact full-model gates and improves M=2..4 against variant 8 in six
1365
- paired native blocks. Variant 9 separately moves expanded-projection
1366
- evaluation to the existing layer boundary. Its observed outputs agree, but
1367
- peak memory rises. Extending the packed crossover to M=8 is a distinct Lab
1368
- candidate with observed output differences. The packed-kernel section in
1369
- turboquant.md owns these implementations and evidence.
1370
-
1371
- Integrated variant 11 adds direct tiled gate/up prefill for M=5..32, with
1372
- the same full-model logit/state gates and paired native improvement against
1373
- variant 10. The operation has no model-name dependency; its dispatch profile
1374
- currently covers the measured Qwen MLP geometry. It also improves the strict
1375
- fill fixture's complete generation time in six paired fill/no-fill blocks,
1376
- with identical emitted tokens and no verification forwards. This remains
1377
- fixture evidence, not a universal determinism proof. Evidence:
1378
- `variant11-full-model-review.json` and
1379
- `strict-fill-v11-cap32-served-eos.review.json`. Six paired raw-completion
1380
- HTTP blocks per method improve first-token and complete-request latency,
1381
- with identical output, through strict serial and continuous B=1 execution.
1382
- They cover one six-token prompt and eight/64 output tokens; concurrency and
1383
- broader-workload conclusions remain open. Evidence: `trellis-v11-http.json`
1384
- and `trellis-v11-http-review.json`.
1385
-
1386
- Variant 12 adds tiled split-K down projection at M=5..8. The integrated
1387
- kernel passes exact full-model logits/state/continuation checks and improves
1388
- six native paired blocks without changing the paths outside that range.
1389
- Its implementation and sweep evidence live in turboquant.md. Serving and
1390
- combined-candidate measurements remain separate gates. The combined variant
1391
- 12 versus original variant 6 now passes six raw-completion HTTP pairs for
1392
- each serial/default scheduling method, with matching text and actual token
1393
- counts at eight/64 output tokens. Source hashes stay fixed throughout all
1394
- 24 bounded server processes. These one-prompt, B=1 diagnostics improve both
1395
- TTFT and complete-request latency; they do not establish concurrent load or
1396
- quiet-machine performance. Evidence: `trellis-v12-combined-http.json` and
1397
- `trellis-v12-combined-http-review.json`. The exact-input native control also
1398
- improves first-token and complete-request time in six paired blocks per
1399
- output length, with identical emitted IDs. One candidate worker escaped
1400
- through Bun with a C++ exception; its traced replay and the complete repeated
1401
- pair succeed. The original failed block is retained and excluded from timing
1402
- aggregation. This does not close the runtime reliability issue. Evidence:
1403
- `trellis-v12-combined-native-review.json`, its original/resumed reports and
1404
- `trellis-v12-native-failure-replay.json`.
1405
-
1406
- The packed serving comparison now also covers four simultaneous raw
1407
- completions. Six fresh-process pairs compare variants 6 and 12, with a warm
1408
- four-request wave followed by a measured wave. Every arm observes four active
1409
- batch rows, all responses/counts/finish reasons agree, and the candidate
1410
- improves complete-wave throughput in every pair. Prompt and SSD caches are
1411
- disabled; the source snapshot stays fixed and all twelve servers exit cleanly.
1412
- These diagnostics establish that the shared small-M kernels improve actual
1413
- concurrent serving, alongside the earlier B=1 results. Mixed lengths, larger
1414
- concurrency and quiet M4 Pro acceptance remain separate gates.
1415
- Evidence: `trellis-concurrent-http.json` and
1416
- `trellis-concurrent-http-review.json`.
1417
-
1418
- The operation trace led to smaller M=5..8 matrix tiles and deferred evaluation
1419
- for direct tiles. Dense expansion retains its projection boundary. The
1420
- integrated kernels pass targeted units and an old-source/new-source comparison
1421
- at ten append lengths, including logits, live cache bytes and continuation.
1422
- Six subsequent HTTP process pairs compare the previous and updated variant 12
1423
- at B=1 and eight concurrent requests. Every wave observes the expected active
1424
- row count; all paired warmup and measured responses, token counts and finish
1425
- reasons agree. Eight-request throughput improves consistently; B=1 first-token
1426
- latency improves, with a much smaller complete-request gain. All twelve servers
1427
- exit cleanly and the source hashes remain fixed. The initial explicit-seed
1428
- pilot routed through serial and is excluded from batching evidence. These
1429
- remain M4 Pro diagnostics, with variant 6 unchanged. Evidence:
1430
- `trellis-tile-integrated-forward-review.json`, `trellis-tile-http-review.json`
1431
- and `trellis-tile-seeded-serial-http-review.json` in the campaign directory.
1432
- Six old/new native process pairs also preserve all 64 emitted IDs and finish
1433
- reasons in warmup and measurement. First-token latency improves in every pair;
1434
- the complete native request improves slightly because single-row decode is
1435
- unchanged. All twelve workers complete with fixed source hashes. Evidence:
1436
- `trellis-tile-native.json` and `trellis-tile-native-review.json`.
1437
- The tile and evaluation-boundary experiments are detailed in turboquant.md.
1438
-
1439
- The existing `bench-serve.ts all` suite also completes two AB/BA process pairs
1440
- for packed variants 6 and 12 with the serial arm, fixed workload seed and 192
1441
- decode tokens. Source snapshots match across all four runs. All 38 paired
1442
- recorded requests and the separate raw/chat parity probes agree; every server
1443
- exits cleanly, all SSD entries are durable, and no failed samples are dropped.
1444
- Single-request decode improves consistently at both tested contexts. Cold
1445
- prefill improves modestly; warm first-token latency varies between pairs and
1446
- sampled RSS shows no reduction. The requested context target produces 2,679
1447
- actual prompt tokens. The four-request aggregate leg is serial queue throughput,
1448
- not batching evidence. This M4 Pro diagnostic does not promote a default or
1449
- replace quiet-machine acceptance. Evidence:
1450
- `single-request-suite-packed.json` and `single-request-suite-packed-review.json`,
1451
- with all four raw suite reports in the campaign directory.
1452
-
1453
- Variant 13 adds vectorized packed-weight expansion after a larger fused-tile
1454
- screen failed to beat native matmul. The operation and packing contract are
1455
- documented in turboquant.md. Focused tests cover every codebook state, circular
1456
- windows, scale dtypes, strided inputs and fallback. The integrated 12/13
1457
- comparison preserves logits, live cache bytes and continuation at five append
1458
- lengths across seven blocks, including six measured AB/BA pairs. Actual kernel
1459
- calls confirm the eligible prefills improve while M=1/8 retain their existing
1460
- path. All three typechecks, hygiene and 1,795 model-free tests pass. Evidence:
1461
- `trellis-vector-integrated-full-model-review.json` and
1462
- `trellis-vector-integrated-{unit,typecheck,hygiene,model-free}.txt` in the
1463
- campaign report directory.
1464
-
1465
- Two subsequent AB/BA pairs through the existing serving suite preserve all 38
1466
- paired requests, raw/chat parity and SSD restart durability. All four servers
1467
- exit cleanly with fixed source snapshots and no failures. Cold TTFT at the
1468
- smaller prefill improves modestly, while decode, long-context TTFT and RSS are
1469
- approximately flat. Cached TTFT varies substantially, so it is not an accepted
1470
- kernel gain. An external browser/build/test burst occurs near the first pair's
1471
- transition and is retained in the observations. This result does not establish
1472
- a broad serving improvement or promote variant 13. Quiet M4 Pro acceptance
1473
- remains. Evidence: `vector-expand-suite-packed.json`,
1474
- `vector-expand-suite-packed-review.json` and
1475
- `vector-expand-suite-load-observations.json` in the campaign directory.
1476
-
1477
- Six further serial HTTP AB/BA pairs isolate 6/16/128/512-token prompts with
1478
- 64 generated tokens and prompt/SSD caching disabled. Each shape receives a
1479
- separate warmup; all first-shape timings are retained. Every paired response,
1480
- token count and finish reason matches across all 54 warmup/measured requests,
1481
- sources remain fixed, and all twelve servers shut down cleanly. TTFT and
1482
- complete-request time improve in every 16/128-token pair. The six-token
1483
- control and decode speed are flat; the 512-token and sampled RSS results are
1484
- less consistent. Six default-scheduler pairs repeat the improvement at
1485
- 16/128 tokens, with exact responses, fixed sources and clean shutdowns.
1486
- Per-request telemetry proves scheduler admission. Existing swap usage and
1487
- background CPU activity keep both M4 Pro series diagnostic; the 512-token
1488
- effect remains less consistent. Evidence:
1489
- `trellis-vector-short-http-paired-{serial,default}.json` and the corresponding
1490
- `-review.json` files in the campaign directory. Quiet, second-machine and
1491
- pressure acceptance remain before any default promotion.
1492
-
1493
- The updated affine controls now complete six alternating Bun/MLX-LM process
1494
- pairs for each flagship, compact and RTN4 artifact. They use the same six raw
1495
- prompt IDs, 64 output tokens, tokenizer/model EOS handling, production wiring
1496
- decisions and fresh-cache cleanup. Every pair emits identical IDs. Complete
1497
- native request time is close, with a small median Bun advantage; MLX-LM has
1498
- slightly lower first-token latency. These diagnostic controls establish no
1499
- new kernel win or HTTP conclusion. All 36 workers finish and the source
1500
- snapshot stays fixed. Evidence: `native-affine-paired.json` and
1501
- `native-affine-paired-review.json` in the campaign report directory.
1502
-
1503
- The shared grammar bitmask candidate compares host expansion, direct Metal,
1504
- compiled Metal and XGrammar's compiled MLX bitmap-table approach. The compiled
1505
- Metal operation preserves the additive mask's bytes for bf16/f16/f32,
1506
- strided inputs, missing words, signed zero and nonfinite values. Its owned
1507
- host snapshot survives matcher mutation before lazy evaluation. Repeated
1508
- calls release their arrays after stream synchronization. Complete greedy,
1509
- sampled and logprob-enabled sampling retains identical selected tokens and
1510
- logprob bytes across changing masks at three vocabulary sizes, and improves
1511
- eight paired blocks against the actual host loop. An earlier probe used a
1512
- slower host callback expansion and is excluded from performance evidence.
1513
- Grammar integration is opt-in pending actual serving measurements. Evidence:
1514
- `token-mask-probe.json`, `token-bitmask-unit.txt` and
1515
- `token-bitmask-grammar-metal.txt`, plus `token-mask-sampling.json` and
1516
- `token-mask-sampling-review.json` in the report directory.
1517
-
1518
- The first dense attention prototype adapts vLLM-Metal's register-resident
1519
- online softmax. It reduces temporary memory but loses the timing screen.
1520
- Instantiating pinned MLX Steel attention at head dimension 256 is faster on
1521
- some self-attention shapes, while the long-K/short-Q suffix case remains
1522
- slower. Tiling must follow both lengths and the device's workspace limit.
1523
- This changes numerics relative to the current unfused bf16 path and stays
1524
- Lab pending model and task-quality checks. Evidence:
1525
- `steel-attention-tune-manifest.json` and its per-tile reports. The initial
1526
- probe's small-head error metrics used physical output order; the corrected
1527
- contiguous readback agrees with the pinned oracle and CPU reference in
1528
- `attention-cpu-check.json` and `attention-oracle-check.json`.
1529
- The full packed-model Steel test is flat at 128/512 prompt tokens; one
1530
- 512-token cell exceeds its predeclared last-logit KL screen, despite matching
1531
- the observed argmax. It has no model-level speed or quality acceptance.
1532
- Moving Q into threadgroup storage and transposing K storage did not rescue
1533
- the separate register-based prototype's timing. Evidence:
1534
- `attention-full-model-packed-128-512-review.json` and
1535
- `dense-attention-memory-tune-review.json`. Larger-context and exact-arithmetic
1536
- attention candidates remain separate experiments.
1537
-
1538
- Graph export now records the existing evaluation boundaries for variants
1539
- 6/8 at M=1/4/5. Small-M forward has one final evaluation boundary. M=5 has
1540
- 192 projection evaluations, 64 layer evaluations and a final evaluation.
1541
- The exported graphs identify the exercised operations, including affine
1542
- projections, packed custom kernels, GDN, convolution, norms, RoPE, attention
1543
- and casts. Counts are exported operation occurrences, not GPU dispatches.
1544
- Raw graphs and the manifest are in `reports/qwen38-rd/graph-captures/`.
1545
-
1546
- An attached Metal System Trace captures the warmed Bun target and its GPU
1547
- encoder intervals. The installed release MLX labels only command buffers
1548
- and encoders, so individual-kernel duration attribution remains open. The
1549
- capture covers part of prefill and decode; it is not a complete TTFT trace.
1550
- The first launch-based capture contains no target GPU work and is excluded.
1551
- Evidence: `variant8-attached.trace` and `attached-trace-summary.json` in the
1552
- same report directory. A pinned MLX source checkout supports inspection of
1553
- the actual dispatch and an isolated profiling build without changing the
1554
- oracle or installed runtime.
1555
-
1556
- The isolated profiling build now records the kernel name, dispatch grid,
1557
- threadgroup geometry and pipeline limits for each submitted dispatch. A second
1558
- attached trace adds operation labels to encoder scopes. Those scopes contain
1559
- multiple operations, including zero-work views, so their GPU duration cannot
1560
- be attributed to the label's final operation. The selected Xcode counter
1561
- profile is unsupported on this M4 and exports no shader or counter samples.
1562
- Use the dispatch inventory to select isolated operation experiments while
1563
- individual GPU timing remains open. Evidence: `labelled-v8-analysis.json`,
1564
- `labelled-v8-kernels.txt` and `variant8-labelled.trace` in the report directory.
1565
-
1566
- A direct device capability query exposes timestamp counters only at compute
1567
- stage boundaries on this M4 Pro. Dispatch-level sampling is unsupported.
1568
- The isolated pinned runtime now samples each operation in a separate encoder,
1569
- reserving two slots in a shared counter buffer and resolving them once per
1570
- completed command buffer. A per-operation allocation first exhausted Metal's
1571
- sample-buffer resources; a larger pool exceeded its documented-in-error size
1572
- limit. Both failed attempts are retained, and the final pool fits that limit.
1573
- The installed native library and Python oracle are unchanged.
1574
-
1575
- Calibration compares the release library, the isolated build without
1576
- segmentation, segmentation alone, and counters. At B=1 and append lengths
1577
- 1/4/8/128 from a 32-token prefix, every arm preserves logits, live cache bytes
1578
- and one continuation across one warmup and three measured forwards. The
1579
- instrumented full-forward overhead is small in this screen. All recorded
1580
- timestamps are valid, and sampled CPU/GPU clock pairs agree. These are
1581
- operation-encoder intervals: operations with multiple dispatches stay grouped,
1582
- intervals can overlap and include waits, and their sum is not GPU wall time
1583
- or critical-path attribution. The small-M trace directs further work toward
1584
- packed projections and affine matvecs; the eight-token trace exposes the
1585
- cost of the tiled prefill path. Evidence: `metal-counter-capabilities.json`,
1586
- `mlx-counter-source-manifest.json`, `mlx-counter-build.patch`,
1587
- `metal-counter-pooled-unit.stderr.txt` and
1588
- `metal-counter-calibration-review.json` in the report directory.
1589
-
1590
- A separate schedule recorder now preserves MLX's normal encoder and command
1591
- buffer boundaries. It counts existing dispatches, barriers, fence waits and
1592
- temporary references, and reads command-buffer GPU start/end times in the
1593
- completion handler, following [Metal's timing contract](https://developer.apple.com/documentation/metal/mtlcommandbuffer/gpustarttime).
1594
- It rejects simultaneous operation segmentation. The first smoke test exposes
1595
- a unit mistake in the recorder: the pinned runtime's `buffer_sizes_` adds
1596
- `data_size()`, which counts dtype elements. Correct the recorder to report
1597
- that heuristic as elements and multiply by item size for temporary bytes.
1598
- The effective M4 Pro submission defaults are 50 dispatches and 50 shifted
1599
- element-count units. The setting's upstream name remains
1600
- `MLX_MAX_MB_PER_BUFFER`; it is not a literal byte ceiling. Temporary-reference
1601
- totals are also not peak resident memory.
1602
-
1603
- The corrected recorder passes 45 complete generations across Llama 1B and
1604
- Qwen packed/RTN4, comparing the ordinary library, the isolated library without
1605
- telemetry and the recorder with native/raw/compiled sampler arms. Every
1606
- token, live state byte and usage record agrees. Warmed complete timings show
1607
- no clear systematic instrumentation shift in this screen; repeated overhead
1608
- calibration remains necessary for quantitative timing attribution. The
1609
- 64-token packed sampling trace loses four dispatches per token with fusion,
1610
- but all three sampler arms still submit 3,905 buffers containing dispatches.
1611
- Many additional buffers contain no kernel dispatches; they may still carry
1612
- event waits or signals. Audit callers before attempting to remove them.
1613
- Command-buffer spans include internal waits, so their union is not kernel
1614
- active time or device utilization. Evidence is `mlx-schedule-source-manifest.json`,
1615
- `mlx-schedule-smoke-v2.log` and `top-p-schedule-screen{,-review}.json`.
1616
-
1617
- A separate caller trace attributes 24 zero-dispatch submissions during steady
1618
- packed greedy decode to the pressure branch in MLX's `eval_impl`, reached
1619
- through `async_eval`. That branch finalizes open GPU streams before waiting
1620
- for outstanding work. All three traced generations preserve emitted IDs,
1621
- live cache bytes and usage against the calibrated recorder. Startup-only
1622
- stacks had instead reached final evaluation and synchronization, so they
1623
- could not establish the steady decode cause. The trace adds CPU logging and
1624
- is not timing evidence. These observations do not establish that an empty
1625
- dispatch list has no event work. Keep the validated recorder separate from
1626
- the caller-trace build. Evidence is `empty-submit-r6-steady-trace{,-review}.json`
1627
- and `mlx-empty-submit-steady-source-manifest.json`.
1628
-
1629
- The next stock-library screen varies MLX's command-buffer submission limits,
1630
- bounded breadth-first graph traversal and optional Metal synchronization
1631
- implementation. Measure complete warmed generation, with matching token IDs,
1632
- requested log probabilities and live state, before changing native code or
1633
- retaining a setting. New-shape prefill cells are correctness screens until
1634
- their shapes are warmed in both arms. Positive cells require balanced native
1635
- and actual serial/continuous HTTP repeats, plus memory and disposal checks.
1636
- The frozen screen is `graph-schedule-screen-plan.json`.
1637
-
1638
- That first screen passes all 120 generations and 27 complete arm comparisons
1639
- on Llama 1B and Qwen packed/RTN4. No packed-model decode setting has a
1640
- compelling first-pass gain. The later RTN4 timings overlap with unrelated
1641
- disburse TypeScript/Vite/Playwright jobs, including higher load and swap use.
1642
- Exclude RTN4 timing from tuning decisions and repeat it after those workers
1643
- exit; retain its exactness results. Llama's smaller-buffer observation needs
1644
- balanced repeats. Evidence is `graph-schedule-screen{,-review}.json` and
1645
- `graph-schedule-screen-contamination.json`. Retained tuning belongs at the
1646
- existing model-owned execution seams; these experiments do not establish
1647
- new global defaults.
1648
-
1649
- The RTN4 rescreen completes 40 generations with nine exact arm comparisons,
1650
- including a return to the default settings at the end. The apparent 0.94%
1651
- greedy gain with traversal width 64 matches the ending default's 0.92% drift;
1652
- sampled generation is flat in both. Larger submission limits also fail to
1653
- improve both decode fixtures. No Qwen setting advances from this screen.
1654
- New-shape prefill timings remain excluded. Evidence is
1655
- `graph-schedule-rtn4-rescreen-v2{,-review}.json`.
1656
-
1657
- Llama's six balanced native pairs preserve all 30 paired generations, including
1658
- requested log probabilities and live state. Reducing both submission limits
1659
- to 25 lowers complete warmed generation time by 2.44% for greedy and 2.30%
1660
- for sampled output; all six pairs improve in each cell. TTFT is effectively
1661
- flat. Peak MLX allocation falls in the measured cells, which is not a claim
1662
- about physical RAM savings. Six actual HTTP pairs per lane then preserve all
1663
- 84 paired responses across 168 requests. Complete time improves by
1664
- 1.86–3.02% in serial and 2.22–3.00% in continuous serving across the three
1665
- fixtures, with every pair faster. These M4 Pro results remain diagnostic.
1666
- The controls are `graph-schedule-llama-repeat{,-review}.json` and
1667
- `graph-schedule-llama-http-repeat{,-review}.json`. MLX caches these settings
1668
- at device initialization; assigning environment variables from a later
1669
- model forward would not apply the measured policy. Broader contexts,
1670
- lifecycle coverage and scoped integration remain.
1671
-
1672
- A separate native prototype elides `finalize` only when the command buffer
1673
- has not been touched since the preceding commit. Access to the buffer,
1674
- encoder creation, output registration and temporary registration all make it
1675
- ineligible. This preserves event-only and completion-handler work, and leaves
1676
- explicit synchronization unchanged. The isolated build and its disabled arm
1677
- each pass 84 stream/lifetime cases against the installed library, spanning
1678
- three dtypes, two sizes, two memory limits, CPU/GPU and GPU/GPU dependencies,
1679
- view-only events and disposal before asynchronous completion. All cases
1680
- return active memory to zero. The subsequent 45 complete generations also
1681
- preserve IDs, requested log probabilities, live state and usage across the
1682
- three artifacts and both library controls. Packed generation is effectively
1683
- flat. Six subsequent RTN4 AB/BA pairs preserve all 30 paired generations but
1684
- find no reliable gain: complete greedy time changes by -0.069%, sampled by
1685
- +0.108% and warmed prefill by +0.011%. Peak MLX allocation is flat. Close the
1686
- prototype without production integration. Evidence
1687
- is `mlx-untouched-finalize-source-manifest.json` and
1688
- `untouched-finalize-stream-default{,-review}.json`, plus
1689
- `untouched-finalize-native{,-review}.json` and
1690
- `untouched-finalize-rtn4-repeat{,-review}.json`.
1691
-
1692
- The separate exact traces confirm that the prototype removes the intended
1693
- submissions. For 64 packed sampled tokens, zero-dispatch buffers fall from
1694
- 3,311 to 194, while all 116,164 dispatches and 3,905 buffers containing
1695
- dispatches remain. RTN4's corresponding zero-dispatch count falls from 4,083
1696
- to two; its 115,947 dispatches remain. The sampled skip counters record
1697
- 3,113/4,072 omitted calls. Counts need not subtract exactly between runs
1698
- because pressure callbacks and completion timing vary. This is mechanism
1699
- evidence, not an end-to-end speed claim. Evidence is
1700
- `untouched-finalize-trace{,-review}.json`.
1701
-
1702
- The optional upstream `MLX_METAL_FAST_SYNCH=1` mode stalls in the installed
1703
- library's large bf16 three-stream case under the probe's small submission
1704
- limits. A stack sample finds the host in `scheduler::wait_for_one` and a
1705
- worker in `Fence::wait`. Stop only that probe after more than 100 seconds
1706
- without progress, retain its partial results, and rerun all default-mode
1707
- cases successfully. Do not attribute this stock-library failure to the new
1708
- prototype or treat the unrun experimental-mode arms as passes. Evidence is
1709
- `untouched-finalize-stream.json`, `untouched-finalize-stream-fast1-interruption.json`
1710
- and `untouched-finalize-stream-fast1-default.sample.txt`.
1711
- The initial interruption annotation mislabeled that case as f32; the partial
1712
- report's dtype 12 identifies bf16. The corrected attribution is recorded in
1713
- `untouched-finalize-stream-fast1-failure-review.json`.
1714
-
1715
- The existing GDN stage profiler has also been run at M=1/4/128/512 against
1716
- unprofiled forwards from the same prefix. Observed logits agree. Its added
1717
- stage/layer evaluations substantially inflate small-M time, so those stage
1718
- durations cannot substitute for GPU kernel attribution. Evidence:
1719
- `reports/qwen38-rd/gdn-stage-probe.json`. A fused convolution/SiLU/copied-tail
1720
- prototype matches the tested bf16/f32 outputs and live tail at B=1/2. It
1721
- requires MLX's typed sigmoid expression; a float32 rewrite changes bf16
1722
- results. The opt-in operation now passes full packed-model logits, live
1723
- state, continuation and speculative rollback checks. Its initial memory
1724
- benefit exposed an aliasing baseline: `mlx_copy` retains the source buffer.
1725
- The default path now uses a shared compact materialization operation backed
1726
- by stock MLX DynamicSlice, with gradient and compiled-execution gates.
1727
- Replacing the alias preserves all tested packed-model logits, live state,
1728
- continuation and rollback bytes. Explicit disposal still owns handle cleanup;
1729
- the copy change allows the large backing allocation to be released.
1730
- Against an independently materialized baseline, convolution fusion has
1731
- approximately flat full-model timing and similar peak memory. It remains an
1732
- unpromoted R8 experiment. Evidence: `qwen-conv-materialized-packed.json`,
1733
- `materialize-final-packed-comparison.json`, and `conv-probe-typed-sigmoid.json`.
1734
- The final stock-copy rerun is a correctness gate; concurrent CPU trace exports
1735
- exclude its diagnostic timings from performance comparisons.
1736
-
1737
- GDN specialization now covers threadgroup layouts, fixed sequence lengths,
1738
- loop unrolling, compiled wrappers and typed sigmoid fusion. Correcting the
1739
- initial float32 sigmoid rewrite restores exact bf16 recurrence and state.
1740
- The subsequent shape sweep passes all 114 cells. A compiled fixed-length
1741
- candidate preserves full-model logits, live state and continuation, but its
1742
- isolated gains mostly disappear in full forwards. A separate fused recurrence,
1743
- output RMS normalization and gate kernel passes 60 isolated shape/dtype cells
1744
- and the small-M full-model checks. Its full-forward improvement is too small
1745
- to justify integration at this point. Neither candidate changes production
1746
- dispatch. Evidence: `gdn-specialization-typed.json`,
1747
- `gdn-static-full-model-review.json`, `gdn-fused-norm-probe.json` and
1748
- `gdn-fused-norm-full-model-review.json`.
1749
-
1750
- The affine matvec layout screen preserves pinned MLX's reduction arithmetic
1751
- while varying output rows per SIMD group and groups per threadgroup. Actual
1752
- packed-artifact head and GDN projection weights pass exact checks with both
1753
- direct and compiled wrappers. The best isolated head cells improve only
1754
- slightly, and the small-M projection results are mixed. There is no accepted
1755
- whole-model gain. Combined projection dispatch remains a separate candidate.
1756
- Evidence: `affine-qmv-screen.json` and `affine-qmv-compiled.json`.
1757
-
1758
- A second affine prototype shares packed weights and quantization metadata
1759
- across four or eight input rows, preserving MLX's dot-product and SIMD
1760
- reduction order. The corrected real-matrix screen passes all 50 cases; larger
1761
- GDN projections improve in isolation, while vocabulary-head gains are smaller.
1762
- An initial bf16 failure was large, not rounding noise: some shared-row layouts
1763
- read incorrect scale/bias values. Explicit bf16 bit expansion avoids the
1764
- observed failure without resident float32 metadata copies. Direct and compiled
1765
- bf16/f32 debug cells then agree exactly. The underlying compiler cause is not
1766
- established. Six full-model pairs preserve logits, live cache bytes and
1767
- continuation on both packed and plain RTN4 artifacts. RTN4 improves consistently
1768
- at M=4/8 with unchanged peak allocation and flat unused-shape controls. Packed
1769
- improves little; its unused M=128 control also shifts, so the smaller packed
1770
- timing difference needs an independent check. Six RTN4 HTTP process pairs
1771
- then preserve all 108 paired warmup/measured responses, token counts and
1772
- finish reasons. Every measured eight-request wave reaches eight active rows
1773
- and improves throughput; the single-request control is approximately flat.
1774
- All twelve servers exit cleanly with fixed source hashes. Evidence:
1775
- `affine-shared-m-http-rtn4-review.json`, `affine-shared-m-probe.json`,
1776
- `affine-shared-m-probe-initial.json` and
1777
- `affine-shared-m-debug-scale-bits.json`, plus
1778
- `affine-shared-m-full-model-{packed,rtn4}-review.json`.
1779
-
1780
- The retained shared operation is `src/mlx/affine-shared-m.ts`, opt-in via
1781
- `MLX_BUN_AFFINE_SHARED_M=1`. Eligibility follows dtype, quantization, shape
1782
- and stream rather than a model name. It retains native MLX for unsupported
1783
- cells and during shapeless compile traces: the native CustomKernel primitive
1784
- cannot infer output shapes there. The trace context is restored on return or
1785
- exception. Shape-specific compiled calls remain eligible. Focused tests cover
1786
- strided activations and metadata, leading dimensions, shape changes and
1787
- fallbacks. A cleaned-up kernel passes another six RTN4 full-model pairs and
1788
- retains the gain. Six final production-flag HTTP pairs preserve all 156 paired
1789
- warmup/measured responses with fixed source hashes and clean server exits.
1790
- Both four- and eight-request throughput improve in every pair; the
1791
- single-request control is flat. Dispatch counters confirm M4 and M8 use the
1792
- shared operation. Broader artifacts and quiet M4 Pro gates remain. Evidence:
1793
- `affine-shared-m-production-full-model-rtn4-review.json`,
1794
- `affine-shared-m-shapeless.json`, `affine-shared-m-integrated-unit.txt` and
1795
- `affine-shared-m-integrated-http-rtn4-review.json`.
1796
-
1797
- The next row-width screen passes all 112 real RTN4 matrix cases at
1798
- M=2/3/5/6/7. Six full-model pairs per width also preserve logits, live state
1799
- and continuation. M2 loses and retains native dispatch. M3 improves slightly;
1800
- M5/6/7 improve consistently without a material peak-memory increase. The large
1801
- head needs separate geometry: its M6/7 shared-row cells lose even when smaller
1802
- projections win. Wider integration therefore keeps those head cells native.
1803
- Evidence: `affine-shared-m-width-rtn4-review.json` and
1804
- `affine-shared-m-width-full-model-rtn4-review.json`.
1805
-
1806
- A broader-format prototype initially fails nine of 216 arithmetic cells,
1807
- all bf16 M8 layouts with 3- or 5-bit weights. The errors are large and survive
1808
- float32 output storage. Float32 activations remove the large error but also
1809
- change the reference's typed arithmetic. Explicit bf16 input expansion plus
1810
- rounding after each typed addition preserves that arithmetic and passes all
1811
- 216 dtype/bit/group-size cells. Evidence:
1812
- `affine-shared-m-all-bits-correctness-review.json`,
1813
- `affine-shared-m-all-bits-debug.json` and
1814
- `affine-shared-m-all-bits-explicit-input-correctness-review.json`.
1815
-
1816
- The compact artifact supplies actual 3-bit head/MLP and 8-bit attention/GDN
1817
- matrices. All 80 real-matrix cells agree exactly, including compiled calls.
1818
- Reusing each packed load for two input rows at 3-bit and four at 8-bit wins
1819
- the retained M4/8 cells. Both compute four output rows per SIMD group, with
1820
- two SIMD groups per threadgroup. Six full-model pairs
1821
- with the prototype and another six with the cleaned production operation
1822
- preserve logits, live cache bytes and continuation; both row counts improve,
1823
- unused-shape controls stay approximately flat and peak allocation is unchanged.
1824
- The 3/8-bit implementation now lives in `src/mlx/affine-shared-quant.ts`, under
1825
- the same opt-in flag and native fallback rules. Other bit widths and group
1826
- sizes remain research-only. Evidence:
1827
- `affine-shared-m-all-bits-explicit-compact-review.json`,
1828
- `affine-shared-m-all-bits-full-model-compact-review.json` and
1829
- `affine-shared-m-broader-full-model-compact-review.json`.
1830
-
1831
- The final 4-bit operation includes M3/5/6/7, retaining native M2 and the large
1832
- head at M5/6/7. Six complete-model pairs per width preserve logits, state and
1833
- continuation. Six production-flag HTTP pairs at B1/3/5/6/7 preserve all 264
1834
- paired warmup/measured responses. Each measured wave reaches the requested
1835
- active width; candidate dispatch is observed and all twelve servers exit
1836
- cleanly. Concurrent throughput improves in every pair. Single-request decode
1837
- is approximately flat. All pairs are retained, including noisier final runs:
1838
- the machine has residual swap, XProtect is active at the initial preflight,
1839
- and unrelated build/browser activity is observed after the run. This remains
1840
- a diagnostic result. Wider model coverage remains open.
1841
- Evidence: `affine-shared-m-broader-full-model-rtn4-review.json` and
1842
- `shared-affine-frontier-http-rtn4-review.json`. Current focused tests, all
1843
- three typechecks, hygiene and the complete model-free tier pass; the latter
1844
- has 1,785 passes, ten skips and no failures. Evidence:
1845
- `affine-shared-m-broader-{unit,typecheck,hygiene,model-free}.txt`.
1846
-
1847
- Six final compact production-flag HTTP pairs preserve all 156 paired warmup
1848
- and measured responses, usage counts and stop reasons. Both B4 and B8 improve
1849
- in every measured pair; the median B1 control is flat, with individual noisy
1850
- outliers retained. Actual active widths and both 3/8-bit dispatches are
1851
- observed, all twelve servers exit cleanly and source hashes remain fixed.
1852
- Residual swap keeps this diagnostic. Evidence:
1853
- `shared-affine-frontier-http-compact-review.json`.
1854
-
1855
- A subsequent host-overhead prototype caches shape-specific compiled calls
1856
- around these shared-affine kernels. Every weight/scale/bias/activation remains
1857
- a dynamic input, so one compiled function can serve distinct model layers.
1858
- Six compact full-model pairs retain exact logits, state and continuation;
1859
- 24 compiled configurations serve all eligible projections without new traces
1860
- in measured rows. The eligible M4/8 cells improve modestly. Six subsequent
1861
- HTTP process pairs preserve all 156 paired warm/measured responses with clean
1862
- server exits and fixed source hashes. Serving gains shrink to approximately
1863
- flat at B1/4 and a small B8 difference. This does not justify integrating the
1864
- extra compiled-function cache at present. Evidence:
1865
- `affine-compiled-call-cache-full-model-compact-review.json` and
1866
- `affine-compiled-call-cache-http-compact-review.json`.
1867
-
1868
- The grammar-mask operation now completes six compact HTTP process pairs at
1869
- B1/4 with shared-affine enabled in both arms and grammar jumping disabled.
1870
- All 60 paired warm/measured responses match and satisfy the frozen JSON
1871
- schema; both arms apply the mask the same number of times. Every concurrent
1872
- wave reaches four active rows, source hashes remain fixed and all servers
1873
- exit cleanly. The timing is inconclusive for promotion: residual swap and
1874
- overlapping unrelated build/browser work are recorded, the B1 median is
1875
- approximately flat and the B4 median regresses. Preserve all samples and
1876
- revisit on a controlled session. Host masking remains default. Evidence:
1877
- `grammar-mask-http-compact-review.json`.
1878
-
1879
- A fused affine gate/up/SwiGLU prototype shares activation loads and replaces
1880
- the two projections plus activation dispatch. Its first version preserves
1881
- both projection outputs but fails the activation check: a float32 sigmoid
1882
- expression differs from MLX's dtype-specific expression. The corrected
1883
- kernel passes all 48 real RTN4 small-M cells, including complete MLP output.
1884
- Only M=1 benefits in that isolated screen. Restricting the full-model prototype
1885
- to M=1 preserves logits, live state and continuation across six paired blocks,
1886
- but its full-forward gain is too small to justify integration. Longer-M
1887
- forwards retain the original path. Evidence: `affine-gateup-debug.json`,
1888
- `affine-gateup-debug-typed.json`, `affine-gateup-typed.json` and
1889
- `affine-gateup-full-model-review.json`. The existing packed activation's
1890
- separate arithmetic contract needs its own audit before reusing that code
1891
- in an affine operation.
1892
-
1893
- A residual-add/RMSNorm kernel preserves the native reduction topology and
1894
- the rounded residual before normalization. All 90 synthetic bf16/f16/f32
1895
- cases preserve both outputs. Six packed-model pairs at M1/4/8/128 then
1896
- preserve logits, live cache bytes and continuation, with 64 fused calls per
1897
- forward. M1 is slightly slower, M4/8 are approximately flat and M128 varies.
1898
- The complete path does not establish a compelling benefit, so this version
1899
- is not integrated. Operation samples include wrapper/evaluation costs and are
1900
- not GPU-only timestamps. Evidence: `residual-rms-screen-scalar-review.json`
1901
- and `residual-rms-full-model-packed-review.json`. Earlier driver/binding
1902
- failures occurred before timing and remain separate. Closed helpers are
1903
- removed after recording the finding.
1904
-
1905
- The first real HTTP screen uses the compact artifact through bounded CLI
1906
- servers. It retains request hashes, actual usage, arrival times, cache hits,
1907
- restart durability, concurrent request completion and failures. Its cold
1908
- context leg required a Bun restart; the retried nonce changed the prompt, so
1909
- that context comparison is unmatched. The chat probe also diverged despite
1910
- equal prompt counts. Frozen chat IDs produce identical direct Bun/Python
1911
- tokens. A cold HTTP control reproduces the Python difference only in its
1912
- seedless BatchGenerator path; `seed=0` selects its serial method and matches
1913
- the direct text. Compare those execution methods separately. The Bun HTTP
1914
- sample also omits a final space, so it has no byte-identical wire-output claim.
1915
- The benchmark records failed-attempt
1916
- stderr and process status, including failures recovered by retry. This screen
1917
- is diagnostic and establishes no serving win. Evidence and exclusions:
1918
- `serving-compact-screen-0.review.json` and
1919
- `serving-primes-native-comparison.json` in the report directory.
1920
-
1921
- Repeated native-throw traces identify the continuous serving crash as Metal
1922
- command-buffer out-of-memory. Bun 1.4.2 avoids it in one screen but misses
1923
- one pending SSD snapshot at its first restart boundary; neither issue is
1924
- closed. Continuous preparation and decode now share the serial memory
1925
- guard, entered after cache acquisition under the execution lease. Ownership,
1926
- refusal and guard restoration tests pass. The same context failure still
1927
- reproduces: the affine graph's transient allocations occur at evaluation,
1928
- after the per-layer construction checks. Investigate allocator residency
1929
- and snapshot retention before declaring this fixed. Evidence:
1930
- `serving-compact-bun140-throw.review.json`,
1931
- `serving-compact-bun142-throw.review.json` and
1932
- `serving-compact-shared-guard.review.json`. Source snapshots now include
1933
- untracked kernels as well as tracked changes.
1934
-
1935
- The frozen compact request isolates a cache-consumption cause: after one
1936
- warm repeat transfers the exact recurrent boundary out of RAM, a third
1937
- identical prompt loses that prefix and prefills again. Stopping after two
1938
- requests also reproduces a missing SSD snapshot followed by a false-success
1939
- flush; restart cannot reuse the longer untrimmable descendant. Persisting the
1940
- boundary before transfer preserves the third request's prefix. Durability
1941
- records now remain dirty until actually covered, and already-durable records
1942
- avoid another clone. Ownership/failure and coordinator regression gates pass.
1943
- The three-request HTTP replay preserves output and cached tokens through
1944
- repeat and restart, with no missing flush. The two-request replay also writes
1945
- the consumed boundary before restart. This requires a synchronous SSD write
1946
- on the first transfer when that boundary is not already durable. The complete
1947
- compact serving diagnostic now finishes context repeats, SSD flush/restart
1948
- and four concurrent streams without a recorded failure. One diagnostic pass
1949
- does not close long-agent or repeated reliability acceptance. Evidence:
1950
- `ssd-boundary-before.json`, `ssd-boundary-two-before.json`,
1951
- `ssd-boundary-after.json`, `ssd-boundary-two-after.json`,
1952
- `ssd-boundary-tests.txt` and `serving-compact-boundary-fixed.review.json`
1953
- in the campaign report directory.
1954
-
1955
- The merged packed path now passes the seven saved Pi tool-result boundaries
1956
- in separate serial and continuous server processes. Both arms use variant 12
1957
- and the same frozen requests. Each completes the longest prompt, emits the
1958
- requested 512 tokens, demotes old cache entries under pressure, and finishes
1959
- with a durable SSD flush and no pending, missing or failed snapshots. Responses
1960
- match across the two methods and the source snapshot stays fixed. The system
1961
- prompt was reconstructed once with the installed Pi package and frozen;
1962
- historical system-prompt byte identity is not established. This is a bounded
1963
- memory/integration check, not a long-running agent success claim. No returned
1964
- tools execute. Evidence: `agent-boundary-fixture.json`,
1965
- `agent-boundary-current.json` and `agent-boundary-current-review.json`.
1966
-
1967
- The M4 DeltaNet fixture discrepancy is now traced to the cached reference,
1968
- not a Bun/oracle disagreement. Both implementations match gate values, output
1969
- bytes and complete recurrent state on the frozen inputs. The explicit
1970
- replay changes one older expected output and adds oracle provenance/state
1971
- hashes. The platform evidence and regeneration procedure live in
1972
- [environment.md](../reference/environment.md).
1973
-
1974
- R22 now tests immutable file-backed weights through page-aligned Metal roots
1975
- and ordinary MLX tensor views. The existing external-buffer entry point is
1976
- sufficient for element-aligned tensors; each root includes the leading page
1977
- padding and the tensor view carries the offset. This resembles
1978
- [llama.cpp's mapped Metal buffer views](https://github.com/ggml-org/llama.cpp/blob/427291b5b34cd914a31b3fd3b61a68f6184f4b9f/ggml/src/ggml-metal/ggml-metal-device.m#L1999),
1979
- which align the root pointer and split oversized mappings into overlapping
1980
- views. The prototype uses no new artifact and no new production loader.
1981
- Small metadata and unsupported element alignment retain native loading.
1982
- All 32 operation cases match payload bytes and GPU add/matmul results;
1983
- pointer equality proves that the candidate aliases the file, and file hashes
1984
- stay unchanged. The Llama 1B artifact is ineligible because its large payloads
1985
- start at odd byte offsets, so that initial native/native control establishes
1986
- no candidate performance result.
1987
-
1988
- The first packed 27B native pair maps 758 tensors, 11,895,111,680 payload
1989
- bytes, through 11,907,530,752 bytes of page windows. Prefix state, ten
1990
- full-forward logit/live-state/continuation cases and both generation token
1991
- sequences match. The subsequent six-pair repeat preserves all 60 full-forward
1992
- logit/state/continuation cases, every prefix state and all 12 generation
1993
- comparisons. Sources stay fixed and all 12 child processes exit cleanly.
1994
- The measured 64-token generation is 0.25% slower by median paired wall-time
1995
- ratio, with no faster pair; TTFT is approximately flat. M1 is about 0.6%
1996
- faster, while M4/8/128/512 give no consistent useful improvement. Evidence:
1997
- `mmap-weights-native-packed-paired{,-review}.json`. Readiness varies strongly
1998
- with order and file-cache state, so it has no cold-start improvement claim. Process RSS and macOS
1999
- physical-footprint accounting fall sharply because most private copied weights
2000
- become file-backed mappings. That does not shrink model bytes or establish a
2001
- corresponding reduction in total physical RAM: clean file pages and GPU
2002
- residency require separate accounting. Preserve MLX active/peak bytes, RSS,
2003
- `vmmap` output and system pressure together. Evidence:
2004
- `reports/qwen38-rd/mmap-page-window{,-pointer}-screen.json` and
2005
- `mmap-weights-native-{llama1,packed}-screen.json`.
2006
-
2007
- The serial HTTP follow-up completes six fresh-server pairs with all 42
2008
- warm/measured response texts, usage counts and finish reasons exact. Sources
2009
- remain fixed and all servers exit cleanly. Warm complete-response time is
2010
- 0.04% to 0.14% slower by median paired ratio; decode is 0.14% to 0.21% slower.
2011
- Median per-server peak RSS changes from 12,182,749,184 to 482,508,800 bytes.
2012
- The recorded physical-footprint summaries show the same private/file-backed
2013
- accounting change, not a smaller tensor working set. Evidence:
2014
- `mmap-weights-http-serial{,-review}.json`. Default scheduling, system-memory
2015
- pressure and cold file-cache behavior remain separate gates.
2016
-
2017
- The initial prototype retains immutable roots and mapping owners for the
2018
- process, matching the existing external-array lifetime requirement. A retained
2019
- loader must also prove unload, outstanding GPU-reference ownership, repeated
2020
- model replacement, pressure behavior and HTTP performance. No default or
2021
- production lifetime change follows from this screen. A subsequent ownership
2022
- prototype stores array/root handles with each `Weights` instance and releases
2023
- them on disposal. Existing shard mappings remain mapped for the process. Three
2024
- full-artifact cycles each load 2,019 tensors and release all 13,056,265,696
2025
- active bytes. An outstanding GPU consumer survives weight disposal, produces
2026
- the exact expected output and releases the remaining 2,048 bytes on disposal;
2027
- active memory is zero before GC. Evidence:
2028
- `mmap-weights-ownership-packed{,-mapping}.json`. Three additional cycles
2029
- retain a single-input lazy negation, dispose the weights before submitting it,
2030
- and then evaluate it. Outputs remain exact; the pending view retains
2031
- 39,747,584 bytes until its disposal, after which active memory returns to zero
2032
- before GC. Evidence: `mmap-weights-single-consumer-lazy{,-mapping}.json`.
2033
- The whole-tensor follow-up fails output identity on the first cycle after
2034
- owner disposal, although active memory returns to zero and the source tensor
2035
- still matches the untouched original artifact. The earlier small view did
2036
- not qualify for unary buffer donation: MLX also bounds excess backing-buffer
2037
- bytes. Thus those passing cases did not establish donation safety. Keep this
2038
- read-only loader out of production; reduce the failure on scratch data and
2039
- test writable private mappings with native lifetime ownership. Evidence:
2040
- `mmap-weights-whole-consumer-lazy.json`, its log and
2041
- `mmap-whole-consumer-source-integrity.json`. Full serving, default-scheduler
2042
- and pressure gates remain for any corrected loader.
2043
-
2044
- Scratch files isolate the failure across float32/bfloat16 and aligned/offset
2045
- views. With a retained root, all read-only cases are exact and output uses a
2046
- separate buffer. After root release, all four donated read-only cases return
2047
- the original input bytes instead of the negation. Private writable mappings
2048
- preserve every output, including donation, and leave each file unchanged.
2049
- Evidence: `mmap-donation-{ro,cow}-screen.json`. The corrected prototype gives
2050
- each private page window a native payload destructor that unmaps it on the
2051
- last MLX buffer release. It uses no JavaScript destructor or new production
2052
- API. All eight scratch ownership cases preserve output and file bytes, retain
2053
- the mapping through the live consumer, and release every mapping afterward.
2054
- Three full-artifact cycles then preserve the whole-tensor lazy negation after
2055
- weight disposal. Only its 1,654,784-byte mapping survives until the pending
2056
- consumer is disposed; native mapping counts and MLX active bytes return to
2057
- zero before GC. Evidence: `mmap-managed-donation-screen.json` and
2058
- `mmap-weights-managed-whole-consumer-lazy{,-mapping}.json`. A further 64-cycle
2059
- scratch gate submits chained operations asynchronously and disposes the
2060
- input handles. Half the cycles check every output value; the others dispose
2061
- the final output before synchronization. All release every native mapping and
2062
- return MLX active memory to zero. Evidence: `mmap-managed-submitted.json`.
2063
- Six subsequent private-mapping native blocks on the M4 Pro 24 GB preserve 60 full-forward
2064
- logit/state/continuation cases and 12 8/64-token generation comparisons, with
2065
- fixed sources, clean exits and zero remaining native mapping windows. The
2066
- 64-token warm generation median paired wall-time change is +0.02%; TTFT is
2067
- +0.13%. Warm full forwards at M1/4/8/128/512 have no useful consistent speed
2068
- gain. The opening-plus-first-hidden-forward phase is about 7.38 seconds slower
2069
- by median paired difference, but that observation materializes different
2070
- amounts of the model. After the hidden-only forward, native head tensors are
2071
- still lazy while mapped roots already account for their full extent. The
2072
- 727,580,672-byte active-allocation difference is exactly the 715,161,600-byte
2073
- head plus 12,419,072 bytes of page padding, in all six pairs. Large changes in
2074
- RSS and `vmmap` physical-footprint accounting still do not establish how much
2075
- system RAM is saved. Child wall time includes `vmmap` inspection and is not a
2076
- performance metric. Evidence is
2077
- `mmap-weights-managed-native-repeat{,-review}.json` and
2078
- `mmap-initial-residency-attribution.json`.
2079
-
2080
- A separate lazy-view control removes per-tensor evaluation and pointer checks
2081
- from loading. All 64 unsubmitted consumers and 64 submitted consumers remain
2082
- valid after releasing their weight owners, then release every mapping and
2083
- return active allocation to zero without forced GC. Its model screen preserves
2084
- ten full-forward cases and both generations, but warm 64-token generation is
2085
- +0.22% slower and the first hidden-forward phase does not improve. This rules
2086
- out retaining the lazy change on that screen; it does not isolate the cause
2087
- of the first-use cost. Evidence is
2088
- `mmap-lazy-view-ownership.json` and
2089
- `mmap-weights-lazy-managed-native-screen{,-review}.json`. Neither prototype is
2090
- integrated.
2091
-
2092
- A subsequent four-arm screen measures opening the model through the first
2093
- generated token, completing all 64 tokens, then a warm 64-token generation.
2094
- Native loading, lazy private mappings, mapped pages with an OS read-ahead
2095
- hint, and mapped pages read once per page preserve all token IDs, live state
2096
- and usage, then release every mapping. On the M4 Pro 24 GB, native first-token
2097
- time from opening is 14.09 seconds; lazy mapping is 13.62 seconds, read-ahead
2098
- 19.97 seconds and explicit reads 30.50 seconds. These timings include the
2099
- preparation itself. Warm generation is approximately flat. The two CPU
2100
- preparation methods lose this screen. Lazy mapping's small first-generation
2101
- gain needs balanced repeats: this is one fixed-order block with unpurged
2102
- filesystem cache. Neither a cold-storage result nor a physical-memory saving
2103
- is established. Evidence is `mmap-prefault-native-screen.json`.
2104
-
2105
- The balanced follow-up rejects that apparent cold-generation gain. All six
2106
- fresh-process pairs preserve both 64-token generations, live state and usage,
2107
- with fixed sources, clean exits and all 758 mappings released. First-token
2108
- time from opening is worse in five pairs: the median paired change is +18.42%
2109
- or +2.24 seconds. Completing the first generation is +12.93% or +2.29 seconds;
2110
- warm generation is approximately flat at +0.24%. One large native outlier
2111
- remains in the report. The filesystem cache is unpurged and the machine is
2112
- not quiet, so these are diagnostic results. RSS accounting falls sharply for
2113
- file-backed pages but physical-memory savings are still unproven. Close this
2114
- loader as a performance candidate on the measured workload; no integration
2115
- or HTTP speed claim follows. Closed loader, page-preparation and ownership
2116
- helpers are removed; raw plans and evidence remain in
2117
- `mmap-cold-native-repeat{,-review}.json`.
2118
-
2119
- The first full-model pair with native private mappings preserves prefix state,
2120
- all ten checked logit/live-state/continuation cases and both 8/64-token
2121
- generation sequences. Sources remain fixed; both children exit cleanly and
2122
- the mapped child releases all 758 native windows before exit. Its 64-token
2123
- wall time is approximately flat. This single pair is a correctness screen,
2124
- not a performance acceptance. Evidence:
2125
- `mmap-weights-managed-native-screen{,-review}.json`. Repeated native/HTTP,
2126
- and pressure gates still apply. A subsequent API ownership gate preserves
2127
- pending-consumer output and rematerialized source bytes after `release`,
2128
- `releaseShard` and `dispose`. It rejects a late view change and releases the
2129
- mapping after an intentional tensor-fixup failure. All native mapping counts
2130
- and MLX active bytes return to zero. Evidence:
2131
- `mmap-managed-shard-release{,-mapping}.json`.
2132
-
2133
- Next: finish MTP and strict-fill request measurements after the kernel
2134
- changes, broaden their correctness and state audits, and obtain individual
2135
- kernel attribution. Continue shared GDN/convolution/affine/prefill work and
2136
- the exact-artifact controls across quants. Quiet application A/Bs, pressure
2137
- replay and quiet M4 Pro gates remain. Recheck process ownership and preflight
2138
- before each GPU run; diagnostic measurements cannot promote a default.
2139
-
2140
- The native-owned managed mapping is visible to MLX allocation accounting.
2141
- Across all ten full-model rows in its paired screen, mapped peak allocation
2142
- exceeds the incumbent by exactly 12,419,072 bytes, the difference between
2143
- page-aligned root and payload bytes. The low process RSS is not evidence of
2144
- an unaccounted model in the async-scheduling threshold. Combining these
2145
- experiments still needs a separate pressure gate. Evidence:
2146
- `mmap-managed-active-accounting-review.json`.
2147
-
2148
- A dedicated KV append dispatch probe covers 18 bf16 cases with four KV heads
2149
- and dimension 256, at depths 65/256/2049/2048/8193/8192. Every active prefix,
2150
- new row and retained snapshot remains exact; explicit cleanup returns MLX
2151
- active allocation to zero. With spare capacity and no retained view, each
2152
- SliceUpdate dispatches only the new-row copy. Holding an evaluated temporal
2153
- view adds a full-buffer copy; releasing it restores donation. At a 256-step
2154
- growth boundary, the pair allocates padding, concatenates old/new storage
2155
- and appends, totaling eight dispatches regardless of retained views. This
2156
- rejects the assumption that ordinary cache append always copies the full
2157
- buffer. The next gate is a real-generation census of retained views and
2158
- growth; instrumented one-shot timings do not establish a speed win. Evidence:
2159
- `kv-append-donation-probe{,-review}.json` and its native dispatch log.
2160
-
2161
- A real native-generation census on the interleaved v13 artifact uses a
2162
- 2,049-token synthetic prompt and 32 generated tokens. Without a prompt
2163
- snapshot, all 1,024 observed one-row K/V appends dispatch only the new-row
2164
- copy. Retaining a real `cloneKvCaches` snapshot produces 32 full-buffer copies,
2165
- one per K/V buffer, then 992 new-row-only appends. Both runs emit identical
2166
- IDs with fixed sources. This rejects a repeated whole-cache copy in the
2167
- tested native path; serving, deeper contexts and other cache types remain
2168
- separate coverage. The counter build is for attribution, not timing claims.
2169
- Explicit cleanup leaves 16,390 active bytes, so this is not a zero-allocation
2170
- claim. Evidence: `kv-append-model-trace-2049{,-review}.json` and its dispatch
2171
- log under campaign reports.
2172
-
2173
- The actual HTTP census confirms the same append behavior at a verified
2174
- 2,049-token text prompt. Serial and continuous servers each complete two
2175
- 16-token warmups and a 32-token measured response. All three paired outputs,
2176
- counts and finish reasons match, the continuous lane is verified, and both
2177
- servers exit cleanly with fixed source. Each measured request has 1,024
2178
- one-row K/V update encoders, all writing only the new row; neither performs
2179
- a full-buffer copy for those appends. No matching update records fall outside
2180
- the request phase markers. This rejects a repeated whole-cache-copy hypothesis
2181
- for both tested HTTP lanes with prefix caching disabled. Deeper context,
2182
- retained snapshots, growth boundaries and compressed caches remain separate
2183
- regimes. The original token-array HTTP fixture was correctly rejected by the
2184
- endpoint; the corrected text fixture is encoded and hashed by the Bun
2185
- tokenizer before tracing. Evidence is
2186
- `kv-append-http-text-census{,-review}.json` and its per-server dispatch logs.
2187
-
2188
- The native census also passes at an 8,193-token prompt with 32 generated
2189
- tokens. Ordinary ownership again gives 1,024 new-row-only K/V writes. A held
2190
- snapshot gives 32 whole-buffer copies followed by 992 new-row-only writes.
2191
- The two runs emit identical IDs, cover the same 8,224 cached tokens, keep
2192
- sources fixed and return to 16,390 active bytes after explicit cleanup.
2193
- Each phase also contains 480 larger prefill updates. These counts classify
2194
- `SliceUpdate` encoders only; allocation/growth and copy traffic in other
2195
- operations remain separate measurements. Evidence is
2196
- `kv-append-native-8193{,-review}.json` and its dispatch log. There is no timing
2197
- claim or new append kernel from this attribution result.
1126
+ ### 7.8 Execution log (archived)
1127
+
1128
+ The chronological run log (2026-09-04 → 2026-09-08; harness preparation,
1129
+ early first token, shared-M/tile/split-K kernels, graph exports and counter
1130
+ calibration, MLX scheduling settings, shared affine kernels, GDN
1131
+ specializations, strict fill, grammar mask, mmap loader, KV append census)
1132
+ moved verbatim to
1133
+ [qwen38-27b-campaign-log.md](../archive/investigations/qwen38-27b-campaign-log.md).
1134
+ Every evidence filename it cites is kept there and resolves to
1135
+ `reports/qwen38-rd/` on the measuring host. Outcomes, retained flags, next
1136
+ steps and reopen conditions per row are in §7.13; §7.9–§7.12 stay live.
1137
+ Changes that landed by default from that log are correctness or memory fixes,
1138
+ not speed defaults: bounded 8 MiB range cache (§7.7), per-chunk draft-KV
1139
+ evaluation (§7.7), compact state materialization through stock DynamicSlice,
1140
+ SSD boundary-before-transfer fix, Qwen tool-parameter parser,
1141
+ `reasoning_content` alias, EOS/finish-reason accounting, native pack 0.4.0.
2198
1142
 
2199
1143
  ### 7.9 Project kernel coverage
2200
1144
 
2201
- The initial AST inventory contains 35 custom Metal kernel construction sites
2202
- and 355 calls into 162 distinct MLX C APIs. The API count includes allocation,
2203
- configuration and graph operations; it is not a count of native GPU kernels.
2204
- Runtime specializations still need shape, dtype, layout and stream coverage.
2205
- The complete construction-site list, source hashes and per-site evidence are
2206
- `reports/qwen38-rd/project-kernel-inventory.json` and
2207
- `project-kernel-coverage.json`. Every site remains open for broader coverage.
2208
- Variant 13 adds the 36th construction site; its source hash and evidence are
2209
- in `project-kernel-vector-expand-addendum.json` alongside that initial census.
2210
- Joint TurboQuant K/V decoding adds the 37th. A refreshed construction-site
2211
- census and its evidence are in `project-kernel-turboquant-addendum.json`.
2212
- The narrowly selected inverse-rotation kernel adds the 38th; the refreshed AST
2213
- census is `project-kernel-inverse-addendum.json`.
2214
- The MLX 0.32.2 Trellis small-prefill port adds the 39th. Its refreshed census
2215
- and gates are in `project-kernel-wide-addendum.json` and §7.12.
2216
- Consolidating the runtime removes the two old-core affine construction sites.
2217
- The current AST census has 37 sites in 15 files; frozen controls retain the
2218
- retired kernels. Evidence: `project-kernel-consolidated-census.json`.
1145
+ The current AST census has 44 custom Metal kernel construction sites in 18
1146
+ files, plus 12 direct compiled-function construction sites. The seven additions
1147
+ since the earlier census are three paged-attention kernels, two normalized
1148
+ greedy reductions, masked recurrent update and row-length-aware state replay.
1149
+ Frozen source controls retain the two old-core affine kernels the
1150
+ MLX 0.32.2 consolidation removed (§7.12). The initial inventory also counted
1151
+ 355 calls into 162 distinct MLX C APIs; that count includes allocation,
1152
+ configuration and graph operations, not native GPU kernels. Runtime
1153
+ specializations still need shape, dtype, layout and stream coverage. Evidence:
1154
+ `reports/prefill-observation/kernel-census.json` (current), with
1155
+ `reports/qwen38-rd/project-kernel-consolidated-census.json` and
1156
+ the earlier censuses in `project-kernel-inventory.json`,
1157
+ `project-kernel-coverage.json`, `project-kernel-vector-expand-addendum.json`,
1158
+ `project-kernel-turboquant-addendum.json`, `project-kernel-inverse-addendum.json`
1159
+ and `project-kernel-wide-addendum.json`.
2219
1160
 
2220
1161
  | Owned kernel family | Sites | Current evidence and next coverage |
2221
1162
  |---|---:|---|
2222
1163
  | Packed grammar mask | 1 | Exact micro and HTTP outputs; serving timing inconclusive under external load. |
1164
+ | Normalized greedy partial and final reductions | 2 | Same-machine operator and actual-model comparisons pass on both Macs; MiniCPM standard AB/BA improves throughput while packed Qwen MTP3/TQ is flat. Metadata, stochastic and custom samplers retain their prior path. |
1165
+ | Direct paged-attention bf16, affine score and affine value | 3 | C5 operation/model/state and native HTTP checks pass. Recorded wins and regressions do not justify a default; block formats and attention remain optional through the cache/model interfaces. |
2223
1166
  | Joint TurboQuant K/V decoding and selected inverse rotation | 2 | Experimental opt-in; exact operation/lifetime and R6/RTN4 integrated model gates pass on MLX 0.32.2. Integrated inverse-rotation HTTP passes six pairs per quant with decode gains in every pair; R6 complete time improves and RTN4 complete time is inconclusive. Six deferred-consumer pairs per MiniCPM/Gemma also improve complete requests on consolidated source. Combined/pressure and quiet acceptance remain. Direct packed-key attention is exact but slower. Details live in turboquant.md. |
2224
1167
  | Flash attention forward, D, dKV and dQ | 4 | D256 alternative screen fails one KL gate; other attention shapes and backward costs remain. |
2225
1168
  | GLM sparse-attention rank and contract keys | 2 | Both keys now use uint32 with stable score sorting. Operation and complete tiny-model state gates pass; six balanced pairs per shape improve selection latency. Real Colibri serving remains unmeasured. |
2226
1169
  | GLM q4/q8 streamed expert gate/up and down | 4 | Synthetic resident-slot geometry screen and six balanced repeats preserve intermediate/output bytes and cleanup. BF16 timing is bimodal across identical process configurations; no geometry default retained. Attribute that variation before further timing claims. Real model and I/O overlap remain unmeasured. |
2227
1170
  | Qwen causal convolution, SiLU and copied tail | 1 | Exact operation/model/state gates; fusion has no compelling full-model speed win. |
2228
- | Gated recurrent update | 1 | Unrolling, geometry, compilation and normalization fusion screened; full-model gains too small to retain. |
1171
+ | Gated recurrent update, masked update and prefix-state replay | 3 | Unrolling, geometry, compilation and normalization fusion screened; full-model gains too small to retain. Masked padding and row-length replay preserve inactive state and accepted-prefix state in composed native/serving gates. Uniform state-only replay did not establish a serving win and remains unselected. |
2229
1172
  | Qwen multimodal rotary embedding | 1 | Direct-stride fusion preserves operation/model state, but the complete-forward gain is too small to retain. Actual image/video HTTP coverage remains. |
2230
1173
  | Trellis reduce, scatter, expand and gate/up variants | 9 | Shared rows and fusion improve measured cells. Device codebook lookup loses. A scoped threadgroup integer table improves repeated M3/4 scatter, full forwards and MTP HTTP requests with exact outputs; M1 loses and stays procedural. Scheduling and prefill controls remain. Broader bit/axis/shape/model coverage remains. |
2231
1174
  | Trellis split-K projection and accumulation | 2 | Short-prefill model/serving acceptance; larger shapes and additional artifacts remain. |
2232
1175
  | Trellis tiled projection | 1 | Short axis-1 tiles accepted diagnostically; larger tiles, context and memory pressure remain. |
2233
- | Trellis native-wide prefill | 1 | Matches MLX 0.32.2 small-prefill arithmetic on eligible GPUs. Operation, integrated R6 state/generation and six HTTP pairs per lane pass. Short-prefill TTFT improves; broader context and quiet acceptance remain. |
2234
- | Trellis vectorized expansion | 1 | Exact operation, full-model prefill and HTTP responses. Shorter serial and default-scheduler HTTP prefills improve; existing-suite timing mostly flat. Broader context, pressure and quiet M4 Pro gates remain. |
1176
+ | Trellis native-wide prefill | 1 | Reached under `MLX_BUN_TRELLIS_VARIANT=11..13`, including the current variant-13 default; variant 6 expands then uses native matmul. Matches MLX 0.32.2 small-prefill arithmetic on eligible GPUs. Operation, integrated R6 state/generation and six HTTP pairs per lane pass. Short-prefill TTFT improves; broader context and quiet acceptance remain. |
1177
+ | Trellis vectorized expansion | 1 | Exact operation, full-model prefill and HTTP responses. Shorter serial and default-scheduler HTTP prefills improve; existing-suite timing mostly flat. Broader context, pressure and quiet-machine gates remain. |
2235
1178
  | Cross-entropy forward/backward variants | 7 | All seven routes pass the vocabulary-partition screen, including 54 forced-fallback cases. The isolated fast-dispatch opportunity does not apply to the available models wired into this loss path; broader real-loss profiling remains. |
2236
1179
 
2237
1180
  The native-operation audit covers quantized/dense/gather matmul, SDPA,
@@ -2292,7 +1235,7 @@ controls vary from about 0.29 to 0.58 ms; Q8 M1 controls vary from about 0.24 to
2292
1235
  0.51 ms. Some candidate/control pairs reverse by nearly 2x. Float32 is much
2293
1236
  steadier and generally flat across geometries. Attribute this bf16 timing
2294
1237
  variation before further optimization claims. No geometry default changes.
2295
- These are M4 Pro 24 GB diagnostics. Real Colibri serving remains unavailable;
1238
+ These synthetic screens were measured on the M4 Pro 24 GB. Real Colibri serving remains unavailable;
2296
1239
  the local GLM-5.3-Flash artifact uses a different architecture. Evidence:
2297
1240
  `streamed-expert-screen{,-review}.json` and
2298
1241
  `streamed-expert-repeat{,-review}.json`.
@@ -2419,7 +1362,7 @@ unchanged and the continuous lane/submitted-row counters are asserted.
2419
1362
  The apparent packed serial improvement does not survive six balanced pairs:
2420
1363
  all 30 paired responses remain exact, but complete sampled request time is
2421
1364
  0.183% higher at the median and only one pair is faster. The untouched greedy
2422
- control moves by +0.058%. These M4 Pro diagnostic results do not justify
1365
+ control moves by +0.058%. These loaded-machine results (M4 Pro) do not justify
2423
1366
  retaining the fusion for Qwen. Evidence is `top-p-http-screen{,-review}.json`
2424
1367
  and `top-p-http-r6-serial-repeat{,-review}.json`.
2425
1368
 
@@ -2534,8 +1477,8 @@ dispatch. Both arms disable the existing shared-affine flag, and the candidate
2534
1477
  pays its eligibility checks. The first two HTTP attempts failed overlap
2535
1478
  qualification and remain excluded. Evidence:
2536
1479
  `affine-head-batched-decode-mfirst-{llama1,llama3}-review.json` and
2537
- `affine-shared-head-http-{llama1,llama3}-overlap-review.json`. These M4 Pro
2538
- diagnostics do not replace quiet-machine acceptance. Closed head-only helpers
1480
+ `affine-shared-head-http-{llama1,llama3}-overlap-review.json`. These
1481
+ loaded-machine diagnostics (M4 Pro) do not replace quiet-machine acceptance. Closed head-only helpers
2539
1482
  are removed; the broader operation's eligibility work remains open.
2540
1483
 
2541
1484
  A bf16-only selection uses large projections and leaves small matrices on
@@ -2579,9 +1522,10 @@ Six native pairs per append length preserve all logits, live states and
2579
1522
  continuations. Both M4 and M8 improve in every pair; M1 and M128 controls are
2580
1523
  approximately flat. The candidate exercises 105 additional projections at
2581
1524
  M4/8. Evidence: `affine-nonfast-large-full-model-gemma12-review.json`.
2582
- The existing opt-in 4-bit kernel now selects native eight- or sixteen-value
2583
- lane arithmetic for those shapes. The flag remains off by default, and the
2584
- 3/8-bit selection remains restricted to its original shapes. Large nonfast
1525
+ The then-existing opt-in 4-bit kernel selected native eight- or sixteen-value
1526
+ lane arithmetic for those shapes, off by default, with the 3/8-bit selection
1527
+ restricted to its original shapes; that kernel and its flag were removed in
1528
+ the MLX 0.32.2 consolidation (§7.12) and survive only in frozen source controls. Large nonfast
2585
1529
  output heads with N≥65536 remain native because no such head has passed the
2586
1530
  model/serving performance gate. This does not change the measured Gemma
2587
1531
  projection selection. Focused tests
@@ -2659,16 +1603,45 @@ fast RoPE. Evidence: `mrope-reuse-screen-review.json` and
2659
1603
  `mrope-stride-full-model-packed-review.json`. Closed helpers are removed; raw
2660
1604
  reports and source hashes remain.
2661
1605
 
2662
- The final M4 Pro bundle must record incumbent and candidate source hashes,
2663
- local diff, Bun/native/oracle versions, model hashes, flags and workload files.
2664
- Run the existing serving suite and native generation separately on the M4 Pro,
1606
+ The final quiet-machine bundle must record host/chip/RAM, incumbent and
1607
+ candidate source hashes, local diff, Bun/native/oracle versions, model hashes,
1608
+ flags and workload files.
1609
+ Run the existing serving suite and native generation separately on a quiet machine,
2665
1610
  with fixed cache conditions and all paired samples retained. Its existing
2666
1611
  numbers are historical controls until the workload and version metadata match.
2667
1612
 
2668
1613
  ### 7.10 Final benchmark and HTML comparison report
2669
1614
 
1615
+ Request tracing separates the gateway’s request-slot wait (`engine.request_wait`)
1616
+ from execution-lock or row-admission wait (`engine.admission_wait`). Cache
1617
+ prefetch/restore preparation has its own `cache.prefetch` span before execution;
1618
+ later cache selection remains `cache.lookup_restore`. The prompt-response
1619
+ report sums the two queue spans and the two cache spans in their respective
1620
+ columns. Historical records without the new spans omit that work and must not
1621
+ be interpreted as complete queue attribution. The shared serving HTTP reader
1622
+ accepts a trace ID to correlate server phases with each scheduled request.
1623
+
1624
+ The offline renderer and replay fixtures are implemented. It imports the
1625
+ existing native/serve formats and saved Pi task results, retains failures and provenance, and suppresses
1626
+ speed ratios for incompatible work or unqualified runs. Its current metrics
1627
+ and limitations live in benchmarks.md. A bounded MiniCPM M1 diagnostic passes
1628
+ the real measurement path with the explicit reference control; concurrent
1629
+ output differences remain visible. Fixed-source block log-ratio intervals now
1630
+ use a deterministic bootstrap across distinct workload seeds, with duplicate
1631
+ seeds excluded and at least five blocks required. Task imports load adjacent
1632
+ `quality.json` checks with file hashes, report failures and blocked categories,
1633
+ and retain source/settings, per-turn request hashes, timing, usage and final
1634
+ SSD flush records. Task rows do not enter engine-speed pairing. The read-only
1635
+ quality-ledger exporter supplies portable model accuracy/KL/size records,
1636
+ with source rows, configuration and machine provenance retained. Legacy
1637
+ dataset/artifact identity limitations remain explicit; importing history
1638
+ does not establish current-artifact quality acceptance. The frozen
1639
+ final protocol and quiet final matrix remain acceptance work;
1640
+ rendering saved evidence does not close this gate.
1641
+
2670
1642
  After the optimization gates close, build and run a repeatable benchmark for
2671
- the incumbent, combined finalists and retained quantizations on the M4 Pro.
1643
+ the incumbent, combined finalists and retained quantizations on a quiet
1644
+ machine, recording its host/chip/RAM.
2672
1645
  The benchmark must preserve the existing suite's measurements while making
2673
1646
  native generation, serving, memory and quality comparisons easier to inspect.
2674
1647
  Its protocol is frozen before final runs; the held-out Kanban task in section
@@ -2758,7 +1731,7 @@ them. Embed the report's required assets so the exported file works offline.
2758
1731
  Exit requires a model-free replay fixture proving schema validation, unit
2759
1732
  definitions, pairing, failure handling and renderer escaping; a bounded live
2760
1733
  smoke through the real measurement paths; then the frozen final matrix on
2761
- the M4 Pro. Compare the old suite and new suite on shared cells to
1734
+ a quiet machine. Compare the old suite and new suite on shared cells to
2762
1735
  detect measurement changes before attributing a difference to the engine.
2763
1736
  Publish qualified numbers only in the canonical benchmark reference, with
2764
1737
  raw JSON and HTML under `reports/`. Machine access or unsupported cells that
@@ -2842,8 +1815,8 @@ ordinary first-token reads. All servers exit cleanly with equal active
2842
1815
  capacity, and all 547 source hashes remain fixed. Complete-request paired
2843
1816
  medians for concatenation improve only 0.33%, 0.06% and 0.23% across the code,
2844
1817
  explanation and JSON fixtures. The `evalAll` alternative improves 0.26% and
2845
- 0.04% but regresses 0.44% on JSON. Losses remain in both results. These M4 Pro
2846
- diagnostics establish no broad serving benefit worth another sampler path.
1818
+ 0.04% but regresses 0.44% on JSON. Losses remain in both results. These
1819
+ diagnostics (M4 Pro) establish no broad serving benefit worth another sampler path.
2847
1820
  Evidence: spec-grouped-greedy-screen.json, spec-grouped-greedy-eval-screen.json
2848
1821
  and spec-grouped-greedy-three-http{,-review}.json. This tests target verification
2849
1822
  readback only, not DFlash2's architecture or the separate forced-token method.
@@ -2862,7 +1835,7 @@ Priority is the bounded M1 scalar operation screen, current-artifact long-agent
2862
1835
  memory/context coverage, then Qwen DFlash2 feasibility. Only positive operation
2863
1836
  economics and quality evidence justify a new full-model loader or artifact.
2864
1837
  Approximate prompt reduction follows the exact-path work. No external speed
2865
- or memory figure changes our baseline; remaining runs stay on the M4 Pro.
1838
+ or memory figure changes our baseline.
2866
1839
 
2867
1840
  The bounded Bun/Metal M1 screen now preserves all 54 fixture cases, including
2868
1841
  online rotation, dtype promotion and incomplete packed rows. Six fresh-process
@@ -2886,30 +1859,18 @@ zero/subnormal/overflow scale values. Six fresh processes then preserve all 84
2886
1859
  large-projection comparisons at M257/512, including rotation and native matmul,
2887
1860
  with identical cross-process hashes and zero final active allocation. Median
2888
1861
  complete-operation time falls 40.85–57.51%; peak temporary allocation falls
2889
- 765.00–765.05 MiB. Every pair improves. These are M4 Pro diagnostics on synthetic
1862
+ 765.00–765.05 MiB. Every pair improves. These were measured on the M4 Pro on synthetic
2890
1863
  resident matrices. They do not measure real model quality, RSS or whole-model
2891
1864
  speed, and they do not replace the separate small-M QMM arithmetic. Evidence:
2892
1865
  `polar-expand.json` and `polar-expand-repeat{,-review}.json`.
2893
1866
 
2894
1867
  Our existing `TurboQuantKVCache.#decode` has the same unpack/gather/scale
2895
- pattern. The byte-packed KV decoder passes operation repeats, long-context
2896
- Qwen state, RTN4 and deferred D128/D512 consumer gates. It is integrated behind
2897
- an experimental opt-in, with exact operation/fallback/lifetime checks, six
2898
- HTTP pairs per R6/RTN4 quant and the first integrated 8K state gate. Allocation
2899
- diagnostics distinguish live-array ownership from Metal buffer capacity.
2900
- Six long-context three-arm blocks preserve responses and improve complete time;
2901
- the narrower inverse-rotation operation is now integrated. Its R6 and RTN4
2902
- model and repeated HTTP response gates pass on the new core. Decode improves
2903
- on both; R6 complete time improves while RTN4 complete time remains inconclusive.
2904
- Six HTTP
2905
- pairs each on MiniCPM and Gemma deferred consumers pass response identity and
2906
- improve complete time. Pressure and quiet acceptance remain. Direct packed-key
2907
- attention preserves the native arithmetic but loses
2908
- against the integrated decoder in complete codec/attention repeats; that
2909
- additional speed candidate is closed.
2910
- Its mechanism and evidence
2911
- live in turboquant.md, "Packed-value decode fusion investigation". The video's
2912
- weight format still has no production loader or kernel here.
1868
+ pattern. The byte-packed KV decoder and the narrower inverse-rotation
1869
+ operation are integrated behind `MLX_BUN_TURBOQUANT_FUSED_DECODE=1`; their
1870
+ gates, numbers and the closed direct packed-key attention arm live in
1871
+ turboquant.md, "Packed-value decode fusion investigation", and the ledger row
1872
+ is §7.13 R13. The video's weight format still has no production loader or
1873
+ kernel here.
2913
1874
 
2914
1875
  ### 7.12 Custom-kernel graph reuse and the MLX runtime update
2915
1876
 
@@ -2980,8 +1941,8 @@ continuation. All twelve cells are byte-exact against the matching MLX-LM
2980
1941
  reference. The two new-core builds also agree with each other in those cells.
2981
1942
  Source hashes stay fixed and every worker exits cleanly. Evidence:
2982
1943
  runtime-oracle-rtn4.json and runtime-oracle-rtn4-macos14.json.
2983
- The working tree now selects the verified macOS 14 native-pack candidate
2984
- 0.4.0 from a local cache. It has not been published. Final-source acceptance
1944
+ The package selects the verified macOS 14 native pack 0.4.0, now published;
1945
+ distribution.md records the release. Final-source acceptance
2985
1946
  passes 16 RTN4 same-version reference cases (including actual 4K/8K prompts),
2986
1947
  36 Trellis forward/state/continuation cases and six Trellis generations.
2987
1948
  The Trellis control is the accepted new-core implementation; this is not a
@@ -3019,7 +1980,10 @@ for every tested 2/3/4-bit cell. A full-model prototype comparison passes all
3019
1980
  Those timings are screening evidence, not serving results.
3020
1981
 
3021
1982
  The integrated implementation keeps geometry and arithmetic in
3022
- `trellis-wide-prefill.ts`. Qwen supplies an explicit layout proof from its
1983
+ `trellis-wide-prefill.ts`. It is dispatched only under
1984
+ `MLX_BUN_TRELLIS_VARIANT=11..13` (`TrellisLinear.forward` in
1985
+ `src/model/trellis-linear.ts`); the default variant 6 still expands and uses
1986
+ native matmul, so this path is opt-in, not production. Qwen supplies an explicit layout proof from its
3023
1987
  RMSNorm output through the existing MLP and linear calls. Unproven layouts
3024
1988
  return to native expansion/matmul for the affected sizes. Reading lazy-array
3025
1989
  strides before evaluation cannot establish this proof, and inserting an eval
@@ -3064,8 +2028,8 @@ Both append lengths, one and eight tokens, pass at both contexts. Full
3064
2028
  logits, every live cache array and the fixed continuation are byte-exact;
3065
2029
  both workers exit cleanly with fixed source hashes. Evidence:
3066
2030
  runtime-oracle-long-macos14.json and
3067
- native-runtime-screen{,-review}.json. These runs used the loaded M4 Pro and
3068
- are not canonical benchmark rows.
2031
+ native-runtime-screen{,-review}.json. These runs used a loaded machine (M4 Pro)
2032
+ and are not canonical benchmark rows.
3069
2033
 
3070
2034
  A native proxy prototype establishes a narrower graph-reuse option. It holds
3071
2035
  the original custom operation, delegates evaluation to MLX's existing encoder,
@@ -3176,6 +2140,265 @@ Their reported gains are not our measurements. New [GQA8 attention reuse](https:
3176
2140
  has a narrow D64/128 dispatch; Qwen3.8-27B uses GQA6/D256, so it is an algorithm
3177
2141
  lead rather than a direct dispatch win here. The [optional fused full-attention
3178
2142
  path](https://github.com/ml-explore/mlx/pull/4185) explicitly trades throughput
3179
- for bounded temporary memory. Evaluate that tradeoff on the M4 Pro's actual
2143
+ for bounded temporary memory. Evaluate that tradeoff on the actual
3180
2144
  eligible path. Reference numerical changes must be explained, never hidden by
3181
2145
  loosening the oracle tolerance.
2146
+
2147
+ Qwen layer evaluation bounds deferred prefill work. The exact oracle and
2148
+ retained-history results, including superseded reservation trials, are in
2149
+ [benchmarks.md](../reference/benchmarks.md). Josh's closeout machine policy
2150
+ permits the recorded audio-daemon CPU activity with exclusive GPU ownership,
2151
+ available memory and stable alternating pairs. Earlier diagnostic evidence
2152
+ keeps its original classification.
2153
+
2154
+ Josh subsequently chose request execution over predicted-memory refusal. The
2155
+ reservation prototypes remain historical diagnostics. Default fit estimates
2156
+ must neither reject prompts nor clamp completion caps; only explicit operator
2157
+ limits and fixed representation capacities apply. The Qwen layer evaluation
2158
+ fix stays, while reservation callbacks and their hot-path checks are removed.
2159
+ Actual failures remain recorded in reliability and timing results.
2160
+
2161
+ ### 7.13 Outcome ledger
2162
+
2163
+ One row per §7.4 experiment, in the §7.7 vocabulary (repeatable win, measured
2164
+ loss, inconclusive, blocked, unmeasured). Every campaign number was measured
2165
+ on Joshs-MBP-2025.local (Apple M4 Pro, 24 GB) unless a row says otherwise;
2166
+ the host is provenance, not scope. All "repeatable win" rows have at least
2167
+ six balanced pairs with exact outputs. The original rows below describe
2168
+ loaded-machine diagnostics. The closeout serial v6/v13 suite now passes six
2169
+ balanced pairs under the recorded audio-CPU allowance, with every paired
2170
+ request matching. Final-source native state and bf16/KV4 MTP-prefix gates
2171
+ also pass. Later acceptance promoted variant 13 and shared batching in v0.4.0; early
2172
+ first output is now also selected. Remaining combinations and measurement
2173
+ limits are identified per row. New evidence is in `reports/qwen38-closeout/` and
2174
+ [benchmarks.md](../reference/benchmarks.md). Historical evidence paths
2175
+ are relative to `reports/qwen38-rd/` on the measuring host; the narrative
2176
+ behind each row is the archived log
2177
+ ([qwen38-27b-campaign-log.md](../archive/investigations/qwen38-27b-campaign-log.md)),
2178
+ §7.9–§7.12, [turboquant.md](turboquant.md) "Packed kernel experiments" and
2179
+ "Packed-value decode fusion investigation", and
2180
+ [speculative-decoding.md](speculative-decoding.md) §4.7/§7.4.
2181
+
2182
+ | ID | Experiment | Outcome | Retained flags / defaults | Evidence files | Next discriminating step or missing resource | Reopen condition |
2183
+ |---|---|---|---|---|---|---|
2184
+ | R0 | Exact artifact and execution controls | **Inconclusive.** Isolated unmodified `6d45ca1`/`673b43f` checkouts: six native AB/BA pairs per flagship/compact/RTN4 match every ID at 6/128/512 prompt tokens with flat TTFT/complete/memory; six serial and six default-scheduler HTTP pairs preserve every response with flat or slightly lower complete time. Updated Bun vs MLX-LM native controls (six pairs per affine artifact, 64 tokens) emit identical IDs, complete time close, small median Bun advantage. Graph exports (v6/v8 at M=1/4/5), dispatch inventory, per-operation counter calibration and a schedule recorder exist; dispatch-level GPU sampling is unsupported on the M4 Pro, so per-kernel attribution stays open. The M4 DeltaNet golden is resolved (stale fixture; Bun and Python agree). The quiet serial/default/mlx-lm HTTP baseline never ran; the packed target has no stock mlx-lm arm. | None (controls only). | `refactor-fixed-kernel-audit-plan.json`, `refactor-native-paired{,-review}.json`, `refactor-http-paired-{serial,default}-review.json`, `native-affine-paired{,-review}.json`, `native-affine-paired/`, `native-memory-ledger.json`, `native-memory-chunk512-screen/`, `graph-captures/`, `variant8-attached.trace`, `attached-trace-summary.json`, `labelled-v8-analysis.json`, `labelled-v8-kernels.txt`, `variant8-labelled.trace`, `metal-counter-capabilities.json`, `mlx-counter-source-manifest.json`, `mlx-counter-build.patch`, `metal-counter-pooled-unit.stderr.txt`, `metal-counter-calibration-review.json`, `mlx-schedule-source-manifest.json`, `mlx-schedule-smoke-v2.log`, `top-p-schedule-screen{,-review}.json`, `empty-submit-r6-steady-trace{,-review}.json`, `mlx-empty-submit-steady-source-manifest.json` | Exclusive M4 time is now available. Finish the final-source serving/reference controls: `bun scripts/bench-serve.ts all --model-path ~/models/Qwen3.8-27B-q3-trellis-ldlq-k300-packed-interleave2-rd --arms mlx-bun-serial --context 4096 --tokens 192 --workload-seed <block>` alternated with the default arm across blocks, plus the RTN4 affine artifact with `--arms mlx-bun-serial,mlx-lm` (the only same-artifact oracle cell); quiet preflight passing; distinct `--out` per block. | Any change to the controlled path: native pack bump, artifact layout change, new kernel default. |
2185
+ | R1 | Packed prefill tile decode plus matmul | **Adopted in the v0.4.0 default.** Variant 11 (tiled axis-1 gate/up, M=5..32) and variant 12 (split-K axis-0 down, M=5..8) reconstruct bf16 weights inside tiles with exact full-model logits/state/continuation; six native paired blocks improve eligible M; six raw-completion HTTP pairs per lane improve TTFT and complete time (six-token prompt, 8/64 output tokens); the second tile pass improves eight-request throughput and B=1 TTFT in six pairs. All 40 larger tile geometries at M=128/512 are exact but none beats expansion plus native matmul in six AB/BA pairs. On MLX 0.32.2/M3+ the M5..15 axis-1 path uses the wide-prefill kernel (native `gemv_wide` arithmetic); six HTTP pairs per lane improve TTFT in every pair, decode and RSS unchanged. | Trellis variant 13 is the shipped default; older variants remain explicit controls. | `variant11-full-model-review.json`, `trellis-v11-http{,-review}.json`, `variant12-full-model.json`, `trellis-splitk-{screen,tuning,full-model}-review.json`, `trellis-v12-combined-http{,-review}.json`, `trellis-v12-combined-native-review.json`, `trellis-v12-native-failure-replay.json`, `trellis-tile-layout-screen-review.json`, `trellis-tile-full-model-review.json`, `trellis-splitk-bm8-{other-bits,full-model}-review.json`, `trellis-tile-integrated-forward-review.json`, `trellis-tile-http-review.json`, `trellis-tile-seeded-serial-http-review.json`, `trellis-tile-native{,-review}.json`, `trellis-large-prefill-screen{,-review}.json`, `mlx-upgrade-0.32.2/trellis-wide-{screen,perf,full,integrated-full}`, `mlx-upgrade-0.32.2/trellis-wide-http{,-review}.json`, `mlx-upgrade-0.32.2/trellis-wide-continuous.json` | Existing six-pair serial/default/combined comparisons and final-source native gates are accepted. Reuse them; broader pressure and final report work remain separately tracked in Phase 6. | A tile geometry beating native matmul at M≥128 on real k3 matrices, or a GPU generation that changes native small-M dispatch. |
2186
+ | R2 | Bounded expansion scheduling | **Repeatable win (opt-in).** Unrestricted deferral (variant 9) and unrestricted async submission gain on short prompts but fail the saved-agent pressure gate (Metal insufficient memory at the 12,954-token request). The bounded policy (async only while MLX active allocation is below 75% of the recommended working set) passes serial and continuous pressure gates; integrated six HTTP pairs per lane: TTFT -4.00%/-3.96% at 128 prompt tokens (six wins), -1.43%/-1.40% at 512; wall -0.63..-0.88%; decode flat; native M16/128/512 forwards -2.09/-6.19/-2.80% with about +368/403 MB peak allocation. | `MLX_BUN_TRELLIS_ASYNC_EXPAND=1`, variant 13 only, default off. | `variant9-full-model.json`, `trellis-v13-boundary-full-model{,-review}.json`, `trellis-v13-boundary-http-serial{,-review}.json`, `qwen-long-boundary-serial{,-review}.json`, `qwen-long-async-serial{,-review}.json`, `trellis-v13-bounded-full-model{,-review}.json`, `qwen-long-bounded-{serial,default}{,-review}.json`, `trellis-v13-bounded-http-{serial,default}{,-review}.json`, `trellis-async-integrated-{typecheck,hygiene,model-free}.txt`, `trellis-async-production-full-model{,-review}.json`, `trellis-async-production-http-{serial,default}{,-review}.json`, `trellis-async-production-long-{serial,default}{,-review}.json` | The combined variant-13/fused-k8v3/MTP3 seven-request pressure gate passes on M4 after the existing M1 gate: all responses and complete usage match across roomy sync, constrained sync and constrained async arms; both threshold branches execute and persistence completes. See benchmarks.md and `reports/prefill-observation/combined-tq-mtp-pressure{,-review}.json`. Retain opt-in selection: the measured complete-request gain is modest and expansion overlap increases live allocation. Reopen for a changed model/barrier or a materially better timing/memory tradeoff; do not repeat the unchanged pressure gate. | A change to the memory headroom guard or to per-layer cache evaluation boundaries (R16/R17). |
2187
+ | R3 | Axis-0 scatter layout and split-K | **Adopted in the v0.4.0 default.** Variant 8 (balanced word-aligned 3-bit scatter, all 32 lanes; k3/T256/L≤12) and variant 10 (scatter decode shared across M=2..4) pass exact full-model gates and improve M=1/2/4 and M=2..4 in six native blocks; row-loop unrolling not retained. A threadgroup integer codebook restricted to the M3/4 k3 interleaved down projection: six pairs -1.44/-2.00% forwards, six MTP HTTP pairs -1.07/-1.27/-1.19% complete time (5/6, 5/6, 4/6 wins), six four-request cohorts -1.49% (4/6); M1 loses and stays procedural; folded into variant 13. A 2.59% M128 control slowdown in one sequence was not reproduced by two controls. Variant 6 unchanged. | Trellis variant 13 is the shipped default; older variants remain explicit controls. | `balanced3-screen/`, `scatter-unroll-screen/`, `aligned3-screen/`, `variant8-paired/`, `variant8-full-model.json`, `shared-scatter-screen/`, `shared-scatter-all-screen/`, `variant10-full-model.json`, `trellis-threadgroup-codebook.json`, `trellis-threadgroup-scatter{,-m3}{,-review}.json`, `trellis-scatter-full{,-repeat}{,-review}.json`, `trellis-scatter-http{,-repeat}{,-review}.json`, `trellis-scatter-prefill{,-review}.json`, `trellis-scatter-sequence{,-review}.json`, `trellis-scatter-http-trace{,-review}.json`, `trellis-scatter-cohort-v2{,-review}.json`, `trellis-scatter-integration-source-change.json`, `trellis-scatter-integration-focused-tests-final.txt`, `trellis-scatter-integration-typecheck.txt`, `trellis-scatter-integrated-full{,-review}.json`, `trellis-scatter-integrated-http{,-review}.json`, `trellis-scatter-integrated-cohort{,-v2}{,-review}.json` | Existing six-pair serial/default/combined comparisons and final-source native gates are accepted. Reuse them; broader pressure and final report work remain separately tracked in Phase 6. | k2/k4 down projections (only k3 interleaved is qualified) or a new bit allocation from R19. |
2188
+ | R4 | Axis-1 reduce and gate/up fusion | **Adopted in the v0.4.0 default.** Variant 7 shares each decoded gate/up weight across M=2..4 with fused gate/up, keeping the variant-6 accumulator order; exact matrix/MLP/full-model gates at M=1..5 and six AB/BA blocks retain the complete-MLP gain; the last-position append sweep confirms the M=4/5 cost discontinuity. Sharing activation loads across 2/4/8 output rows per SIMD group loses at k3 M=1; smaller threadgroups do not rescue it. The M=1 decode kernel is unchanged; the 64/128/256-thread and accumulator sweep with spill/occupancy inspection never ran because per-dispatch counters are unavailable. | Trellis variant 13 is the shipped default; older variants remain explicit controls. | `paired-shared-m/`, `variant7/`, `shared-m-full-model.json`, `shared-m-append-lengths.json`, `trellis-shared-rows-k3-r*-m1.json`, `trellis-shared-rows-k3-r*-s*-m1.json` | Missing resource: per-dispatch GPU counters or an Instruments shader profile (unsupported on the M4 Pro) to drive the M=1 thread/rows/accumulator sweep. | Kernel-level GPU timing becomes available, or a k mixture changes gate/up bit widths. |
2189
+ | R5 | Decode primitive | **Measured loss.** Every alternate decoder loses at M=1 (M4 Pro): device f32 LUT (all bit widths), constant int16 table (0.802 vs 0.331 ms reduce, 0.747 vs 0.443 ms scatter, 1.474 vs 0.615 ms gate/up), device/threadgroup fp16 tables, and a constant int16 table on MLX 0.32.2 (nearly 2x complete MLP). The integer y-mad rewrite is exact with no useful gain; the readable expression stays. The only retained table is the scoped M3/4 scatter codebook (R3). The activation audit finds the packed fused SwiGLU uses a float32 precise-exp sigmoid unlike compiled MLX: a Lab distinction, no default change. | None. | `lut6-*.json`, `trellis-codebook.json`, `trellis-codebook-scoped{,-review}.json`, `trellis-constant-short-k3-m1.json`, `trellis-device-half-k3-m{1,4}.json`, `trellis-threadgroup-half-k3-m{1,4}.json`, `mlx-upgrade-0.32.2/trellis-constant-{screen,review,invalid-attempt}.json`, `trellis-y-mad-manifest.json`, `trellis-y-mad-k*-m*.json`, `trellis-activation-audit.json` | None for exact rewrites; a changed code family (QTIP/YAQA computed codes) needs a new artifact plus the KL/MMLU/tGSM/rawGSM screen before any kernel. | A hardware generation with faster threadgroup/constant memory relative to ALU, or a new code family with quality evidence. |
2190
+ | R6 | Offline repacking without re-quantization | **Repeatable win (opt-in artifact).** Two-block interleaving of k3 axis-0 code words inverts to identical code bytes; prototype readers preserve 35 full-model cases. A separately written lossless artifact (quantizer `--interleave-codes`) read by every kernel from one resident code copy: six native pairs improve single-token/M4 forwards and 64-token generation in every pair with equal peak allocation; six serial and six default-scheduler HTTP pairs improve decode at 6/128/512 prompt tokens in every pair; TTFT small or mixed; RSS flat. | Not a default artifact change; served benchmarks use `Qwen3.8-27B-q3-trellis-ldlq-k300-packed-interleave2-rd`. | `trellis-block-interleave-screen-review.json`, `trellis-block-interleave-full-model-{g2,g10}-review.json`, `trellis-block-interleave-native-generation-g2-interface-review.json`, `trellis-block-interleave-http-{serial,default}-review.json`, `trellis-interleaved-readers-screen-review.json`, `trellis-interleaved-readers-full-model-count-review.json`, `trellis-interleaved-readers-order-full-model-review.json`, `trellis-interleaved-vector-schedule-screen-review.json`, `trellis-interleaved-readers-schedule-full-model-review.json`, `trellis-interleave-integrated-tests.txt`, `trellis-interleave-integrated-tail-tests.txt`, `trellis-interleave-model-free.txt`, `trellis-interleave-artifact-review.json`, `trellis-interleave-artifact-native-fd-review.json`, `trellis-interleave-encoder-tests.txt`, `trellis-interleave-artifact-http-{serial,default}-review.json`, `reports/prefill-observation/interleave-cache-shared-{0..11}.md.json`, `interleave-cache-shared-review.json` | **Accepted.** Six balanced original/interleaved pairs on M4 use the default shared scheduler, KV4/MTP2 and RAM/SSD prompt caching. All requests, complete usage and restart checks match, with decode and cached completion improvements in every pair. Machine activity and timing limits are recorded in benchmarks.md; no additional unchanged serial run is required. | Expanded state-window index variant (bytes for ALU) untested; k2/k4 interleaving unqualified. |
2191
+ | R7 | Small-M packed kernel | **Adopted in the v0.4.0 default.** Shared-M variants 7/8/10 reuse decoded weights across M=2..4 (R3/R4); the M=4/5 whole-model cost discontinuity is confirmed and the packed-to-expanded crossover is also a numerical boundary: the M≤8 crossover prototype wins MLP time but changes output bytes for every bit width, so it is Lab and not retained. The wide-prefill kernel (variants 11–13 on MLX 0.32.2/M3+) shares each decoded row across all M=5..15 vectors reproducing native `gemv_wide` arithmetic: 36 forward/state/continuation cases and six generations exact; six HTTP pairs per lane improve TTFT in every pair with decode/RSS unchanged. Fill spans and MTP verifies inherit these curves (R15/R20). | Trellis variant 13 is the shipped default; older variants remain explicit controls. | `shared-m-append-lengths.json`, `m8-screen/`, `mlx-upgrade-0.32.2/trellis-runtime-full`, `mlx-upgrade-0.32.2/trellis-wide-{screen,perf,full,integrated-full}`, `mlx-upgrade-0.32.2/trellis-wide-http{,-review}.json`, `mlx-upgrade-0.32.2/trellis-wide-continuous.json` | M1 qualification of the existing wide kernel fails exactness, including every full-width cell; retain earlier dispatch there. A different pre-M3 kernel or the M≤8 crossover requires its own numerical and quality gates. | Any MLX runtime bump that changes small-M dense dispatch (rerun `trellis-runtime-full`). |
2192
+ | R8 | Fused GDN conv/state/SiLU | **Measured loss.** A fused convolution/SiLU/copied-tail prototype matches bf16/f32 outputs and live tail at B=1/2 only with MLX's typed sigmoid expression; it passes full packed-model logits, live state, continuation and speculative rollback. Against an independently materialized baseline its full-model timing is approximately flat with similar peak memory; unpromoted. Side finding landed as default: `mlx_copy` aliasing retained the source buffer; compact state materialization now uses stock DynamicSlice. | None (DynamicSlice materialization is a memory fix, not a speed default). | `gdn-stage-probe.json`, `conv-probe-typed-sigmoid.json`, `qwen-conv-materialized-packed.json`, `materialize-final-packed-comparison.json` | None; the missing instrument is per-dispatch GPU timing of the conv stage. | Attribution shows conv/SiLU above 3% of the decode critical path. |
2193
+ | R9 | GDN norm, gates and recurrence | **Measured loss.** Threadgroup layouts, fixed sequence lengths, unrolling, compiled wrappers and typed sigmoid fusion pass all 114 shape cells after correcting a float32 sigmoid rewrite that broke bf16 recurrence. A compiled fixed-length candidate preserves full-model identity but its isolated gains mostly disappear in full forwards; a fused recurrence + output RMSNorm + gate kernel passes 60 isolated cells and small-M full-model checks with a gain too small to integrate. Fixed-shape CompiledFunction over the 16 SSM groups (R16) gives -0.062%/-0.202% median. Production dispatch unchanged. | None. | `gdn-specialization-typed.json`, `gdn-static-full-model-review.json`, `gdn-fused-norm-probe.json`, `gdn-fused-norm-full-model-review.json`, `mlx-upgrade-0.32.2/qwen-fixed-ssm-groups-r6.json`, `mlx-upgrade-0.32.2/qwen-fixed-ssm-groups-rtn4-internal.json`, `mlx-upgrade-0.32.2/qwen-ssm-hot-review.json` | None until prefill-regime attribution shows the recurrence dominates (decode M=1 was the measured target). | Prefill attribution, or a transposed-state layout with a measured M=1 win. |
2194
+ | R10 | Parallel/chunkwise GDN prefill | **Prefill attribution complete; no parallel rewrite retained.** Current packed-target controls and an operation observer preserve complete hidden/state hashes at 1k/4k/8k on both Macs. Gated-delta work is roughly 2.6–2.7% of M4 complete prefill, so it is not the principal bottleneck. M1 instrumentation perturbs larger runs. A chunkwise/scan formulation remains Lab because changing reduction order requires a separate quality contract. | None. | `upstream/sources.json` | Attribution is accepted; prioritize the measured expansion/projection/attention costs. A later chunkwise Metal arm needs same-input recurrent-state and held-out quality checks before any adoption. | Not applicable; never opened. |
2195
+ | R11 | Affine QMV/QMM and native builds | **Inconclusive.** Shared-M affine kernels won M4/8 (and M3/5/6/7 4-bit, compact 3/8-bit) in six full-model pairs and six HTTP pairs per configuration with exact outputs and flat B1; cross-model, Gemma 12B large projections win while MiniCPM/Llama regress; a compiled-call cache was closed. MLX 0.32.2 (native pack 0.4.0) superseded it: upstream `qmv_wide` implements the same reuse with different arithmetic, so the custom kernel and its flag were removed (§7.12); frozen source controls keep it. New-core affine Q3 gate/up operations beat the old shared ops in all six blocks, Q4 mixed, Q8 loses (operation level); RTN4 short decode flat, long-prefill timing order-dependent; twelve RTN4 oracle cells and 4K/8K prompts byte-exact on both cores. No end-to-end Qwen gain from the runtime change is established. | Native pack 0.4.0 (MLX 0.32.2) is the pinned runtime; no flag. | `affine-qmv-screen.json`, `affine-qmv-compiled.json`, `affine-shared-m-probe{,-initial}.json`, `affine-shared-m-debug-scale-bits.json`, `affine-shared-m-full-model-{packed,rtn4}-review.json`, `affine-shared-m-http-rtn4-review.json`, `affine-shared-m-production-full-model-rtn4-review.json`, `affine-shared-m-shapeless.json`, `affine-shared-m-integrated-unit.txt`, `affine-shared-m-integrated-http-rtn4-review.json`, `affine-shared-m-width-{rtn4,full-model-rtn4}-review.json`, `affine-shared-m-all-bits-*.json`, `affine-shared-m-broader-*`, `shared-affine-frontier-http-{rtn4,compact}-review.json`, `affine-compiled-call-cache-{full-model,http}-compact-review.json`, `affine-shared-cross-model-exactness.json`, `affine-shared-cross-model-{gemma12,gemmae4b,minicpm5,llama1,llama3}-review.json`, `affine-cross-model-matrix-{inventory,screen,screen-review}.json`, `affine-cross-model-matrix-gemma12-repeat.json`, `affine-head-batched-decode-mfirst-{llama1,llama3}-review.json`, `affine-shared-head-http-{llama1,llama3}-overlap-review.json`, `affine-large-projection-*.json`, `affine-nonfast-*-review.json`, `mlx-upgrade-0.32.2/affine-{old,new}-screen.json`, `mlx-upgrade-0.32.2/affine-runtime-repeat{,-review}.json`, `mlx-upgrade-0.32.2/runtime-oracle-rtn4{,-macos14}.json`, `mlx-upgrade-0.32.2/runtime-oracle-long-macos14.json`, `mlx-upgrade-0.32.2/native-runtime-screen{,-review}.json`, `mlx-upgrade-0.32.2/final-source-gates.json` | Quiet-machine six-pair old-core vs 0.32.2 `bench-serve all` on the RTN4 artifact with the same-artifact mlx-lm arm, to separate the runtime change from kernel changes. | A native pack bump, or MLX changing `qmv_wide` eligibility for GQA6/D256 or Q8 shapes. |
2196
+ | R12 | Norm/residual/activation/projection fusion | **Measured loss.** Residual-add/RMSNorm kernel (90 synthetic cases exact; six packed pairs at M1/4/8/128): M1 slightly slower, M4/8 flat, M128 varies. Fused affine gate/up/SwiGLU with the typed sigmoid (48 RTN4 cells exact): only M=1 wins in isolation, full-forward gain too small. Multimodal RoPE shared angles/direct strides (108 cases exact): M128 slightly slower, M512 flat, image encoding excluded. None integrated; helpers removed. Full-attention output-gate and QKV concatenation fusions were enumerated but not prototyped. | None. | `residual-rms-screen-scalar-review.json`, `residual-rms-full-model-packed-review.json`, `affine-gateup-debug{,-typed}.json`, `affine-gateup-typed.json`, `affine-gateup-full-model-review.json`, `mrope-reuse-screen-review.json`, `mrope-stride-full-model-packed-review.json` | None until per-kernel attribution shows elementwise/norm dispatches exceed 3% of the decode critical path. | Attribution evidence as above, or a real vision-request benchmark for mRoPE. |
2197
+ | R13 | Attention and KV | **Adopted for TurboQuant decoding.** Joint TurboQuant K/V packed decode plus row-grouped inverse rotation at N≥8192: six 8,846-token HTTP blocks on R6 k8v3 improve decode 83.87% and complete time 12.77% versus the original codec, inverse rotation adds 5.39%/1.05%; on MLX 0.32.2 the inverse improves decode 4.69% (R6) and 5.98% (RTN4) in every pair, R6 complete -0.79% all six, RTN4 complete inconclusive; six MiniCPM and six Gemma deferred-consumer pairs improve complete time. Direct packed-key attention is exact but 6–19% slower than joint decode plus native SDPA (closed). Dense register-resident attention loses timing; Steel D256 fails one KL screen (Lab). KV append census: ordinary appends copy only the new row, rejecting the whole-cache-copy hypothesis; no append kernel. bf16-KV rows are unaffected. TurboQuant now composes with shared ordinary and speculative rows, including the accepted long cached/SSD run. | `MLX_BUN_TURBOQUANT_FUSED_DECODE` defaults on; `=0` retains the unfused control. Cache quantization remains an independent opt-in; details in turboquant.md. | `tq-value-*{,-review}.json`, `tq-kv-screen.json`, `tq-kv-independent.json`, `tq-kv-repeat{,-review}.json`, `tq-kv-full{,-review}.json`, `tq-kv-policy-http{,-review}.json`, `tq-kv-long-full{,-review}.json`, `tq-kv-rotation-{screen,repeat,rows-screen,rows-repeat,long,long-http}{,-review}.json`, `tq-kv-rtn4-full{,-review}.json`, `tq-kv-nonfinite.json`, `tq-kv-minicpm-full{,-review}.json`, `tq-kv-gemma-e4b-full{,-review}.json`, `tq-kv-integrated-*{,-review}.json`, `tq-kv-integrated-rtn4-http-acceptance.json`, `tq-kv-memory{,-review}.json`, `allocator-capacity-repro.json`, `tq-kv-inverse-integrated-r6-full{,-review}.json`, `mlx-upgrade-0.32.2/{r6,rtn4}-kv-inverse-full.json`, `mlx-upgrade-0.32.2/inverse-kv-http{,-replacement,-review,-isolation}.json`, `mlx-upgrade-0.32.2/deferred-kv-http{,-review}.json`, `tq-key-sdpa-screen.json`, `tq-key-sdpa-complete-repeat{,-review}.json`, `steel-attention-tune-manifest.json`, `attention-cpu-check.json`, `attention-oracle-check.json`, `attention-full-model-packed-128-512-review.json`, `dense-attention-memory-tune-review.json`, `kv-append-donation-probe{,-review}.json`, `kv-append-model-trace-2049{,-review}.json`, `kv-append-http-text-census{,-review}.json`, `kv-append-native-8193{,-review}.json` | The combined pressure gate is complete on both Macs. Current default shared off/default comparisons pass on M1 MiniCPM and M4 packed Qwen/MTP3; cached complete time improves in both orders, with mixed short-Qwen timing documented in benchmarks.md. The earlier native, six-pair serial and deferred-consumer gates remain accepted; no unchanged gate needs repeating. | MLX ships fused quantized SDPA for GQA6/D256, or a new codec shape/model exposes a numerical or complete-request regression. |
2198
+ | R14 | Vocabulary head and sampler | **Adopted normalized greedy kernel; other candidates remain characterized separately.** Same-input model/operation checks pass on both Macs. MiniCPM standard AB/BA throughput improves and packed Qwen MTP3/TQ stays effectively flat. **Inconclusive.** Compiled Metal grammar bitmask (`MLX_BUN_TOKEN_MASK=metal`) preserves mask bytes and sampled IDs at three vocabularies and beats the host loop in eight paired blocks, but six compact HTTP pairs at B1/B4 are inconclusive (B1 flat, B4 regresses under residual swap); host masking remains default. Top-p inverse-permutation removal is exact in 216/180 cases; Qwen packed serial six pairs +0.183% complete time (loss), Llama 1B -0.399%/-0.380% with six wins per lane; no production change. DSA sort keys reduced to uint32 are integrated as a shared-operation win (selection latency -10.47..-15.80%), not a Qwen result. Grouped greedy verify readback closed (R21). The exact fused matvec/argmax head was never prototyped. | Shared normalized greedy selection is the default. Grammar-mask Metal selection remains opt-in; DSA uint32 keys are integrated. | `token-mask-probe.json`, `token-bitmask-unit.txt`, `token-bitmask-grammar-metal.txt`, `token-mask-sampling{,-review}.json`, `grammar-mask-http-compact-review.json`, `top-p-scatter-screen-v2{,-review}.json`, `top-p-scatter-compiled-screen{,-review}.json`, `top-p-lifetime-{source,native,scatter,metal}.json`, `top-p-sampler-screen-v2{,-review}.json`, `top-p-native-screen{,-review}.json`, `top-p-http-screen{,-review}.json`, `top-p-http-r6-serial-repeat{,-review}.json`, `top-p-http-llama-repeat{,-review}.json`, `dsa-order-u32-{screen,repeat}{,-review}.json`, `dsa-rank-u32-{screen,repeat}{,-review}.json`, `dsa-model-screen.json`, `dsa-rank-u32-model-tests-v2{.txt,.transform.json}`, `dsa-production-{unit-v2,typecheck-v2,model-free,hygiene}.txt`; `reports/prefill-observation/sampler-*` | Quiet-machine six-pair grammar-mask host vs metal at B1/B4 on a structured-output fixture (the only open candidate with a positive operation result). | Head attribution shows the vocabulary projection or readback material for greedy requests. |
2199
+ | R15 | Deterministic no-verification replay | **Repeatable win (opt-in).** Strict fill has parser-state guards (complete `</parameter>` delimiter, request-local tool-only context), a schema open-object compiler fix, and model-owned four-token append chunks that reproduce M1 arithmetic via broadcast `[M,1,K]` weight views and split at MLX attention transitions (KV 1023/1024/8192/32768/65536 on `applegpu_g16s`). Final internal-SSD comparison: twelve balanced pairs, 96 exact responses, zero verification; complete time -9.83%/-15.40% (R6 weather/bash) and -1.63%/-2.94% (RTN4), every pair improving; tool output is buffered so this is not a decode-rate result. Staged-body prototype flat, closed. Quantized-KV composition: TurboQuant k8v3 passes after a lease fix, affine KV4/KV8 now preserve complete state after one-token attention is retained within shared projection appends. The qualified model binding declares KV4/KV8 and K8V3 support; delayed conversion passes real-generation state checks. Both quants retain exact HTTP responses in six-pair affine and TQ comparisons. Saved tool-history fixtures pass 20 affine pairs; held-out task quality and quantized verification remain separate. Shared strict fill now composes the common preparation, sampler, row state and RAM/SSD cache. Its qualified B1 append, delayed precision transitions and B2 retirement into B1 pass full hidden/cache/continuation checks; wider rows preserve one-position arithmetic. Six M4 HTTP arms complete 108 responses with exact paired outputs/counts/cache coverage and durable SSD restarts. The sequential fixture total improves 13.50%/13.57% against shared fill-off and remains within 0.13% of serial strict fill; concurrent latency tradeoffs remain. See benchmarks.md and reports/prefill-observation/shared-fill-http*.json. | `MLX_BUN_FILL=strict`, `MLX_BUN_FILL_APPEND_CHUNK_SIZE=0` (model limit), `MLX_BUN_FILL_MAX_SPAN=32`; default off. | `fill-parser-boundary-r6.json`, `fill-boundary-tokenizer-audit-v4.json`, `fill-boundary-cpu-tests-v8.log`, `fill-boundary-native{,-m1,-batch1,-batch1-v2-rtn4}-r6.json`, `fill-first-layer-{shape-probe,batched-m1}.json`, `fill-boundary-http-{screen,repeat,review}.json`, `fill-append-*.json`, `fill-append-final-model-free.log`, `fill-append-state-ownership-native-test.log`, `fill-schema-*`, `strict-fill-variant{6,7}.txt`, `strict-fill-v1{0,1}-cap{32,4}-served-eos.json`, `fill-adversarial-state-v12-eos-review.json`, `fill-state-v12-cap{32,4}-{eos,seed42}.json`, `fill-identical-input-append-review.json`, `fill-chunked-*-review.json`, `fill-integrated-{state-v12-seed42,http-packed}-review.json`, `fill-chunked-integrated-{unit,model-free,typecheck,hygiene}.txt`, `fill-staged-unit.txt`, `fill-staged-state-v13-seed42-review.json`, `fill-staged-complete-requests-review.json` | Frozen held-out real-session/adversarial corpus through `MLX_BUN_TEST_FILL_MODEL=<dir> MLX_BUN_FILL=strict bun test tests/parity/fill-strict.test.ts` on both quants (token IDs, stop decisions, subsequent logits/state), then a quiet six-pair HTTP repeat. | A Qwen tool-template or parser change, tool schemas with pattern properties, or a chunk-limit qualification on another GPU. |
2200
+ | R16 | MLX graph and loop | **Earlier output adopted.** Early first token in the serial loop: six native pairs improve first-token latency at 6/128/512 tokens with exact tokens/state/usage; six chat HTTP pairs (84 requests, 42 exact) improve first visible output with complete time flat; raw prompts show no client gain because token 220 emits no event. The suffix screen finds a prefill-shape effect after a one-token return (seven packed/six RTN4 cases change state); explicit M=1 alignment restores exactness. The final caller-owned alignment passes both-machine state/continuation checks and monitored M4 serving comparisons; first visible output improves with complete time close. Closed: shape-specific compiled-call cache, Metal launch-config cache (MiniCPM HTTP mismatch unresolved), untouched-finalize elision (-0.069%), submission/traversal limits for Qwen (Llama 25/25 gives -2.44% native and -1.86..-3.02% HTTP, diagnostic, not integrated), fixed-input proxies, per-layer graphs (RTN4 fails identity), whole-model graph (slower), SSM-group compilation (-0.06%/-0.20%). Shapeless custom kernels are an upstream MLX limitation. | `MLX_BUN_EARLY_FIRST_TOKEN` defaults on; `=0` retains the old output order. | `first-yield-*`, `first-token-production-long-{serial,continuous}{,-review}.json`, `first-token-lifecycle-{llama,qwen}{,-review}.json`, `affine-compiled-call-cache-{full-model,http}-compact-review.json`, `metal-config-cache-*`, `mlx-untouched-finalize-source-manifest.json`, `untouched-finalize-*`, `graph-schedule-screen-plan.json`, `graph-schedule-screen{,-review,-contamination}.json`, `graph-schedule-rtn4-rescreen-v2{,-review}.json`, `graph-schedule-llama-repeat{,-review}.json`, `graph-schedule-llama-http-repeat{,-review}.json`, `mlx-upgrade-0.32.2/custom-kernel-compile-probe.json`, `mlx-upgrade-0.32.2/fixed-custom-probe.json`, `mlx-upgrade-0.32.2/qwen-fixed-region-{r6,rtn4}-v{2,3,4}.json`, `mlx-upgrade-0.32.2/qwen-fixed-layer-{r6-full-v2,rtn4-full}.json`, `mlx-upgrade-0.32.2/compiled-region-probe.json`, `mlx-upgrade-0.32.2/qwen-fixed-hidden-regions-{r6,rtn4}.json` | Early-output native, HTTP, cancellation/overlap and cached/SSD acceptance is complete; see benchmarks.md for monitored repeats and activity limits. The MLX 0.32.2 submission screen is complete: retain upstream startup defaults, with the measured M4 Llama override available explicitly. The current native API has no model-scoped setter; revisit integration if that interface becomes available. See benchmarks.md for the cross-model results and activity records. | MLX adds shape-inferring CustomKernel or graph replay, or per-token host-overhead attribution changes. |
2201
+ | R17 | Hybrid prefix and recurrent state reuse | **Implemented and accepted for generated reuse.** One cache owns immutable target/recurrent state and draft companions, original generated token IDs, session/content lookup, RAM residency and queued SSD persistence. Native and HTTP checks cover continued mutation, cancellation, earlier-boundary fallback and fresh-process restoration on both Macs. The saved Kanban miss/OOM sequence passes with identical output; the completed session-cache Kanban run hits every follow-up and flushes all snapshots durably. Its app-quality defects remain separate from cache acceptance. | Shared RAM/SSD publication and generated-token provenance are enabled; whole-file SSD and LRU remain selected after measured alternatives. | `reports/kanban-cache-fixed-fresh/`, `reports/kanban-cache-fixed-repeat-r1/`, `reports/kanban-session-cache-r2/`; [cache implementation](kv-cache.md#54-background-persistence-and-ram-residency) and [measured task comparison](../reference/benchmarks.md#full-kanban-with-session-cache-and-queued-persistence). | No missing generated-history implementation. Reuse the completed native/HTTP and full-task evidence; do not rerun unchanged gates. | A reproduced history-alignment, retention, durability or reuse regression. |
2202
+ | R18 | Scheduler | **Early output and shared batching adopted.** Continuous-scheduler early yield (same `MLX_BUN_EARLY_FIRST_TOKEN` flag): six AB/BA blocks, 84 responses, 42 exact, median TTFT -7.66% code / -7.90% explanation / -5.63% JSON (74–77 ms) with complete time +0.04..+0.15%; the integrated one-block check gives -68..-90 ms; 120 streaming cancellation/arrival requests pass on both quants and lanes. Concurrency evidence for kernels: v6 vs v12 four-request waves improve every pair and the tile pass improves eight-request throughput (R1). The historical four-request kernel waves predate shared cohorts. B-wide prefill is now adopted, and current default serving uses shared ordinary/speculative execution; mixed iteration work is measured and remains off. Two opposite-order fixed-arrival repeated-wave comparisons now preserve all 84 paired outputs and improve aggregate throughput at loads two/four/eight. First-request completion and stream gaps retain a tradeoff; see benchmarks.md. Longer steady-state capacity remains separate. | Early first output defaults on; `MLX_BUN_EARLY_FIRST_TOKEN=0` retains the control. | `first-prepare-scheduler-{control,candidate}.txt`, `first-prepare-http-screen-plan.json`, `first-prepare-http-{screen,repeat}{,-review}.json`, `first-prepare-production-{unit,model-free,typecheck,hygiene}.txt`, `first-prepare-production-http-r6-v2{,-review}.json`, `first-token-lifecycle-{llama,qwen}{,-review}.json`, `trellis-concurrent-http{,-review}.json`, `trellis-tile-http-review.json`, `trellis-scatter-integrated-cohort-v2{,-review}.json` | The fixed-arrival repeated-wave cell is complete with preserved outputs and documented latency tradeoffs. Longer stationary capacity remains a distinct measurement; do not repeat the accepted wave test without a relevant source change. | A change to admission, mixed-work scheduling or output/cache boundaries. |
2203
+ | R19 | Weight-quality allocation | **MLP cost/allocation screen complete; quality acceptance open.** Actual k2/k3/k4 fused gate/up and down costs are measured at M1/M3/M4/M16 on both Macs in forward/reverse order. All 228 unchanged-reader checks match. A discrete size-constrained objective runs 64 machine/row/latency-weight cells; zero weight reproduces k300 exactly. Modest latency weight finds little estimated decode headroom. Aggressive M1-prefill proposals trade more external-codec sensitivity loss for time. Those losses are ranking proxies, not Trellis quality. No candidate is quantized or promoted. Existing Q3 and lossless-interleaving quality evidence remains unchanged. | Keep the existing artifact. | `reports/prefill-observation/r19-cost/`; benchmarks.md latency-aware MLP allocation screen | Teacher-based quantization and frozen KL/MMLU/tGSM/rawGSM screens; non-MLP allocation and calibration/rounding choices remain open. Checked primary model directories lack a complete original Qwen bf16 snapshot; promoted bits cannot be recovered from k300. | No measured full-model speed or quality claim from the proposal cost model. |
2204
+ | R20 | MTP economics | **Repeatable win (opt-in).** Six balanced three-arm blocks versus native full-prefill on the packed artifact: fixed two drafts change complete time -43.22%/-38.81%/-44.92% (code/explanation/JSON) with every pair improving, TTFT -5.5..-8.4%, peak RSS +653 MiB; RTN4 -34.95%/-26.95%/-38.48%. Adaptive one-to-three drafts adds about 3% (ratios 0.9698/0.9782/0.9624) and stays research-only. Folded 4-bit/8-bit MTP heads: -1.48/-3.67/-2.95% and -0.65/-2.29/-1.86% with peak RSS 12.53/12.74 vs 13.04 GB; 1,184 vocabulary rows and 48 state samples byte-exact against serial replay. EOS and finish-reason accounting fixed. The quiet M1 Max control (0.821x at gamma 2, 2026-08-18) predates the kernel work. Shared serving has short depth-2/3/4 comparisons, native depth-3 coverage and completed late-context MTP1/2/3 controls. Current KV4/MTP2 and fused K8V3/MTP3 both pass the 78,678-token cached/SSD workload. KV4/MTP2 remains the measured long-agent recommendation; depth 3 crosses a different KV4 value-product dispatch boundary. See benchmarks.md. | `--draft-kind mtp --num-draft-tokens 2` opt-in; EOS/finish-reason fixes landed. | `mtp-v*-gamma*.json`, `mtp-corpus-screen/`, `mtp-screen-prompts.json`, `mtp-heldout-{plan,http,http-review}.json`, `mtp-heldout-native{,-review}.json`, `spec-token-counts-*.txt`, `mtp-post-eos-http{,-review}.json`, `spec-eos-serving-*.txt`, `mtp-eos-budget{,-integrated}-http{,-review}.json`, `spec-eos-continuous-*.txt`, `eos-budget-continuous{,-v2}-http{,-review}.json`, `mtp-quantized-draft-*-http{,-review}.json`, `mtp-draft-artifact-q4-{build,audit}.json`, `mtp-draft-quant-oracle.json`, `mtp-draft-artifact-q8-build.json`, `mtp-quantized-loader-*.txt`, `mtp-artifact-ownership{,-v2}.json`, `mtp-artifact-{screen,repeat}-http{,-review}.json`, `mtp-artifact-native{,-context}{,-review}.json`, `mtp-artifact-context-screen-http.json`, `mtp-matched-prefill-{r6,rtn4}-{screen-http,repeat}{,-review}.json`, `mtp-rtn4-screen-{plan,http,http-review}.json`, `mtp-rtn4-divergence-v2-audit{,-review}.json`, `mtp-rtn4-prefill-control{,-review}.json`, `mtp-v10-{planets,prose}-gamma{2,3}.json`, `mtp-provider-dispose-{before,after}.json`, `mtp-provider-ownership-tests.txt`, `mtp-post-dispose-http.json` | Late-context KV4 depths 1/2/3 and ordinary controls are complete; the current ordinary cached-repeat failure is resolved. TQ/MTP3 passes the original context, RAM repeat and SSD restart. Current-source KV4/MTP2 and automatic prefill sizing pass; KV4/MTP2 remains the measured agent recommendation. | Any change to verify-window arithmetic (KV4 head pairing, fused KV) or a DFlash2 drafter (R21). |
2205
+ | R21 | Other exact speculative sources | **Shared lookup implemented; DFlash2 unimplemented.** Qwen DFlash2 (the z-lab artifact behind the oMLX record the video cites; block size five, native MTP off) needs dynamic grouped causal convolutions around attention and MLP plus a top-16/rank-256 selector; the existing DFlash provider does not implement that architecture, so loading the checkpoint would not be DFlash2. Grouped greedy verify readback is closed: six three-arm blocks, 84 exact comparisons, concatenation improves only 0.33%/0.06%/0.23% and the evalAll variant regresses JSON 0.44%. Prompt lookup is now adopted through the shared variable-proposal verifier, with both-machine bf16/KV4/KV8/TQ B4 serving, generated RAM/SSD and MTP regression checks. M4 arm orders show small single-request gains and lower aggregate throughput with changed concurrent outputs; it remains optional. The DSpark/DFlash execution provider has seeded-fixture coverage, but no trained checkpoint exists. This does not implement DFlash2. SpecPrefill remains a separate approximate Lab arm. | Shared prompt lookup is available; trained-drafter performance remains unmeasured. | `video-dHK90xc9Q64/`, `video-dHK90xc9Q64/dflash-source-manifest.json`, `spec-grouped-greedy-screen.json`, `spec-grouped-greedy-eval-screen.json`, `spec-grouped-greedy-three-http{,-review}.json` | Missing resource: a DFlash2 architecture/selector port with target-state/rollback identity and draft residency, then a three-arm block (ordinary / fixed-two MTP / DFlash2) on the held-out prompts. | The port exists, or an exact n-gram source shows at least 3% on the saved Kanban history. |
2206
+ | R22 | Residency and shared memory | **mmap loss; range-construction improvement.** Page-aligned file-backed weights through Metal roots are exact in every payload/output case, but six native pairs give +0.25% (later +0.02%) on 64-token generation with no faster pair, six serial HTTP pairs +0.04..+0.14% complete and +0.14..+0.21% decode, and the balanced cold-start follow-up is worse in five of six pairs (+18.42% first token, +12.93% first generation). Peak RSS falls from 12,182,749,184 to 482,508,800 bytes as file-backed accounting only; physical RAM saving unproven. A read-only donation hazard was found and fixed in the prototype before closing; helpers removed. Retained as memory correctness, not speed: the 8 MiB bounded range cache in `mlx/ops.ts` (Kanban sustained run peak active -1,582,612,480 bytes, +2.171% time in one pair) and per-chunk draft-KV evaluation. | Native long position ranges reduce operator/host-allocation work without a material model/serving speed claim; bounded range cache and per-chunk draft-KV evaluation remain memory fixes. | `mmap-page-window{,-pointer}-screen.json`, `mmap-weights-native-{llama1,packed}-screen.json`, `mmap-weights-native-packed-paired{,-review}.json`, `mmap-weights-http-serial{,-review}.json`, `mmap-weights-ownership-packed{,-mapping}.json`, `mmap-weights-single-consumer-lazy{,-mapping}.json`, `mmap-weights-whole-consumer-lazy.json`, `mmap-whole-consumer-source-integrity.json`, `mmap-donation-{ro,cow}-screen.json`, `mmap-managed-donation-screen.json`, `mmap-weights-managed-whole-consumer-lazy{,-mapping}.json`, `mmap-managed-submitted.json`, `mmap-weights-managed-native-{repeat,screen}{,-review}.json`, `mmap-initial-residency-attribution.json`, `mmap-lazy-view-ownership.json`, `mmap-weights-lazy-managed-native-screen{,-review}.json`, `mmap-prefault-native-screen.json`, `mmap-cold-native-repeat{,-review}.json`, `mmap-managed-shard-release{,-mapping}.json`, `mmap-managed-active-accounting-review.json`, `kanban-arange-{allocation-evidence,regression,micro-memory,reconstruction}.json`, `kanban-sustained-77k-owned-control.json`, `kanban-sustained-arange-comparison.json` | Native long int32 positions are accepted as an operator/host-allocation optimization after exact range/view/bound checks, six monitored M4 complete-forward pairs and two standard serving arm orders. Model and serving performance are effectively flat; the initial unmonitored regression is not reproduced. A reusable power-of-two prefix remains unselected after an inconsistent M1 screen. See benchmarks.md for activity records and limits. | A controlled page-cache-cold startup cell (§7.10) exists; mmap lost warm but cold was never controlled. |
2207
+ | R23 | Media and task completion | **Inconclusive.** The fresh Pi Kanban task on the 12.14 GiB packed target with Luke's `qwen3.8-27b-q3_k_xl-coding-128k` profile (131072 context, xhigh thinking, temperature 0.6, seed 42; KV4, MTP depth 2, paired prefixes, MLX 0.32.2) completed in 3h 33m 7.685s with 130,494 output tokens over 62 requests, 79.706% draft acceptance, 11.916 GiB peak combined RSS; the untouched app passes the functional browser checks. Earlier attempts failed on a tool-parser bug, dropped reasoning history, Metal OOM at the 85,238-token request and OOM during sustained decode. The later accepted R17 session-cache Kanban run completes in 83m57s with 76,031 output tokens, every follow-up cached and durable final persistence; its two application defects remain recorded. The automatic-prefill task misses the app-quality target, while the completed fixed-256 integrated control meets it and reproduces the earlier initial response. Keep the task-comparison profile fixed; results and browser evidence are in benchmarks.md. No matched successful original-source run exists, so these different trajectories cannot supply an engine-only task-time speedup. Gemma image/audio shared execution now passes both-machine native/HTTP and monitored M4 ABBA comparisons with all 78 paired responses/counts unchanged; concurrent gains and individual latency costs are recorded in benchmarks.md. Qwen image/video shared execution also passes both-machine source/group/HTTP and M4 ABBA checks; full usage matches, while changed concurrent geometry changes some text. Qwen encoder objects now reuse the shared RAM/SSD cache, with both-machine native/HTTP, fresh-process SSD and M4 source-controlled timing acceptance. First-use weight hashing costs more; repeated images improve with exact responses/usage. Gemma encoder reuse also passes both-machine identity/HTTP and M4 ABBA/fresh-process SSD acceptance, with all 168 paired responses/usage exact and repeated-request gains. Gemma and Qwen generated media KV reuse now pass both-machine native/HTTP, fresh-process SSD and M4 ABBA comparisons. The shared media-prefix option is selected by default; output and precision boundaries remain documented. | Tool-parameter parser and `reasoning_content` alias landed as correctness fixes; no speed default. | `lukes-kanban/`, `kanban-final/optimized-mtp-invalid-32k-sleep/`, `kanban-final/luke-q3-128k-xhigh-{history-fixed,tool-values-fixed,mtp-memory-fixed,arange-bounded}/`, `kanban-final/comparison.html`, `kanban-capacity-110k-control.json`, `kanban-capacity-8k-final-comparison.json`, `kanban-capacity-110k-owned-final.json`, `kanban-memory-http-{owned,responsiveness}.json`; numbers in benchmarks.md Kanban sections | The requested integrated fixed-profile task is complete. An original-source run is needed only for an engine-only task-time claim; no such ratio is claimed. Gemma image/audio shared serving acceptance is complete. Qwen image/video shared serving acceptance is complete with documented geometry and latency limits. Qwen encoder-cache acceptance is complete. Gemma encoder-cache acceptance is complete. Prepared Gemma/Qwen media-prefix reuse is accepted through the same cache interfaces. Chunked media prefill and wider configurations remain separate work. | No engine-only task-time ratio without a matched baseline. R17 generated-history acceptance is complete and does not need another unchanged task run. |
2208
+ | R24 | Larger departures | **Inconclusive.** Feasibility and operation screens exist. For the video's tq3-mini codebook format (eight-centroid indices, ten codes per uint32, 3.2 bits/value), the literal upstream `polar_qmv` through the Bun binding on synthetic matrices: explicit SIMD shuffles cut the 5120-to-17408 rotated operation 2.77–3.84% (every pair), and a fused fp16 expansion cuts large-prefill operation time 40.85–57.51% with about 765 MiB less temporary allocation. No production loader or kernel, no quality evidence; the checkpoint's reported agent failures are unresolved. Section 7.14 now records kernel, quality, memory and potential-benefit requirements for those candidates. A both-machine same-weight native activation-quantization screen is a measured loss; static size/training bounds are recorded. Actual-weight unweighted low-rank and sparse-residual screens now reject their simple variants. Packed forwards fail differentiation without a custom VJP; the expanded frozen-weight control succeeds. Calibrated quality and packed backwards remain open. | None. | `video-dHK90xc9Q64/`, `polar-qmv-screen-v2.json`, `polar-qmv-variants.json`, `polar-qmv-geometry.json`, `polar-qmv-repeat{,-review}.json`, `polar-expand.json`, `polar-expand-repeat{,-review}.json` | Next: activation-calibrated candidates and an explicit packed backward operation, if pursued after the measured simple-variant losses. The tq3-mini format still needs a loader and actual-checkpoint KL/MMLU/tGSM/rawGSM before a model claim. | An artifact with quality evidence at or below Q2b bytes, or the operation gains reproduced whole-model. |
2209
+
2210
+ Josh's original direction is to "only ask the model to decode tokens that we
2211
+ can't reasonably already know." This includes reasoning snippets copied into
2212
+ tool arguments, repeated atomic values such as URLs, and predictable tool JSON
2213
+ structure and field order. The goal is deterministic continuation wherever the
2214
+ application can establish the text, with known-text proposals where the model's
2215
+ choice remains uncertain. Prefix-cache reuse avoids rereading history; it does
2216
+ not by itself avoid generating the same text again. Strict appends and verified
2217
+ copy proposals have different behavior contracts and must be measured as such.
2218
+ Josh deferred the broader deterministic-continuation investigation. Generated
2219
+ state reuse is active R17 work and comes first; it is part of the original
2220
+ cache objective, not completion of the broader continuation direction.
2221
+
2222
+ The R17 closeout audit confirms a reusable generated prefix in the saved
2223
+ first tool turn: the first response's reasoning text tokenizes as an exact
2224
+ extension of the original prompt inside the next rendered request. This is
2225
+ textual opportunity evidence only, not an accepted recurrent-state snapshot
2226
+ or a timing result. See `reports/qwen38-closeout/r17-first-tool-prefix-opportunity.json`.
2227
+ A candidate must retain aligned target KV/recurrent state, draft KV and the
2228
+ pending true hidden row at a completed decode boundary before tool formatting
2229
+ can diverge. Preserve the original prompt snapshot as a fallback within the
2230
+ existing cache budget. Test with independent prompts and verify snapshot
2231
+ identity after further decode; saved task timings cannot substitute for that
2232
+ state test. Quantities and original task timings belong in benchmarks.md.
2233
+
2234
+ R17 uses the existing tiered cache. `createMlxSerialExecutor` now passes its
2235
+ shared cache service into speculative execution. `QwenMtpProvider` supplies a
2236
+ checkpoint codec and retains no prefix store of its own. Prefill publishes
2237
+ paired target/draft state through `PromptCache.take`/`put`; processed output
2238
+ publication remains unfinished. `PromptCache` owns RAM/SSD prefix selection,
2239
+ eviction and write-behind persistence. The execution-state interface must capture, restore and serialize a
2240
+ complete token-prefix checkpoint, regardless of whether those tokens came
2241
+ from a prompt or generated output. Qwen MTP supplies its target KV/recurrent
2242
+ state, draft KV and pending hidden row through that interface; it must not
2243
+ grow a second storage policy.
2244
+
2245
+ The first implementation step now gives ordinary and batched consumers the
2246
+ same `PrefixCache` contract. MLX companion tensors flow through the existing
2247
+ RAM budget, spill queue, streamed SSD writer/reader and durability coordinator.
2248
+ The new storage tests pass on M1 Max and M4 Pro, including a fresh-process
2249
+ restore; layout and ownership details belong in [kv-cache method companion state](kv-cache.md#method-companion-state).
2250
+ Qwen MTP prefill migration now passes native bf16/KV4 RAM and SSD restart
2251
+ continuation gates on both Macs. Live target/draft/hidden hashes, emitted IDs
2252
+ and acceptance decisions match after reuse; the cache/provider restart also
2253
+ checks stable draft identity. Raw gates are in
2254
+ `reports/qwen38-closeout/composition-baseline/{m1,m4}-shared-mtp-cache-*.log`.
2255
+ Generated-ID alignment, native fresh-process continuation and saved-request
2256
+ performance acceptance remain unfinished.
2257
+
2258
+ A subsequent isolated output-checkpoint candidate resolves the final verified
2259
+ round and publishes only processed content. Synthetic stop/EOS/callback cases
2260
+ pass. Generated-prefix SSD continuation matches fresh recomputation on M1 Max
2261
+ in bf16/KV4 and on M4 Pro in KV4. M4 bf16 preserves checkpoint bytes but changes
2262
+ the next argmax; a fresh split-prefill control also changes logits. The cause
2263
+ is not yet established against a matched execution/oracle control, so this
2264
+ candidate is not adopted. Evidence: `composition-baseline/m*-mtp-generated-reuse*.log`
2265
+ under `reports/qwen38-closeout/`. Shared execution work continues independently.
2266
+
2267
+ A subsequent shared-method implementation publishes target-row and draft-provider
2268
+ snapshots through the common cache port before retirement. M1/M4 bf16/KV4/fused
2269
+ TQ native tests preserve actual processed-ID coverage and RAM/SSD continuation,
2270
+ including early stops and immutable donors after sibling/follow-up work.
2271
+ Production parser/template replay also preserves the sampled prefix of bounded
2272
+ tool turns with thinking off/on. Production HTTP RAM reuse and fresh-process
2273
+ SSD restoration now also pass on both Macs in bf16/KV4/fused TQ with thinking off/on;
2274
+ responses, logprobs and acceptance match within each restart pair. These
2275
+ results do not replace the long Kanban or performance gates. The five-file
2276
+ change is adopted; final native/HTTP composition with the prefill-policy fix
2277
+ and its matched short M4 benchmark now pass. Long Kanban and pressure
2278
+ acceptance remain. Details belong to the method-companion
2279
+ section in kv-cache.md; evidence is in the separate
2280
+ `generated-prefix-composition-validation` checkout's `reports/generated-prefix/`.
2281
+
2282
+ The pre-refactor source and measured-evidence hashes are preserved under
2283
+ `reports/qwen38-closeout/composition-baseline/manifest.json`. It distinguishes
2284
+ the current unmeasured working tree from the frozen source used for the M4
2285
+ comparisons. Baseline numbers and limitations remain in benchmarks.md. Keep
2286
+ interface refactors, kernel experiments and the MTP depth comparison as
2287
+ separate changes before measuring their composition.
2288
+
2289
+ Acceptance must cover actual generated IDs at a rendered-stable boundary,
2290
+ continued generation after capture without changing the retained state, RAM
2291
+ reuse, eviction to SSD, a fresh-process SSD restore, and an exact-prefix miss
2292
+ that still selects a usable earlier checkpoint. Retain shorter recurrent
2293
+ boundaries because a later state cannot be trimmed back. Account for all
2294
+ companion tensors in the existing cache budgets and persistence lifecycle.
2295
+ Measure complete next-request time, including capture/write/restore cost;
2296
+ the saved work is not literally free. The current Kanban candidate remains
2297
+ frozen while this change is developed and supplies the pre-R17 task evidence.
2298
+
2299
+ The private `joshuarossi/kanban-board` archive was audited at
2300
+ `c34577fecbf5e1b4c48c13b14c7a7f92b92b6ba9`. Its first request and first SSE
2301
+ response are byte-identical to the original saved evidence. The archived
2302
+ second request changes two literal escape sequences inside reasoning from
2303
+ `\u0000` to `\^@`; this explains its earlier reconstructed-prefix divergence.
2304
+ Do not change either evidence copy or treat that archive difference as a Pi
2305
+ serialization defect. The original saved request retains the full reasoning
2306
+ prefix. Both comparisons retokenize decoded reasoning; the SSE has no original
2307
+ sampled IDs, so the execution-state gate must record those IDs directly.
2308
+ Evidence: `reports/qwen38-closeout/r17-repo-prefix-audit.json`.
2309
+
2310
+ #### Shipped defaults and remaining experiment gates
2311
+
2312
+ [Server configuration](../reference/server-config.md) owns effective defaults,
2313
+ precedence and supported combinations. Trellis v13, eligible KV4 speculation
2314
+ and paired MTP prompt reuse shipped in v0.4.0. Shared batching is the default;
2315
+ R17 generated RAM/SSD persistence and long-agent setting selection are accepted.
2316
+ Serial removal and exhaustive feature migration are deferred by the current
2317
+ milestone. Remaining experiments do not reopen those completed gates.
2318
+
2319
+ | Control | Accepted evidence | Remaining work |
2320
+ | --- | --- | --- |
2321
+ | `MLX_BUN_TRELLIS`, `MLX_BUN_TRELLIS_VARIANT` | Shipped selection; six serial, six continuous and six combined KV4/MTP pairs, plus native state gates. | Additional experimental variants retain their own numerical/performance requirements. |
2322
+ | `MLX_BUN_TRELLIS_ASYNC_EXPAND` | Native, repeated short serving and saved long-agent pressure checks pass, including fused k8v3/MTP3 on M4 and M1. | Keep opt-in for the measured small request-time gain and higher live allocation. Combined pressure is accepted; reopen only for new models/barriers or a better tradeoff. |
2323
+ | `MLX_BUN_EARLY_FIRST_TOKEN` | Streaming/cancellation/overlap and cached/SSD gates pass. Caller-owned M=1 alignment preserves state on M1 and M4. Monitored paired chat HTTP checks support earlier visible output; default on. | No open early-output acceptance gate. Invisible token zero need not improve raw-prompt latency; no decode-throughput gain claimed. |
2324
+ | `MLX_BUN_TURBOQUANT_FUSED_DECODE` | Adopted on by default for an explicitly selected TQ cache after native/state, repeated codec serving, long cached/SSD and combined pressure gates, plus current M1/M4 shared serving. | Explicit off control remains; distinguish codec-kernel gains from quantization-setting comparisons. |
2325
+ | `MLX_BUN_QWEN_SPEC_KV4` | Combined M4 pairs, completed tasks and the current 78,678-token cached/SSD workload pass. KV4/MTP2 remains the measured long-agent choice. | Three-query key-head grouping is integrated for the qualified M4 shape after operation, full-state and matched serving gates. Other geometries retain the existing dispatch. |
2326
+ | `MLX_BUN_MTP_PROMPT_CACHE` | Shared byte accounting, generated-boundary checkpoints, RAM/SSD restart and full Kanban session retention pass. | No open R17 acceptance gate; new methods retain their own state contracts. |
2327
+ | `MLX_BUN_FILL`, append chunk/span controls | Qualified Qwen committed appends preserve bf16/KV4/KV8/K8V3 state; balanced HTTP and saved tool-history fixture comparisons pass. | Held-out task quality, shared direct append, speculative/quantized verification and other model/GPU qualifications remain distinct cells. |
2328
+ | Fill trace and echo-index controls | Trace is diagnostic; echo is a separate Lab algorithm. | Disable trace for timing; measure echo task quality and whole-request cost before promotion. |
2329
+ | `MLX_BUN_RD_PREFILL_CHUNK` | Captured policy selects work size; explicit overrides remain. Automatic long hybrid prefill matches all 19 fixed-size responses through cached/SSD restart. | The completed fixed-256 integrated Kanban control reproduces the earlier first response and meets the app-quality target. Retain that task-comparison setting. The general automatic policy remains selected; one changed trajectory does not establish a general quality loss. |
2330
+ | `MLX_BUN_RD_CONTEXT_LIMIT` | Explicit caller constraint; fit estimates remain advisory. | Benchmark control, not a speed candidate. |
2331
+ | `MLX_BUN_TOKEN_MASK` | Exact structured-output responses; previous serving timing is inconclusive. | Controlled B1/B4 comparison if the mask implementation changes. |
2332
+ | `MLX_BUN_PREFILL_TAIL_SPLIT` | Existing policy explains recorded RTN4 ordinary/MTP trajectory differences. | Changing that policy requires a separate numerical/quality comparison. |
2333
+
2334
+ #### Closed candidates
2335
+
2336
+ Do not re-open without new evidence of the kind named in the row's reopen
2337
+ condition.
2338
+
2339
+ - Device f32 code LUT for variant-6 decode: slower at M=1 for every bit width (`lut6-*.json`).
2340
+ - Constant-address-space int16 codebook table: 0.802 vs 0.331 ms reduce; nearly 2x complete MLP on MLX 0.32.2 (`trellis-codebook*`, `trellis-constant-*`).
2341
+ - Device/threadgroup fp16 code tables at M=1/4: lose; threadgroup table retained only for M3/4 k3 scatter inside variant 13.
2342
+ - Integer y-mad final-sum rewrite: exact, no useful gain; readable expression kept.
2343
+ - Shared activation loads across 2/4/8 gate/up rows per SIMD group: loses at k3 M=1.
2344
+ - Row-loop unrolling of the aligned 3-bit scatter: no material gain.
2345
+ - Larger fused prefill tiles at M=128/512 (40 geometries): all exact, none beats expansion plus native matmul.
2346
+ - Contiguous packed reads with transposed threadgroup writes and threadgroup padding: slower; not retained.
2347
+ - Variant 9 unrestricted deferred expansion and unrestricted async submission: fail the saved-agent pressure gate (Metal insufficient memory); superseded by the bounded 75% policy.
2348
+ - M≤8 packed/expanded crossover: MLP win but changes output bytes; Lab, not in production dispatch.
2349
+ - fp16 storage as a Steel GEMM throughput shortcut: source audit shows float accumulation regardless; rejected.
2350
+ - Fused GDN convolution/SiLU/copied tail (R8): flat full-model timing; unpromoted.
2351
+ - GDN compiled fixed-length recurrence and fused recurrence/RMSNorm/gate kernels (R9): gains too small; not integrated.
2352
+ - Fixed-shape CompiledFunction over 16 SSM groups: -0.062%/-0.202%; no integration.
2353
+ - Fixed-input custom-kernel proxies, 64 per-layer cached graphs (RTN4 fails identity) and whole-model graph (slower): no production tracer manipulation.
2354
+ - Affine QMV layout screen (rows per SIMD group / groups per threadgroup): no accepted whole-model gain.
2355
+ - Shared-M affine kernels and `MLX_BUN_AFFINE_SHARED_M` (4-bit M3..8, compact 3/8-bit, nonfast large projections): superseded by MLX 0.32.2 `qmv_wide`; kernel and flag removed, frozen source controls retain them.
2356
+ - Shape-specific compiled-call cache around shared-affine kernels: HTTP gains shrink to flat; not integrated.
2357
+ - Broader cross-model 4-bit shared-affine prototype: MiniCPM/Llama regress; float16 head-only B8 variant <1% on 3B; not integrated.
2358
+ - Fused affine gate/up/SwiGLU: only M=1 wins in isolation; full-forward gain too small.
2359
+ - Residual-add/RMSNorm fused kernel: M1 slightly slower, M4/8 flat; not integrated.
2360
+ - Multimodal RoPE shared angles/direct strides: M128 slightly slower, M512 flat; closed.
2361
+ - Metal launch-configuration cache: Qwen flat, MiniCPM fails the serving response gate (cause unresolved); closed.
2362
+ - Untouched-finalize elision in the Metal backend: -0.069%/+0.108%; closed without integration.
2363
+ - MLX submission/traversal/sync settings for Qwen: no compelling setting (0.94% traversal gain matched the 0.92% default drift); Llama 25/25 remains an explicit process-start override after current-version cross-model and both-machine controls; no universal default is adopted. See benchmarks.md.
2364
+ - `MLX_METAL_FAST_SYNCH=1`: stalls the installed library's large bf16 three-stream case; not attributed to any prototype.
2365
+ - Top-p inverse-permutation removal (pure MLX and fused Metal): Qwen +0.183% complete; Llama -0.4%; no production sampler change.
2366
+ - Grouped greedy verify readback (concatenated and evalAll): ≤0.33% gain, JSON regression; closed.
2367
+ - Direct packed-key TurboQuant attention: exact, 6–19% slower than joint decode plus native SDPA; closed.
2368
+ - Fused inverse-Hadamard one-row layout inside the joint decoder: +12.76..+24.67% slower; only the row-grouped N≥8192 variant retained.
2369
+ - Dense register-resident attention (vLLM-Metal port): loses timing; Steel D256 fails one 512-token KL screen; Lab, unintegrated.
2370
+ - KV append whole-cache-copy hypothesis: rejected by native/HTTP census (one-row copies); no append kernel.
2371
+ - mmap file-backed weight loader (immutable, managed, lazy, prefault variants): warm flat-to-slower, cold worse in 5/6; closed as a performance candidate.
2372
+ - Staged-body strict-fill prototype (skip the discarded in-flight sample): flat; closed.
2373
+ - Multi-query affine attention inside strict append: recurrent state diverges at layer 4. Superseded by the qualified one-token attention calculation within shared projection appends; KV4/KV8 now pass state and serving gates.
2374
+ - Cross-entropy block-alignment partition: no wired model reaches a misaligned partition; closed without integration.
2375
+ - Streamed-expert threadgroup geometry: bf16 timing bimodal in all three library arms; no geometry default retained.
2376
+ - Proc-pid-rusage FFI collector: 0.0013 ms vs 1.09 ms per read, collector only; existing reports keep the ps collector.
2377
+ - Video tq3-mini polar format: operation wins on synthetic matrices; no loader, kernel or quality evidence; not adopted.
2378
+
2379
+
2380
+ ### 7.14 Larger-departure feasibility decisions
2381
+
2382
+ R24 now has an explicit initial screen. Resource calculations and the
2383
+ both-machine activation operation comparison live in
2384
+ [benchmarks](../reference/benchmarks.md#r24-activation-quantization-and-resource-bounds-2026-09-13).
2385
+ The following decisions apply to the current packed Qwen artifact and native
2386
+ pack. They do not close unmeasured candidate quality or claim the whole campaign
2387
+ is exhausted.
2388
+
2389
+ | Candidate | Kernel and quality requirement | Training/calibration and next decision |
2390
+ |---|---|---|
2391
+ | Learned/codebook quantization | [AQLM](https://arxiv.org/abs/2401.06118) learns additive codebooks. Existing Trellis dispatch and the archived polar operation screen do not establish a loader or efficient decoder for that representation. New codes must pass the frozen quality suite. | Fit one matrix/block with calibration under the calculated memory budget before any whole-model conversion. A complete original bf16 Qwen snapshot was not found in the checked model directories; fitting the current packed reconstruction must be labeled as an additional approximation. |
2392
+ | Sparse residual/outlier correction | [SpQR](https://arxiv.org/abs/2306.03078) separates exceptional weights from the low-bit representation. The sparse correction must fit inside savings from a lower-bit base and fuse with the target's matrix operation. | Bounded matrix reconstruction is feasible in principle; measure error versus bytes and sparse gather/reduction time first. Do not install a second dense correction matrix or assume CUDA speed transfers to Metal. Original-weight recovery needs original weights. |
2393
+ | Activation quantization | [SmoothQuant](https://arxiv.org/abs/2211.10438) motivates jointly quantized weights/activations. The pinned native QQMM rounds then expands activations. The actual same-weight operation screen loses, especially at prefill sizes. | Current QQMM is rejected as a drop-in speed option. A direct compressed-activation kernel remains a separate implementation and quality experiment; INT8 input alone does not supply it. |
2394
+ | Structured pruning | Zero values in the existing packed format still consume codes and matrix work. A useful artifact must physically remove aligned channels/heads and update model dimensions. | Rank channels with calibration, then test one width-reduced MLP before a model conversion. Preserve matching gate/up selections and down input columns. No unstructured sparsity speedup is assumed. |
2395
+ | Layer skipping | [ShortGPT](https://arxiv.org/abs/2403.03853) ranks layer influence. A static reduced-layer artifact can remove work, but Qwen's recurrent/attention mix and cache topology must remain explicit. Dynamic token-dependent skips change recurrent evolution. | Start with static layer influence and held-out quality. Removing eight of 64 equally costly blocks would remove one eighth of block work only under that simplifying assumption; use measured layer costs before predicting time. No serving skip flag is selected. |
2396
+ | Low-rank approximation | [SVD-LLM](https://arxiv.org/abs/2403.07378) combines activation-aware factorization and correction. Two dense factor multiplies can use existing operations, but a loader/linear binding and compression-quality evidence are still needed. | The rank/byte screen rules out high-rank bf16 factors as a size win against W3. The actual layer-one gate spectrum rejects plain unweighted SVD at a size-feasible rank. Activation-aware error and task quality remain separate work. |
2397
+ | QAT/distillation | [QLoRA](https://arxiv.org/abs/2305.14314) shows why freezing a quantized base changes training memory. Full-resident 27B optimization does not fit either machine. `Qwen35Model.loraTargets()` explicitly excludes Trellis MLPs; existing adapter training does not establish packed-MLP recovery. | Layerwise QAT or adapter recovery needs a differentiable packed linear binding and measured activations. Stored teacher targets can separate teacher generation from student training. The quality gain and training duration remain unmeasured. |
2398
+ | Alternative drafters | Existing grouped providers already separate proposals from verification. A trained drafter must improve accepted tokens per total target/draft time and respect target memory needs. | No trained DSpark/DFlash checkpoint exists. Keep their untrained correctness checks distinct from performance acceptance. R20's measured native-MTP depths remain the available comparison. The specific DFlash2 architecture is separate open work. |
2399
+
2400
+ Actual-weight screens now reject the simple unweighted low-rank and sparse
2401
+ variants. Differentiation confirms the need for a custom packed backward
2402
+ operation; expanded frozen weights already differentiate. Further work needs
2403
+ activation-calibrated candidates or that backward binding. No new deployment default,
2404
+ model-quality claim or training run follows from the paper results alone.