mlx-bun 0.3.0 → 0.4.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 (150) hide show
  1. package/docs/README.md +4 -1
  2. package/docs/archive/investigations/openjarvis-fit.md +198 -0
  3. package/docs/archive/investigations/qwen38-27b-campaign-log.md +1092 -0
  4. package/docs/design/batching.md +1321 -49
  5. package/docs/design/decode-speed-program.md +331 -1163
  6. package/docs/design/generic-model-support.md +79 -3
  7. package/docs/design/kv-cache.md +198 -54
  8. package/docs/design/speculative-decoding.md +387 -24
  9. package/docs/design/turboquant.md +123 -13
  10. package/docs/design/unified-engine-frontier-plan.md +144 -142
  11. package/docs/planning/PRODUCT_ROADMAP.md +16 -0
  12. package/docs/planning/release-notes-v0.4.0.md +45 -0
  13. package/docs/reference/benchmarks.md +2457 -6
  14. package/docs/reference/cli.md +41 -2
  15. package/docs/reference/distribution.md +16 -9
  16. package/docs/reference/environment.md +55 -5
  17. package/docs/reference/models.md +13 -4
  18. package/docs/reference/server-api.md +79 -25
  19. package/docs/reference/server-config.md +178 -84
  20. package/docs/reference/troubleshooting.md +13 -21
  21. package/package.json +1 -1
  22. package/src/backends/mlx/assistant-target.ts +46 -0
  23. package/src/backends/mlx/autoregressive-draft-rows.ts +120 -0
  24. package/src/backends/mlx/batch-group.ts +368 -224
  25. package/src/backends/mlx/cache-attachment.ts +67 -0
  26. package/src/backends/mlx/cache-layout.ts +31 -0
  27. package/src/backends/mlx/checkpoint-state.ts +53 -0
  28. package/src/backends/mlx/continuation-persistence.ts +106 -0
  29. package/src/backends/mlx/continuation-request.ts +43 -0
  30. package/src/backends/mlx/continuation.ts +77 -0
  31. package/src/backends/mlx/draft-target.ts +7 -22
  32. package/src/backends/mlx/full-kv-row-append.ts +32 -0
  33. package/src/backends/mlx/full-kv-row-donor.ts +54 -0
  34. package/src/backends/mlx/full-transitioning-kv-rows.ts +65 -0
  35. package/src/backends/mlx/gateway-binding.ts +77 -18
  36. package/src/backends/mlx/kv-codec.ts +9 -0
  37. package/src/backends/mlx/kv-maintenance.ts +133 -0
  38. package/src/backends/mlx/kv-tensor-rows.ts +212 -0
  39. package/src/backends/mlx/model-serving.ts +1 -1
  40. package/src/backends/mlx/prefill-cohort.ts +89 -0
  41. package/src/backends/mlx/prefill-rows.ts +200 -0
  42. package/src/backends/mlx/prefill.ts +1 -1
  43. package/src/backends/mlx/projected-context-rows.ts +72 -0
  44. package/src/backends/mlx/request-state-policy.ts +41 -0
  45. package/src/backends/mlx/rollback.ts +41 -3
  46. package/src/backends/mlx/row-sampling.ts +49 -0
  47. package/src/backends/mlx/serial-executor.ts +35 -66
  48. package/src/backends/mlx/speculative-group.ts +359 -0
  49. package/src/backends/mlx/speculative-round.ts +161 -0
  50. package/src/backends/mlx/state-rows.ts +104 -0
  51. package/src/backends/mlx/state-views.ts +21 -1
  52. package/src/backends/mlx/target-layout-capability.ts +35 -0
  53. package/src/backends/mlx/transitioning-kv-rows.ts +165 -0
  54. package/src/cli.ts +11 -36
  55. package/src/contracts/execution.ts +11 -0
  56. package/src/contracts/prefix-cache.ts +23 -0
  57. package/src/contracts/resources.ts +7 -0
  58. package/src/contracts/sampling.ts +23 -0
  59. package/src/contracts/scheduling.ts +18 -0
  60. package/src/engine/execution-plan.ts +18 -16
  61. package/src/engine/resources.ts +12 -1
  62. package/src/engine/scheduler.ts +10 -5
  63. package/src/fit.ts +29 -15
  64. package/src/generate.ts +77 -173
  65. package/src/inference/draft-acceptance.ts +41 -0
  66. package/src/inference/draft-output.ts +49 -0
  67. package/src/inference/rollback.ts +2 -2
  68. package/src/kv-scheme.ts +70 -12
  69. package/src/kv-store.ts +70 -16
  70. package/src/lab/paged-kv/paged-kv-rows.ts +83 -0
  71. package/src/lab/paged-kv/paged-kv.ts +25 -11
  72. package/src/mlx/array.ts +2 -1
  73. package/src/model/artifact-identity.ts +73 -0
  74. package/src/model/batched-kv.ts +235 -0
  75. package/src/model/batched-mask.ts +12 -4
  76. package/src/model/batched-quant.ts +8 -2
  77. package/src/model/batched-quantized-kv.ts +144 -0
  78. package/src/model/batched-rotating-quant.ts +76 -15
  79. package/src/model/batched-rotating-state.ts +76 -0
  80. package/src/model/batched-rotating.ts +64 -22
  81. package/src/model/batched-row-storage.ts +52 -0
  82. package/src/model/batched-ssm.ts +52 -0
  83. package/src/model/batched-turboquant-kv.ts +93 -0
  84. package/src/model/compiled-decode.ts +7 -1
  85. package/src/model/decoded-kv-donor.ts +12 -0
  86. package/src/model/delayed-quantized-kv.ts +72 -0
  87. package/src/model/delayed-rotating-quantized-kv.ts +93 -0
  88. package/src/model/delayed-turboquant-kv.ts +55 -0
  89. package/src/model/full-prefill-padding.ts +56 -0
  90. package/src/model/full-prefill-row.ts +105 -0
  91. package/src/model/gemma4-base.ts +162 -80
  92. package/src/model/gemma4.ts +34 -26
  93. package/src/model/generated/gemma4-12b.ts +4 -1
  94. package/src/model/generated/gemma4-26b.ts +4 -1
  95. package/src/model/generated/gemma4-e4b.ts +4 -1
  96. package/src/model/glm52-cache.ts +80 -4
  97. package/src/model/glm52-mla.ts +12 -6
  98. package/src/model/glm52.ts +19 -40
  99. package/src/model/kv-attention-view.ts +67 -0
  100. package/src/model/minicpm5.ts +11 -7
  101. package/src/model/qwen3-delta-state.ts +74 -0
  102. package/src/model/qwen3-delta.ts +59 -36
  103. package/src/model/qwen3_5.ts +82 -42
  104. package/src/model/rotating-kv-donor.ts +35 -0
  105. package/src/model/rotating-kv-layout.ts +262 -0
  106. package/src/model/rotating-row-transaction.ts +35 -0
  107. package/src/model/speculative-rotating-kv.ts +101 -0
  108. package/src/model/ssm-prefill-padding.ts +39 -0
  109. package/src/model/trellis-linear.ts +2 -2
  110. package/src/model/turboquant-codec.ts +83 -0
  111. package/src/model/universal/dense.ts +14 -13
  112. package/src/preflight.ts +31 -15
  113. package/src/prompt-cache.ts +42 -44
  114. package/src/sampler.ts +36 -25
  115. package/src/serve/chat-stage.ts +2 -2
  116. package/src/serve/generation-gateway.ts +39 -30
  117. package/src/serve/model-host.ts +3 -4
  118. package/src/serve/request-plan.ts +4 -3
  119. package/src/serve/request-prep.ts +2 -4
  120. package/src/serve/text-completion-stage.ts +2 -2
  121. package/src/server.ts +64 -108
  122. package/src/spec/assistant-rows.ts +92 -0
  123. package/src/spec/assistant-source.ts +28 -18
  124. package/src/spec/cache-identity.ts +22 -0
  125. package/src/spec/deepspec-rows.ts +29 -0
  126. package/src/spec/deepspec-source.ts +12 -10
  127. package/src/spec/dflash-source.ts +28 -4
  128. package/src/spec/drafter.ts +153 -142
  129. package/src/spec/dspark/deepspec-module.ts +95 -120
  130. package/src/spec/dspark/module-dflash.ts +126 -170
  131. package/src/spec/glm52-mtp-graph.ts +29 -0
  132. package/src/spec/glm52-mtp-rows.ts +132 -0
  133. package/src/spec/glm52-mtp-source.ts +53 -136
  134. package/src/spec/glm52-mtp-state.ts +33 -0
  135. package/src/spec/ngram-source.ts +92 -20
  136. package/src/spec/projected-draft-rows.ts +73 -0
  137. package/src/spec/qwen-mtp-module.ts +171 -0
  138. package/src/spec/qwen-mtp-rows.ts +219 -0
  139. package/src/spec/qwen-mtp-source.ts +81 -226
  140. package/src/spec/qwen-mtp-state.ts +30 -0
  141. package/src/spec/serve-loop.ts +70 -68
  142. package/src/spec/source.ts +80 -15
  143. package/src/spec/two-model-rows.ts +61 -0
  144. package/src/spec/two-model.ts +43 -101
  145. package/src/ssd-cache.ts +33 -21
  146. package/src/ssd-durability.ts +11 -7
  147. package/src/web/app.js +57 -57
  148. package/src/backends/mlx/memory-guard.ts +0 -40
  149. package/src/spec/prefix-state.ts +0 -45
  150. /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;
@@ -97,7 +99,8 @@ What remains is drafters worth running, in this order:
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
101
  - **Per-slot drafting under batching** — the composition-matrix row in the
100
- architecture doc; a mounted draft routes every request serial today.
102
+ architecture doc; actual speculation still uses the serial verifier, while
103
+ supported ordinary requests can batch even with a draft mounted.
101
104
 
102
105
  ### Lever 2 — native MLX updates against the pinned control
103
106
 
@@ -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. |
@@ -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
@@ -1111,1111 +1114,36 @@ This is a source-derived scheduling hypothesis, not a measured speed claim;
1111
1114
  each window's native arithmetic, rollback, cache reuse and completed response
1112
1115
  remain correctness and acceptance gates.
1113
1116
 
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.
1117
+ ### 7.8 Execution log (archived)
1118
+
1119
+ The chronological run log (2026-09-04 → 2026-09-08; harness preparation,
1120
+ early first token, shared-M/tile/split-K kernels, graph exports and counter
1121
+ calibration, MLX scheduling settings, shared affine kernels, GDN
1122
+ specializations, strict fill, grammar mask, mmap loader, KV append census)
1123
+ moved verbatim to
1124
+ [qwen38-27b-campaign-log.md](../archive/investigations/qwen38-27b-campaign-log.md).
1125
+ Every evidence filename it cites is kept there and resolves to
1126
+ `reports/qwen38-rd/` on the measuring host. Outcomes, retained flags, next
1127
+ steps and reopen conditions per row are in §7.13; §7.9–§7.12 stay live.
1128
+ Changes that landed by default from that log are correctness or memory fixes,
1129
+ not speed defaults: bounded 8 MiB range cache (§7.7), per-chunk draft-KV
1130
+ evaluation (§7.7), compact state materialization through stock DynamicSlice,
1131
+ SSD boundary-before-transfer fix, Qwen tool-parameter parser,
1132
+ `reasoning_content` alias, EOS/finish-reason accounting, native pack 0.4.0.
2198
1133
 
2199
1134
  ### 7.9 Project kernel coverage
2200
1135
 
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`.
1136
+ The current AST census has 37 custom Metal kernel construction sites in 15
1137
+ files; frozen source controls retain the two old-core affine kernels the
1138
+ MLX 0.32.2 consolidation removed (§7.12). The initial inventory also counted
1139
+ 355 calls into 162 distinct MLX C APIs; that count includes allocation,
1140
+ configuration and graph operations, not native GPU kernels. Runtime
1141
+ specializations still need shape, dtype, layout and stream coverage. Evidence:
1142
+ `reports/qwen38-rd/project-kernel-consolidated-census.json` (current), with
1143
+ the earlier censuses in `project-kernel-inventory.json`,
1144
+ `project-kernel-coverage.json`, `project-kernel-vector-expand-addendum.json`,
1145
+ `project-kernel-turboquant-addendum.json`, `project-kernel-inverse-addendum.json`
1146
+ and `project-kernel-wide-addendum.json`.
2219
1147
 
2220
1148
  | Owned kernel family | Sites | Current evidence and next coverage |
2221
1149
  |---|---:|---|
@@ -2230,8 +1158,8 @@ retired kernels. Evidence: `project-kernel-consolidated-census.json`.
2230
1158
  | 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
1159
  | Trellis split-K projection and accumulation | 2 | Short-prefill model/serving acceptance; larger shapes and additional artifacts remain. |
2232
1160
  | 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. |
1161
+ | Trellis native-wide prefill | 1 | Reached only under `MLX_BUN_TRELLIS_VARIANT=11..13` (default 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. |
1162
+ | 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
1163
  | 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
1164
 
2237
1165
  The native-operation audit covers quantized/dense/gather matmul, SDPA,
@@ -2292,7 +1220,7 @@ controls vary from about 0.29 to 0.58 ms; Q8 M1 controls vary from about 0.24 to
2292
1220
  0.51 ms. Some candidate/control pairs reverse by nearly 2x. Float32 is much
2293
1221
  steadier and generally flat across geometries. Attribute this bf16 timing
2294
1222
  variation before further optimization claims. No geometry default changes.
2295
- These are M4 Pro 24 GB diagnostics. Real Colibri serving remains unavailable;
1223
+ These synthetic screens were measured on the M4 Pro 24 GB. Real Colibri serving remains unavailable;
2296
1224
  the local GLM-5.3-Flash artifact uses a different architecture. Evidence:
2297
1225
  `streamed-expert-screen{,-review}.json` and
2298
1226
  `streamed-expert-repeat{,-review}.json`.
@@ -2419,7 +1347,7 @@ unchanged and the continuous lane/submitted-row counters are asserted.
2419
1347
  The apparent packed serial improvement does not survive six balanced pairs:
2420
1348
  all 30 paired responses remain exact, but complete sampled request time is
2421
1349
  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
1350
+ control moves by +0.058%. These loaded-machine results (M4 Pro) do not justify
2423
1351
  retaining the fusion for Qwen. Evidence is `top-p-http-screen{,-review}.json`
2424
1352
  and `top-p-http-r6-serial-repeat{,-review}.json`.
2425
1353
 
@@ -2534,8 +1462,8 @@ dispatch. Both arms disable the existing shared-affine flag, and the candidate
2534
1462
  pays its eligibility checks. The first two HTTP attempts failed overlap
2535
1463
  qualification and remain excluded. Evidence:
2536
1464
  `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
1465
+ `affine-shared-head-http-{llama1,llama3}-overlap-review.json`. These
1466
+ loaded-machine diagnostics (M4 Pro) do not replace quiet-machine acceptance. Closed head-only helpers
2539
1467
  are removed; the broader operation's eligibility work remains open.
2540
1468
 
2541
1469
  A bf16-only selection uses large projections and leaves small matrices on
@@ -2579,9 +1507,10 @@ Six native pairs per append length preserve all logits, live states and
2579
1507
  continuations. Both M4 and M8 improve in every pair; M1 and M128 controls are
2580
1508
  approximately flat. The candidate exercises 105 additional projections at
2581
1509
  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
1510
+ The then-existing opt-in 4-bit kernel selected native eight- or sixteen-value
1511
+ lane arithmetic for those shapes, off by default, with the 3/8-bit selection
1512
+ restricted to its original shapes; that kernel and its flag were removed in
1513
+ the MLX 0.32.2 consolidation (§7.12) and survive only in frozen source controls. Large nonfast
2585
1514
  output heads with N≥65536 remain native because no such head has passed the
2586
1515
  model/serving performance gate. This does not change the measured Gemma
2587
1516
  projection selection. Focused tests
@@ -2659,16 +1588,29 @@ fast RoPE. Evidence: `mrope-reuse-screen-review.json` and
2659
1588
  `mrope-stride-full-model-packed-review.json`. Closed helpers are removed; raw
2660
1589
  reports and source hashes remain.
2661
1590
 
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,
1591
+ The final quiet-machine bundle must record host/chip/RAM, incumbent and
1592
+ candidate source hashes, local diff, Bun/native/oracle versions, model hashes,
1593
+ flags and workload files.
1594
+ Run the existing serving suite and native generation separately on a quiet machine,
2665
1595
  with fixed cache conditions and all paired samples retained. Its existing
2666
1596
  numbers are historical controls until the workload and version metadata match.
2667
1597
 
2668
1598
  ### 7.10 Final benchmark and HTML comparison report
2669
1599
 
1600
+ The offline renderer and replay fixtures are implemented. It imports the
1601
+ existing native/serve formats, retains failures and provenance, and suppresses
1602
+ speed ratios for incompatible work or unqualified runs. Its current metrics
1603
+ and limitations live in benchmarks.md. A bounded MiniCPM M1 diagnostic passes
1604
+ the real measurement path with the explicit reference control; concurrent
1605
+ output differences remain visible. Fixed-source block log-ratio intervals now
1606
+ use a deterministic bootstrap across distinct workload seeds, with duplicate
1607
+ seeds excluded and at least five blocks required. Quality inputs, the frozen
1608
+ final protocol and quiet final matrix remain acceptance work;
1609
+ rendering saved evidence does not close this gate.
1610
+
2670
1611
  After the optimization gates close, build and run a repeatable benchmark for
2671
- the incumbent, combined finalists and retained quantizations on the M4 Pro.
1612
+ the incumbent, combined finalists and retained quantizations on a quiet
1613
+ machine, recording its host/chip/RAM.
2672
1614
  The benchmark must preserve the existing suite's measurements while making
2673
1615
  native generation, serving, memory and quality comparisons easier to inspect.
2674
1616
  Its protocol is frozen before final runs; the held-out Kanban task in section
@@ -2758,7 +1700,7 @@ them. Embed the report's required assets so the exported file works offline.
2758
1700
  Exit requires a model-free replay fixture proving schema validation, unit
2759
1701
  definitions, pairing, failure handling and renderer escaping; a bounded live
2760
1702
  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
1703
+ a quiet machine. Compare the old suite and new suite on shared cells to
2762
1704
  detect measurement changes before attributing a difference to the engine.
2763
1705
  Publish qualified numbers only in the canonical benchmark reference, with
2764
1706
  raw JSON and HTML under `reports/`. Machine access or unsupported cells that
@@ -2842,8 +1784,8 @@ ordinary first-token reads. All servers exit cleanly with equal active
2842
1784
  capacity, and all 547 source hashes remain fixed. Complete-request paired
2843
1785
  medians for concatenation improve only 0.33%, 0.06% and 0.23% across the code,
2844
1786
  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.
1787
+ 0.04% but regresses 0.44% on JSON. Losses remain in both results. These
1788
+ diagnostics (M4 Pro) establish no broad serving benefit worth another sampler path.
2847
1789
  Evidence: spec-grouped-greedy-screen.json, spec-grouped-greedy-eval-screen.json
2848
1790
  and spec-grouped-greedy-three-http{,-review}.json. This tests target verification
2849
1791
  readback only, not DFlash2's architecture or the separate forced-token method.
@@ -2862,7 +1804,7 @@ Priority is the bounded M1 scalar operation screen, current-artifact long-agent
2862
1804
  memory/context coverage, then Qwen DFlash2 feasibility. Only positive operation
2863
1805
  economics and quality evidence justify a new full-model loader or artifact.
2864
1806
  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.
1807
+ or memory figure changes our baseline.
2866
1808
 
2867
1809
  The bounded Bun/Metal M1 screen now preserves all 54 fixture cases, including
2868
1810
  online rotation, dtype promotion and incomplete packed rows. Six fresh-process
@@ -2886,30 +1828,18 @@ zero/subnormal/overflow scale values. Six fresh processes then preserve all 84
2886
1828
  large-projection comparisons at M257/512, including rotation and native matmul,
2887
1829
  with identical cross-process hashes and zero final active allocation. Median
2888
1830
  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
1831
+ 765.00–765.05 MiB. Every pair improves. These were measured on the M4 Pro on synthetic
2890
1832
  resident matrices. They do not measure real model quality, RSS or whole-model
2891
1833
  speed, and they do not replace the separate small-M QMM arithmetic. Evidence:
2892
1834
  `polar-expand.json` and `polar-expand-repeat{,-review}.json`.
2893
1835
 
2894
1836
  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.
1837
+ pattern. The byte-packed KV decoder and the narrower inverse-rotation
1838
+ operation are integrated behind `MLX_BUN_TURBOQUANT_FUSED_DECODE=1`; their
1839
+ gates, numbers and the closed direct packed-key attention arm live in
1840
+ turboquant.md, "Packed-value decode fusion investigation", and the ledger row
1841
+ is §7.13 R13. The video's weight format still has no production loader or
1842
+ kernel here.
2913
1843
 
2914
1844
  ### 7.12 Custom-kernel graph reuse and the MLX runtime update
2915
1845
 
@@ -2980,8 +1910,8 @@ continuation. All twelve cells are byte-exact against the matching MLX-LM
2980
1910
  reference. The two new-core builds also agree with each other in those cells.
2981
1911
  Source hashes stay fixed and every worker exits cleanly. Evidence:
2982
1912
  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
1913
+ The package selects the verified macOS 14 native pack 0.4.0, now published;
1914
+ distribution.md records the release. Final-source acceptance
2985
1915
  passes 16 RTN4 same-version reference cases (including actual 4K/8K prompts),
2986
1916
  36 Trellis forward/state/continuation cases and six Trellis generations.
2987
1917
  The Trellis control is the accepted new-core implementation; this is not a
@@ -3019,7 +1949,10 @@ for every tested 2/3/4-bit cell. A full-model prototype comparison passes all
3019
1949
  Those timings are screening evidence, not serving results.
3020
1950
 
3021
1951
  The integrated implementation keeps geometry and arithmetic in
3022
- `trellis-wide-prefill.ts`. Qwen supplies an explicit layout proof from its
1952
+ `trellis-wide-prefill.ts`. It is dispatched only under
1953
+ `MLX_BUN_TRELLIS_VARIANT=11..13` (`TrellisLinear.forward` in
1954
+ `src/model/trellis-linear.ts`); the default variant 6 still expands and uses
1955
+ native matmul, so this path is opt-in, not production. Qwen supplies an explicit layout proof from its
3023
1956
  RMSNorm output through the existing MLP and linear calls. Unproven layouts
3024
1957
  return to native expansion/matmul for the affected sizes. Reading lazy-array
3025
1958
  strides before evaluation cannot establish this proof, and inserting an eval
@@ -3064,8 +1997,8 @@ Both append lengths, one and eight tokens, pass at both contexts. Full
3064
1997
  logits, every live cache array and the fixed continuation are byte-exact;
3065
1998
  both workers exit cleanly with fixed source hashes. Evidence:
3066
1999
  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.
2000
+ native-runtime-screen{,-review}.json. These runs used a loaded machine (M4 Pro)
2001
+ and are not canonical benchmark rows.
3069
2002
 
3070
2003
  A native proxy prototype establishes a narrower graph-reuse option. It holds
3071
2004
  the original custom operation, delegates evaluation to MLX's existing encoder,
@@ -3176,6 +2109,241 @@ Their reported gains are not our measurements. New [GQA8 attention reuse](https:
3176
2109
  has a narrow D64/128 dispatch; Qwen3.8-27B uses GQA6/D256, so it is an algorithm
3177
2110
  lead rather than a direct dispatch win here. The [optional fused full-attention
3178
2111
  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
2112
+ for bounded temporary memory. Evaluate that tradeoff on the actual
3180
2113
  eligible path. Reference numerical changes must be explained, never hidden by
3181
2114
  loosening the oracle tolerance.
2115
+
2116
+ Qwen layer evaluation bounds deferred prefill work. The exact oracle and
2117
+ retained-history results, including superseded reservation trials, are in
2118
+ [benchmarks.md](../reference/benchmarks.md). Josh's closeout machine policy
2119
+ permits the recorded audio-daemon CPU activity with exclusive GPU ownership,
2120
+ available memory and stable alternating pairs. Earlier diagnostic evidence
2121
+ keeps its original classification.
2122
+
2123
+ Josh subsequently chose request execution over predicted-memory refusal. The
2124
+ reservation prototypes remain historical diagnostics. Default fit estimates
2125
+ must neither reject prompts nor clamp completion caps; only explicit operator
2126
+ limits and fixed representation capacities apply. The Qwen layer evaluation
2127
+ fix stays, while reservation callbacks and their hot-path checks are removed.
2128
+ Actual failures remain recorded in reliability and timing results.
2129
+
2130
+ ### 7.13 Outcome ledger
2131
+
2132
+ One row per §7.4 experiment, in the §7.7 vocabulary (repeatable win, measured
2133
+ loss, inconclusive, blocked, unmeasured). Every campaign number was measured
2134
+ on Joshs-MBP-2025.local (Apple M4 Pro, 24 GB) unless a row says otherwise;
2135
+ the host is provenance, not scope. All "repeatable win" rows have at least
2136
+ six balanced pairs with exact outputs. The original rows below describe
2137
+ loaded-machine diagnostics. The closeout serial v6/v13 suite now passes six
2138
+ balanced pairs under the recorded audio-CPU allowance, with every paired
2139
+ request matching. Final-source native state and bf16/KV4 MTP-prefix gates
2140
+ also pass. Continuous and combined pressure acceptance remain; no default
2141
+ has changed. New evidence is in `reports/qwen38-closeout/` and
2142
+ [benchmarks.md](../reference/benchmarks.md). Historical evidence paths
2143
+ are relative to `reports/qwen38-rd/` on the measuring host; the narrative
2144
+ behind each row is the archived log
2145
+ ([qwen38-27b-campaign-log.md](../archive/investigations/qwen38-27b-campaign-log.md)),
2146
+ §7.9–§7.12, [turboquant.md](turboquant.md) "Packed kernel experiments" and
2147
+ "Packed-value decode fusion investigation", and
2148
+ [speculative-decoding.md](speculative-decoding.md) §4.7/§7.4.
2149
+
2150
+ | ID | Experiment | Outcome | Retained flags / defaults | Evidence files | Next discriminating step or missing resource | Reopen condition |
2151
+ |---|---|---|---|---|---|---|
2152
+ | 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. |
2153
+ | R1 | Packed prefill tile decode plus matmul | **Repeatable win (opt-in).** 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. | `MLX_BUN_TRELLIS_VARIANT=11..13`; default 6 untouched. | `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` | Quiet-machine six-pair `bench-serve all` serial, `MLX_BUN_TRELLIS_VARIANT=6` vs `13` on the packed artifact at 1k and 4k prompts, reporting cold TTFT and MLX peak allocation (the row's declared gate). | A tile geometry beating native matmul at M≥128 on real k3 matrices, or a GPU generation that changes native small-M dispatch. |
2154
+ | 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` | Combined arm (variant 13 + async expand + fused TurboQuant KV + MTP) through the saved seven-request agent-boundary fixture on a quiet machine; the 75% threshold has one pressure pair per lane. | A change to the memory headroom guard or to per-layer cache evaluation boundaries (R16/R17). |
2155
+ | R3 | Axis-0 scatter layout and split-K | **Repeatable win (opt-in).** 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. | Inside `MLX_BUN_TRELLIS_VARIANT=13`; default 6 untouched. | `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` | Quiet-machine six-pair v6 vs v13 single-request decode via `bench-serve all --arms mlx-bun-serial` on the packed artifact, to settle the M128 prefill control drift and M1 decode neutrality. | k2/k4 down projections (only k3 interleaved is qualified) or a new bit allocation from R19. |
2156
+ | R4 | Axis-1 reduce and gate/up fusion | **Repeatable win (opt-in).** 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. | Variants 7+ (`MLX_BUN_TRELLIS_VARIANT`); default 6 untouched. | `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. |
2157
+ | 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. |
2158
+ | 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` | Quiet-machine six-pair original vs interleaved artifact `bench-serve all` serial with prompt cache enabled (all artifact gates ran cache-disabled). | Expanded state-window index variant (bytes for ALU) untested; k2/k4 interleaving unqualified. |
2159
+ | R7 | Small-M packed kernel | **Repeatable win (opt-in).** 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). | `MLX_BUN_TRELLIS_VARIANT=7..13`; default 6 unchanged. | `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` | Pre-M3 GPU qualification of the wide path (the gate keeps the earlier dispatch there) via the `trellis-wide` model gate on an M1/M2 host; the M≤8 crossover needs a KL/long-state quality gate if pursued as Lab. | Any MLX runtime bump that changes small-M dense dispatch (rerun `trellis-runtime-full`). |
2160
+ | 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. |
2161
+ | 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. |
2162
+ | R10 | Parallel/chunkwise GDN prefill | **Unmeasured (not started).** No chunkwise or scan-decomposition formulation was implemented or timed; only sequential-scan specializations were screened under R9. Stays Lab because a different reduction order is not exact. Source leads (vLLM Qwen GDN, FLA, the Gated Delta Networks paper) are pinned only. | None. | `upstream/sources.json` | Prefill-regime attribution at 1k/4k/8k first; then a Metal chunk formulation compared on teacher-forced logits and recurrent state across chunk boundaries versus the sequential scan. | Not applicable; never opened. |
2163
+ | 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. |
2164
+ | 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. |
2165
+ | R13 | Attention and KV | **Repeatable win (opt-in).** 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 unaffected; TurboQuant KV remains serial-only. | `MLX_BUN_TURBOQUANT_FUSED_DECODE=1`, default off; 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` | Quiet-machine six-pair `bench-serve all --arms mlx-bun-serial --kv-quant turbo` flag off/on on both quants at 8k context; separately the unmeasured three-query KV4 verify-window head-pairing screen from §7.7. | MLX ships fused quantized SDPA for GQA6/D256, TurboQuant KV becomes batch-eligible, or the RTN4 complete-time cell resolves. |
2166
+ | R14 | Vocabulary head and sampler | **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. | `MLX_BUN_TOKEN_MASK=metal` opt-in, default `host`; DSA uint32 keys landed (shared operation). | `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` | 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. |
2167
+ | 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 fails at layer 4; guard retained. Held-out session corpus unmeasured. | `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. |
2168
+ | R16 | MLX graph and loop | **Repeatable win (opt-in).** 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, so promotion is gated. 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=1`, default off. | `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` | The serial/native candidate now completes the missing M=1 step on non-aborted early return when the caller retains its cache. Original-source regression is reproduced; unit and M1 packed-Qwen/MiniCPM/Gemma state/continuation gates pass. Finish M4 packed/affine and server checks, then a quiet six-pair chat HTTP repeat; separately, scoped Llama submission-limit integration at the model-owned seam. | MLX adds shape-inferring CustomKernel or graph replay, or per-token host-overhead attribution changes. |
2169
+ | R17 | Hybrid prefix and recurrent state reuse | **Inconclusive.** The paired MTP prefix cache retains one aligned target/draft prefill boundary; native restores at 128/513/2,051 tokens are exact (also under Luke's sampling recipe), the HTTP gate returns eight identical responses, and one serving-suite diagnostic shows cached TTFT 91.9 ms versus 190.8 ms original. It captures prompt boundaries only. The working-tree producer now shares the existing RAM budget and SSD lifecycle, with native bf16/KV4 RAM and restart identity gates on both Macs; generated-history checkpoints and pressure/performance acceptance remain unfinished; in the completed Kanban run the compaction summary (90,214 tokens, 19m 42.7s) and first tool turn (8m 53.4s) had zero cached tokens. The SSD boundary-before-transfer fix landed as a durability correction. No balanced timing pairs exist for the prefix cache itself. | Paired prefill reuse enabled in candidate source; default-selection checks pending. SSD boundary fix landed; MTP output persistence remains open. | `mtp-cache-candidate-native.json`, `mtp-cache-http-gate.json`, `mtp-prefix-luke-sampling.json`, `luke-history-kv4-preflight.json`, `ssd-boundary{,-two}-{before,after}.json`, `ssd-boundary-tests.txt`, `serving-compact-{boundary-fixed,bun140-throw,bun142-throw,shared-guard}.review.json`, `agent-boundary-fixture.json`, `agent-boundary-current{,-review}.json`, `kanban-final/suite-driver.json`, `kanban-final/optimized-mtp-cache-suite.md.json` | Generated-history checkpoint (target KV, draft KV, pending hidden row aligned to the next rendered prefix) measured on the saved Kanban tool-turn requests; the 8m53s/19m42s zero-cache prefills are the target. | Open until generated boundaries are cached; also if Pi's compaction reserve can be tuned within the published profile. |
2170
+ | R18 | Scheduler | **Repeatable win (opt-in).** 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). No B-wide prefill (Phase 18 S1a), no shape buckets, no fixed-arrival sustained-serving cell; bench-serve's four-request leg is serial queue throughput. | `MLX_BUN_EARLY_FIRST_TOKEN=1`, default off. | `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` | Fixed-arrival-schedule sustained-serving cell (concurrency 2/4/8; per-request queue/TTFT/latency and aggregate tok/s, verified lane and admitted rows) per §7.10 on a quiet machine. | B-wide prefill lands, or the R16 cache-boundary reconciliation changes scheduler behavior. |
2171
+ | R19 | Weight-quality allocation | **Unmeasured (not started).** No latency-aware allocation objective ran alongside the kernel work as §7.7 requires. Quality evidence predates §7 and lives in turboquant.md (Q3 KL 0.1553 at 3.55 bpw; Q2b packed 12.14 GiB, KL 0.1550; rotated down axis kept because `--down-axis in` costs rawGSM 29/50 vs 44/50). The Kanban task ran on the k300 packed artifact; R6 interleaving is lossless so it adds no quality delta. Q5 2.75-budget arm, q2a/q2b task columns and the rawGSM EOS-cliff root cause remain open in turboquant.md. | None. | turboquant.md "Q campaign" and "FINAL BOARD" sections | Allocation sweep weighting per-role bits by the measured M=1 kernel costs from R3/R4/R5, gated by the frozen KL/MMLU/tGSM/rawGSM screens; needs GPU time for quantization and evaluation. | Not applicable; never opened. |
2172
+ | 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. The shared-serving candidate now has a short-context depth-2/3/4 settings screen and native depth-3 coverage; see benchmarks.md. Depth 3 reaches the native matrix threshold for the KV4 value product, so late-context economics remain a separate open comparison. | `--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` | Draft depth 1/2/3 versus ordinary decode at late-task context depths (77k+ tokens, KV4, published profile): complete request time, acceptance and verify-window attention cost; then a quiet six-pair `bench-serve all` with the q4 head (command in benchmarks.md). | Any change to verify-window arithmetic (KV4 head pairing, fused KV) or a DFlash2 drafter (R21). |
2173
+ | R21 | Other exact speculative sources | **Blocked.** 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, n-gram and suffix sources were not measured on Qwen in this campaign; SpecPrefill is approximate and belongs to a Lab arm. | None. | `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. |
2174
+ | R22 | Residency and shared memory | **Measured loss.** 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. | None for speed; bounded range cache and per-chunk draft-KV evaluation landed as 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` | Reusable integer position-range prefix and native integer `arange` on Bun 1.4 against the bounded-cache baseline, gated on exact range/mask values, view ownership and the memory bound, measured on complete prefill and verification rounds. | A controlled page-cache-cold startup cell (§7.10) exists; mmap lost warm but cold was never controlled. |
2175
+ | 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. No matched successful original-source run exists, so no task-time speedup can be claimed. Image/video tower and encoder-cache cells were not measured. | 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 | Missing resource: about four hours of exclusive GPU ownership on an idle machine for a matched original-source run (`673b43f`, variant 6, bf16 KV, no MTP) under the identical profile, prompt, seed and harness. | Open while no baseline exists; revisit with generated-history checkpoints (R17) and the compaction-reserve arm. |
2176
+ | R24 | Larger departures | **Blocked.** Only 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. Learned quantization, sparse residuals, activation quantization, pruning, layer skipping, low-rank, QAT/distillation and alternative drafters have no recorded kernel/quality/memory/benefit estimate. | 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` | Missing resource: a decision to build a loader for the tq3-mini format plus its KL/MMLU/tGSM/rawGSM screen on the actual checkpoint; without that the row is a feasibility bound only. | An artifact with quality evidence at or below Q2b bytes, or the operation gains reproduced whole-model. |
2177
+
2178
+ Josh's original direction is to "only ask the model to decode tokens that we
2179
+ can't reasonably already know." This includes reasoning snippets copied into
2180
+ tool arguments, repeated atomic values such as URLs, and predictable tool JSON
2181
+ structure and field order. The goal is deterministic continuation wherever the
2182
+ application can establish the text, with known-text proposals where the model's
2183
+ choice remains uncertain. Prefix-cache reuse avoids rereading history; it does
2184
+ not by itself avoid generating the same text again. Strict appends and verified
2185
+ copy proposals have different behavior contracts and must be measured as such.
2186
+ Josh deferred the broader deterministic-continuation investigation. Generated
2187
+ state reuse is active R17 work and comes first; it is part of the original
2188
+ cache objective, not completion of the broader continuation direction.
2189
+
2190
+ The R17 closeout audit confirms a reusable generated prefix in the saved
2191
+ first tool turn: the first response's reasoning text tokenizes as an exact
2192
+ extension of the original prompt inside the next rendered request. This is
2193
+ textual opportunity evidence only, not an accepted recurrent-state snapshot
2194
+ or a timing result. See `reports/qwen38-closeout/r17-first-tool-prefix-opportunity.json`.
2195
+ A candidate must retain aligned target KV/recurrent state, draft KV and the
2196
+ pending true hidden row at a completed decode boundary before tool formatting
2197
+ can diverge. Preserve the original prompt snapshot as a fallback within the
2198
+ existing cache budget. Test with independent prompts and verify snapshot
2199
+ identity after further decode; saved task timings cannot substitute for that
2200
+ state test. Quantities and original task timings belong in benchmarks.md.
2201
+
2202
+ R17 uses the existing tiered cache. `createMlxSerialExecutor` now passes its
2203
+ shared cache service into speculative execution. `QwenMtpProvider` supplies a
2204
+ checkpoint codec and retains no prefix store of its own. Prefill publishes
2205
+ paired target/draft state through `PromptCache.take`/`put`; processed output
2206
+ publication remains unfinished. `PromptCache` owns RAM/SSD prefix selection,
2207
+ eviction and write-behind persistence. The execution-state interface must capture, restore and serialize a
2208
+ complete token-prefix checkpoint, regardless of whether those tokens came
2209
+ from a prompt or generated output. Qwen MTP supplies its target KV/recurrent
2210
+ state, draft KV and pending hidden row through that interface; it must not
2211
+ grow a second storage policy.
2212
+
2213
+ The first implementation step now gives ordinary and batched consumers the
2214
+ same `PrefixCache` contract. MLX companion tensors flow through the existing
2215
+ RAM budget, spill queue, streamed SSD writer/reader and durability coordinator.
2216
+ The new storage tests pass on M1 Max and M4 Pro, including a fresh-process
2217
+ restore; layout and ownership details belong in [kv-cache method companion state](kv-cache.md#method-companion-state).
2218
+ Qwen MTP prefill migration now passes native bf16/KV4 RAM and SSD restart
2219
+ continuation gates on both Macs. Live target/draft/hidden hashes, emitted IDs
2220
+ and acceptance decisions match after reuse; the cache/provider restart also
2221
+ checks stable draft identity. Raw gates are in
2222
+ `reports/qwen38-closeout/composition-baseline/{m1,m4}-shared-mtp-cache-*.log`.
2223
+ Generated-ID alignment, native fresh-process continuation and saved-request
2224
+ performance acceptance remain unfinished.
2225
+
2226
+ A subsequent isolated output-checkpoint candidate resolves the final verified
2227
+ round and publishes only processed content. Synthetic stop/EOS/callback cases
2228
+ pass. Generated-prefix SSD continuation matches fresh recomputation on M1 Max
2229
+ in bf16/KV4 and on M4 Pro in KV4. M4 bf16 preserves checkpoint bytes but changes
2230
+ the next argmax; a fresh split-prefill control also changes logits. The cause
2231
+ is not yet established against a matched execution/oracle control, so this
2232
+ candidate is not adopted. Evidence: `composition-baseline/m*-mtp-generated-reuse*.log`
2233
+ under `reports/qwen38-closeout/`. Shared execution work continues independently.
2234
+
2235
+ A subsequent shared-method implementation publishes target-row and draft-provider
2236
+ snapshots through the common cache port before retirement. M1/M4 bf16/KV4/fused
2237
+ TQ native tests preserve actual processed-ID coverage and RAM/SSD continuation,
2238
+ including early stops and immutable donors after sibling/follow-up work.
2239
+ Production parser/template replay also preserves the sampled prefix of bounded
2240
+ tool turns with thinking off/on. Production HTTP RAM reuse and fresh-process
2241
+ SSD restoration now also pass on both Macs in bf16/KV4/fused TQ with thinking off/on;
2242
+ responses, logprobs and acceptance match within each restart pair. These
2243
+ results do not replace the long Kanban or performance gates. The five-file
2244
+ change is adopted; final native/HTTP composition with the prefill-policy fix
2245
+ and its matched short M4 benchmark now pass. Long Kanban and pressure
2246
+ acceptance remain. Details belong to the method-companion
2247
+ section in kv-cache.md; evidence is in the separate
2248
+ `generated-prefix-composition-validation` checkout's `reports/generated-prefix/`.
2249
+
2250
+ The pre-refactor source and measured-evidence hashes are preserved under
2251
+ `reports/qwen38-closeout/composition-baseline/manifest.json`. It distinguishes
2252
+ the current unmeasured working tree from the frozen source used for the M4
2253
+ comparisons. Baseline numbers and limitations remain in benchmarks.md. Keep
2254
+ interface refactors, kernel experiments and the MTP depth comparison as
2255
+ separate changes before measuring their composition.
2256
+
2257
+ Acceptance must cover actual generated IDs at a rendered-stable boundary,
2258
+ continued generation after capture without changing the retained state, RAM
2259
+ reuse, eviction to SSD, a fresh-process SSD restore, and an exact-prefix miss
2260
+ that still selects a usable earlier checkpoint. Retain shorter recurrent
2261
+ boundaries because a later state cannot be trimmed back. Account for all
2262
+ companion tensors in the existing cache budgets and persistence lifecycle.
2263
+ Measure complete next-request time, including capture/write/restore cost;
2264
+ the saved work is not literally free. The current Kanban candidate remains
2265
+ frozen while this change is developed and supplies the pre-R17 task evidence.
2266
+
2267
+ The private `joshuarossi/kanban-board` archive was audited at
2268
+ `c34577fecbf5e1b4c48c13b14c7a7f92b92b6ba9`. Its first request and first SSE
2269
+ response are byte-identical to the original saved evidence. The archived
2270
+ second request changes two literal escape sequences inside reasoning from
2271
+ `\u0000` to `\^@`; this explains its earlier reconstructed-prefix divergence.
2272
+ Do not change either evidence copy or treat that archive difference as a Pi
2273
+ serialization defect. The original saved request retains the full reasoning
2274
+ prefix. Both comparisons retokenize decoded reasoning; the SSE has no original
2275
+ sampled IDs, so the execution-state gate must record those IDs directly.
2276
+ Evidence: `reports/qwen38-closeout/r17-repo-prefix-audit.json`.
2277
+
2278
+ #### Candidate defaults and remaining gates
2279
+
2280
+ Defaults and semantics are owned by
2281
+ [server-config.md](../reference/server-config.md); this table lists only what
2282
+ still gates each campaign flag. The three default selections below are in the
2283
+ unreleased working tree; selection checks and final composed acceptance remain
2284
+ open. R17 output persistence and unified execution are not implemented by
2285
+ changing defaults. Phase 6 tracks those separately.
2286
+
2287
+ | Flag | Default | Remaining gates |
2288
+ |---|---|---|
2289
+ | `MLX_BUN_TRELLIS` | `kernel` (`=expand` decodes trellis tensors at load into 8-bit g64 affine) | Production; `expand` is the fallback carrier for a machine where the kernels lose. No open gate. |
2290
+ | `MLX_BUN_TRELLIS_VARIANT` | `13` in candidate source | Six serial, six continuous and six combined KV4/MTP pairs pass with exact paired responses. Final-source native state gates pass. Open: default-selection regression checks and remaining composed/pressure acceptance. Other experimental variants retain their individual gates. |
2291
+ | `MLX_BUN_TRELLIS_ASYNC_EXPAND` | off (`=1`) | Variant 13 only. Open: broader callers/models, combined-optimization arm, quiet-machine acceptance; pressure gates have one pair per lane. |
2292
+ | `MLX_BUN_EARLY_FIRST_TOKEN` | off (`=1`) | Native caller-owned early-return alignment passes the initial M1 regression gates. Open: M4 packed/affine and server acceptance, cached/SSD pressure HTTP with streaming, quiet-machine repeat; raw prompts show no client gain. |
2293
+ | `MLX_BUN_TURBOQUANT_FUSED_DECODE` | off (`=1`; read via `process.env` when each TurboQuant cache is created, `src/model/gemma4-base.ts`) | Open: combined settings with MTP/KV4, pressure, quiet-machine acceptance; RTN4 complete-time cell inconclusive; serial-only because TurboQuant KV refuses continuous placement. |
2294
+ | `MLX_BUN_QWEN_SPEC_KV4` | on in candidate source, with configured draft and `--kv-quant 4` | Six combined M4 pairs and two completed tasks pass. Open: default-selection checks, broader composition/pressure; long tool-turn prefill memory/timing (unfused quantized attention materializes query-by-context scores); the three-query verify-window head-pairing screen is unmeasured. |
2295
+ | `MLX_BUN_MTP_PROMPT_CACHE` | on in candidate source | Open: balanced timing pairs for the shared cache, generated-boundary checkpoints and pressure acceptance; shared byte accounting and bf16/KV4 RAM/SSD restart correctness now pass. |
2296
+ | `MLX_BUN_FILL` | off (`=strict` \| `=echo`) | Open: held-out session/adversarial corpus, other models, quantized-KV and speculative composition (guarded), quiet-machine repeat; echo tier remains Lab. |
2297
+ | `MLX_BUN_FILL_APPEND_CHUNK_SIZE` | `0` (model limit; Qwen 27B on `applegpu_g16s` up to 4 positions, other GPUs 1) | Open: held-out, broader-model, other-GPU qualification, quiet acceptance. |
2298
+ | `MLX_BUN_FILL_MAX_SPAN` | `32` (floor 2) | Cap policy undecided: cap 4 restores exact state in the v12 audit and both caps improve request time; span policy must follow the selected variant's measured append cost. |
2299
+ | `MLX_BUN_FILL_TRACE` | off (`=1` \| `=<file.jsonl>`) | Diagnostic only; must be unset for any timing. |
2300
+ | `MLX_BUN_FILL_K` / `MLX_BUN_FILL_CANDIDATES` / `MLX_BUN_FILL_INDEX_MAX` | `8` (floor 2) / `24` / `131072` (floor 1024) | Echo tier (Lab, pre-campaign); paired A/B on task success and wall clock before any default. |
2301
+ | `MLX_BUN_RD_PREFILL_CHUNK` | `2048` unless the library caller supplies `prefillChunkSize` (Kanban/benchmark recipe uses 256) | Benchmark control, not a performance candidate; repeated-prefill cost at 256 vs 2048 on the saved Kanban requests is open. |
2302
+ | `MLX_BUN_RD_CONTEXT_LIMIT` | unset (explicit context cap; may exceed the advisory fit estimate) | Benchmark control only. |
2303
+ | `MLX_BUN_TOKEN_MASK` | `host` (`=metal`) | Open: controlled quiet B1/B4 structured-output session (six compact pairs inconclusive under residual swap). |
2304
+ | `MLX_BUN_PREFILL_TAIL_SPLIT` | on (`=0` reverts to full-chunk prefill) | Pre-campaign default; isolated as the cause of RTN4 native-vs-MTP trajectory differences; changing it needs its own oracle/quality gates. |
2305
+
2306
+ #### Closed candidates
2307
+
2308
+ Do not re-open without new evidence of the kind named in the row's reopen
2309
+ condition.
2310
+
2311
+ - Device f32 code LUT for variant-6 decode: slower at M=1 for every bit width (`lut6-*.json`).
2312
+ - 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-*`).
2313
+ - Device/threadgroup fp16 code tables at M=1/4: lose; threadgroup table retained only for M3/4 k3 scatter inside variant 13.
2314
+ - Integer y-mad final-sum rewrite: exact, no useful gain; readable expression kept.
2315
+ - Shared activation loads across 2/4/8 gate/up rows per SIMD group: loses at k3 M=1.
2316
+ - Row-loop unrolling of the aligned 3-bit scatter: no material gain.
2317
+ - Larger fused prefill tiles at M=128/512 (40 geometries): all exact, none beats expansion plus native matmul.
2318
+ - Contiguous packed reads with transposed threadgroup writes and threadgroup padding: slower; not retained.
2319
+ - Variant 9 unrestricted deferred expansion and unrestricted async submission: fail the saved-agent pressure gate (Metal insufficient memory); superseded by the bounded 75% policy.
2320
+ - M≤8 packed/expanded crossover: MLP win but changes output bytes; Lab, not in production dispatch.
2321
+ - fp16 storage as a Steel GEMM throughput shortcut: source audit shows float accumulation regardless; rejected.
2322
+ - Fused GDN convolution/SiLU/copied tail (R8): flat full-model timing; unpromoted.
2323
+ - GDN compiled fixed-length recurrence and fused recurrence/RMSNorm/gate kernels (R9): gains too small; not integrated.
2324
+ - Fixed-shape CompiledFunction over 16 SSM groups: -0.062%/-0.202%; no integration.
2325
+ - Fixed-input custom-kernel proxies, 64 per-layer cached graphs (RTN4 fails identity) and whole-model graph (slower): no production tracer manipulation.
2326
+ - Affine QMV layout screen (rows per SIMD group / groups per threadgroup): no accepted whole-model gain.
2327
+ - 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.
2328
+ - Shape-specific compiled-call cache around shared-affine kernels: HTTP gains shrink to flat; not integrated.
2329
+ - Broader cross-model 4-bit shared-affine prototype: MiniCPM/Llama regress; float16 head-only B8 variant <1% on 3B; not integrated.
2330
+ - Fused affine gate/up/SwiGLU: only M=1 wins in isolation; full-forward gain too small.
2331
+ - Residual-add/RMSNorm fused kernel: M1 slightly slower, M4/8 flat; not integrated.
2332
+ - Multimodal RoPE shared angles/direct strides: M128 slightly slower, M512 flat; closed.
2333
+ - Metal launch-configuration cache: Qwen flat, MiniCPM fails the serving response gate (cause unresolved); closed.
2334
+ - Untouched-finalize elision in the Metal backend: -0.069%/+0.108%; closed without integration.
2335
+ - MLX submission/traversal/sync settings for Qwen: no compelling setting (0.94% traversal gain matched the 0.92% default drift); Llama 25/25 remains diagnostic, unintegrated.
2336
+ - `MLX_METAL_FAST_SYNCH=1`: stalls the installed library's large bf16 three-stream case; not attributed to any prototype.
2337
+ - Top-p inverse-permutation removal (pure MLX and fused Metal): Qwen +0.183% complete; Llama -0.4%; no production sampler change.
2338
+ - Grouped greedy verify readback (concatenated and evalAll): ≤0.33% gain, JSON regression; closed.
2339
+ - Direct packed-key TurboQuant attention: exact, 6–19% slower than joint decode plus native SDPA; closed.
2340
+ - Fused inverse-Hadamard one-row layout inside the joint decoder: +12.76..+24.67% slower; only the row-grouped N≥8192 variant retained.
2341
+ - Dense register-resident attention (vLLM-Metal port): loses timing; Steel D256 fails one 512-token KL screen; Lab, unintegrated.
2342
+ - KV append whole-cache-copy hypothesis: rejected by native/HTTP census (one-row copies); no append kernel.
2343
+ - mmap file-backed weight loader (immutable, managed, lazy, prefault variants): warm flat-to-slower, cold worse in 5/6; closed as a performance candidate.
2344
+ - Staged-body strict-fill prototype (skip the discarded in-flight sample): flat; closed.
2345
+ - Strict fill with affine KV4: fails recurrent state at layer 4; composition guard kept.
2346
+ - Cross-entropy block-alignment partition: no wired model reaches a misaligned partition; closed without integration.
2347
+ - Streamed-expert threadgroup geometry: bf16 timing bimodal in all three library arms; no geometry default retained.
2348
+ - Proc-pid-rusage FFI collector: 0.0013 ms vs 1.09 ms per read, collector only; existing reports keep the ps collector.
2349
+ - Video tq3-mini polar format: operation wins on synthetic matrices; no loader, kernel or quality evidence; not adopted.