arjun10g commited on
Commit
ae2f686
·
verified ·
1 Parent(s): 456e3f5

Sync 1 audio file(s) and transcripts

Browse files
audio/expert-prefetch.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:272379bd03221a168de5a374ccfb7ca2b3fecca7dcb28c9ecf1aa55a7581252e
3
+ size 41572653
lectures/expert-prefetch.md ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Lecture: what we learned about predictive MoE prefetching
2
+
3
+ **Session covered:** 15–16 September 2026 continuation
4
+
5
+ **Audience:** an engineer who wants to understand the design, the experiments, the evidence boundaries, and the implementation choices well enough to reproduce or challenge them.
6
+
7
+ This lecture explains the work completed in this continuation session. Here **end-to-end (E2E)** means the complete token workload, **least-recently-used (LRU)** means the reactive residency baseline, and **inter-token latency (ITL)** means the measured time per generated token. It begins with a short Qwen3 closeout from the first part of the session, then focuses on the Qwen3.5 and Qwen3.8 predictor and hardware expansion. The central result is deliberately modest: the predictors improve offline route quality, but the measured Qwen3.5 E2E workload shows no E2E LRU speed win. Qwen3.8 has useful head, cache-replay, and transfer evidence, while whole-model E2E is unsupported by the current single-GPU harness.
8
+
9
+ ## Contents
10
+
11
+ 1. [The question](#the-question)
12
+ 2. [A short chronology](#a-short-chronology)
13
+ 3. [MoE routing and the prediction problem](#moe-routing-and-the-prediction-problem)
14
+ 4. [The timing pipeline](#the-timing-pipeline)
15
+ 5. [Metrics and why they are separate](#metrics-and-why-they-are-separate)
16
+ 6. [Predictor families and equations](#predictor-families-and-equations)
17
+ 7. [Low-rank correction, step by step](#low-rank-correction-step-by-step)
18
+ 8. [Model geometry and selected configurations](#model-geometry-and-selected-configurations)
19
+ 9. [Offline results](#offline-results)
20
+ 10. [Hardware and transfer measurements](#hardware-and-transfer-measurements)
21
+ 11. [Qwen3.5 end-to-end results](#qwen35-end-to-end-results)
22
+ 12. [Engineering repairs and reproducibility](#engineering-repairs-and-reproducibility)
23
+ 13. [What the results mean](#what-the-results-mean)
24
+ 14. [Unexecuted next experiments](#unexecuted-next-experiments)
25
+ 15. [Glossary](#glossary)
26
+ 16. [Source map](#source-map)
27
+ 17. [Self-check questions](#self-check-questions)
28
+
29
+ ## The question
30
+
31
+ Mixture-of-Experts (MoE) language models contain many expert feed-forward networks, but route each token to only a small native set. Let `E` be the number of experts and `K` the native router's top-k. A token in Qwen3.5, for example, chooses `K=8` experts from `E=256`. The inactive experts may live in host memory or another tier, so the runtime would like to transfer likely future experts while the GPU is doing useful work.
32
+
33
+ The proposal has two possible sources of advantage:
34
+
35
+ * **Prediction:** identify future expert IDs before the native router reaches that layer.
36
+ * **Lead time:** issue their transfers early enough that the bytes arrive before the expert is consumed.
37
+
38
+ Those are different problems. A predictor can be statistically accurate and still lose if its score costs more time than the transfer slack it creates. Conversely, a weak signal with a whole-token lead may be more useful than a stronger signal available only a few microseconds before use. The session therefore measured route quality, predictor cost, cache traffic, transfer behavior, and end-to-end token time as separate quantities.
39
+
40
+ ## A short chronology
41
+
42
+ The first part of this continuation closed the earlier Qwen3 experiment. In the banked run `20260916T015147Z-e2e-qwen3-drift-a-08d6e1a088`, model `Qwen/Qwen3-30B-A3B-Instruct-2507` was pinned to revision `0d7cf23991f47feeb3a57ecb4c9cee8ea4a17bfe`. Native routing was top-8, the residency cache was 32 experts, and the corrected arm used rank-32 `augmented_rows` correction at source layers 20–46 (27 layers); 20 earlier source layers kept the incumbent.
43
+
44
+ On that workload, the router arm averaged 42.049 ms/token, the corrected arm 41.947 ms/token, and the reactive LRU arm 48.917 ms/token. The corrected-minus-router effect was −0.246%, with a 95% interval of [−1.712%, +1.220%] over three request means. Thus the experiment supports a large LRU-versus-router difference on its own workload, but it does not establish a confident incremental predictor speedup. The historical closeout is in [`report.md`](../../research/results/predictor_hardware_20260915/report.md), with the earlier email receipt in [`predictor_hardware_email_receipt_20260916.json`](../../tools/predictor_hardware_email_receipt_20260916.json). Its email ID is distinct from the final Qwen3.5/Qwen3.8 email sent later at 15:39:39 UTC.
45
+
46
+ The main work then expanded the evidence ladder. We used a request-held-out Qwen3.5 capture to fit and select correction artifacts, replayed Qwen3.8 carrier and mixer variants, measured predictor heads on an H100, confirmed transfer-copy behavior, and ran three Qwen3.5 E2E breadth settings (`M=8,12,16`). The final generated report is [`qwen35_qwen38_final_report.md`](../../research/results/predictor_hardware_20260915/qwen35_qwen38_final_report.md).
47
+
48
+ ## MoE routing and the prediction problem
49
+
50
+ At a target layer `t`, the native router receives a hidden state `h_t` and computes one score per expert. In a simplified notation, the router score vector is
51
+
52
+ ```text
53
+ z_t = W_t h_t, z_t in R^E
54
+ ```
55
+
56
+ The native route is the IDs of the largest `K` entries of `z_t`, together with the router's normalized weights. Prefetching does not change this decision. The native router remains the authority at the point of consumption; speculation only proposes bytes to stage early.
57
+
58
+ Suppose a source layer `s` is used to predict a later target layer `t`. The deployed zero-extra-state anchor computes
59
+
60
+ ```text
61
+ A = W_t h_s.
62
+ ```
63
+
64
+ The exact target score differs by the residual increment
65
+
66
+ ```text
67
+ d = W_t (h_t - h_s),
68
+ z_t = A + d.
69
+ ```
70
+
71
+ This decomposition is the key to the predictor work. Cross-layer predictors can see `A`, but the unseen increment `d` is where their error lives. A method can therefore be improved by estimating a useful component of `d`, provided the estimate transfers from training requests to held-out requests and its compute fits the lead-time budget.
72
+
73
+ ### K versus M
74
+
75
+ `K` is the native number of experts actually consumed by the model. `M` is the proposed candidate breadth. It is the size of the shortlist offered to admission and cache filtering; it is not necessarily the number of transfers that reach the backend. Resident experts, duplicate IDs, byte budgets, and slack admission can reduce actual issues below `M`. When `M=K`, the proposed set must be exactly right to contain the complete native set. Increasing `M` raises the chance of covering all native experts, but can increase admitted bytes and lower candidate precision.
76
+
77
+ For Qwen3.8, native truth is top-10 (`K=10`). Therefore candidate full-set coverage at `M=8` is mathematically zero: eight IDs cannot contain ten distinct native IDs. This does not mean an M=8 predictor covers no cache misses. Cache-aware recall is a different question because some native experts may already be resident. The report keeps these measures separate.
78
+
79
+ ## The timing pipeline
80
+
81
+ The runtime sequence is easiest to understand as a timeline. This is a conceptual sequence; the exact overlap depends on the backend and readiness state.
82
+
83
+ ```mermaid
84
+ flowchart LR
85
+ A[Early prediction at source s] --> B[Admission, cache filter, speculative issue]
86
+ B --> C[Bytes become progressively ready]
87
+ C --> E{At consumption deadline, required expert ready?}
88
+ N[Model progresses through layers] --> D[Exact native router at target t]
89
+ D --> E
90
+ E -- yes --> F[Expert compute]
91
+ E -- no --> G[Remaining reactive miss fetch]
92
+ G --> F
93
+ ```
94
+
95
+ The exact router and native weights are untouched. “Predicted” means an ID was proposed; “ready” means the required bytes had arrived in the usable layout and synchronization state by the expert-consumption deadline. The native router does not wait for speculative bytes: model progress and speculation proceed independently, and a transfer that arrives after the router but before expert consumption can still help. A predicted expert can be too late, partially ready, evicted, or unnecessary. The implementation tracks readiness separately from prediction so a high recall number cannot be mistaken for hidden transfer time.
96
+
97
+ The available lead may be one layer, several layers, or a whole token. A later source layer has better state but less time; an earlier source has more time but a less faithful state. This is why the session ranked methods by lead and measured each target layer rather than collapsing all layers into one predictor score.
98
+
99
+ ## Metrics and why they are separate
100
+
101
+ The main route metrics are:
102
+
103
+ * **Recall@M:** fraction of native expert IDs present in the candidate set. For native top-k, `recall = |C_M ∩ T_K| / K`.
104
+ * **Candidate precision:** fraction of proposed candidates that are native IDs, `|C_M ∩ T_K| / M`. Admission and resident filtering can make actual issues smaller than the proposed breadth; the offline precision definition is based on the proposed set.
105
+ * **Full-set coverage:** probability that all native IDs are contained, `P(T_K ⊆ C_M)`. This is stricter than recall.
106
+ * **Cache-aware miss coverage:** fraction of experts absent from the current resident cache that are correctly proposed and admitted early. This is the metric closest to avoiding reactive fetches.
107
+ * **Issues and waste:** candidate issues per layer and issues that do not cover a cache miss. Waste can rise even when recall rises.
108
+ * **Readiness:** whether an issued block has arrived sufficiently by the expert-consumption deadline. A candidate that arrives after that deadline is a miss for latency purposes; arrival after the exact route but before consumption can still help.
109
+ * **Traffic ratio:** the final report uses `(candidate issues + remaining reactive misses) / matched reactive misses`. A ratio below one would mean fewer total expert transfers than the matched reactive baseline. Recall alone cannot tell us this.
110
+
111
+ For example, an M=16 method can have 95% recall while admitting many extra experts. An M=8 method can have lower recall but cover a useful fraction of the native set with fewer proposed bytes. The report therefore places quality and traffic beside each other and does not convert offline quality into an unmeasured speedup.
112
+
113
+ ## Predictor families and equations
114
+
115
+ The incumbent or router proxy is the anchor `A = W_t h_s`. The session screened several ways to correct its score.
116
+
117
+ ### Bias correction
118
+
119
+ On training rows, calculate the projected increment `d_i = W_t(h_{t,i}-h_{s,i})`. The constant bias is
120
+
121
+ ```text
122
+ b = mean_i(d_i).
123
+ ```
124
+
125
+ The score is `A+b`. This captures a systematic direction shared across examples. It costs one E-vector add and can be fused into an existing score epilogue.
126
+
127
+ ### Velocity correction
128
+
129
+ The source hidden state has a local change from the previous layer, `h_s-h_{s-1}`. Project that velocity through the target router:
130
+
131
+ ```text
132
+ v_i = W_t(h_{s,i}-h_{s-1,i}).
133
+ ```
134
+
135
+ After centering the training residual and velocity, the least-squares scalar is
136
+
137
+ ```text
138
+ gamma = sum_i(v_i * residual_i) / (sum_i(v_i * v_i) + epsilon).
139
+ ```
140
+
141
+ The score becomes `A+b+gamma v`. The method asks whether the immediately observed direction predicts the next unseen direction. It is cheap, but the held-out results show that a fixed velocity correction is not automatically better than the incumbent.
142
+
143
+ ### Fused low-rank drift correction
144
+
145
+ The main Qwen3.5 candidate is a reduced-rank correction. It learns directions in the source state that correlate with the projected residual, then applies a small rank-`r` correction. Three implementation forms must be distinguished:
146
+
147
+ 1. **Algebraic low-rank:** compute the anchor, project the centered state through `U`, and multiply by `Gamma` as explicit correction work.
148
+ 2. **`augmented_rows`:** append the correction features to the score computation, while retaining the remaining correction projection/epilogue work. This reduces launch structure but does not make all correction cost disappear.
149
+ 3. **Dense/precomposed fold:** fold the correction into an effective dense weight and bias when the correction basis uses the same input state as the anchor. The effective weight keeps the router's `[E,H]` shape; the arm owns an additional precomposed copy and bias alongside native router weights.
150
+
151
+ None of these runs a separate full target router. The hardware comparison keeps these paths distinct.
152
+
153
+ ### Router proxy, source mix, target mix, anchor, and carrier
154
+
155
+ For ordinary hidden-state captures, the router proxy is simply `W_t h_s`. For Qwen3.8, one capture stored a four-stream hyper-connection carrier of width 10,240 rather than the router's 2,560-dimensional input. The code tested several projections `P` from that carrier before applying `W_t`:
156
+
157
+ * **Source mix:** pass the carrier through the source layer's own mixer, which produces the source layer's 2,560-dimensional mixed input.
158
+ * **Target mix:** pass it through the target layer's own mixer. This uses more target-specific information but reads the full carrier and incurs mixer cost. The resident target-mixer BF16 weights are 13,127,680 B per layer; that is separate from the FP32 predictor-owned-byte totals in the microbench.
159
+ * **Anchor:** the ordinary 2,560-dimensional router input used by the deployed proxy.
160
+ * **Carrier:** retain the full 10,240-dimensional state as the correction basis. The carrier itself is not a learned `[512,10240]` weight; such a map would be a large stored artifact and is not the tested design. Because this basis is 10,240 wide while the router anchor is 2,560 wide, it cannot be collapsed into the same dense folded head. A target mixer is also a nonlinear/state transformation whose runtime work remains charged.
161
+ * **Mean normed or stream controls:** project normalized streams or one stream to determine whether target-mix gains come from the learned mixer or merely from a useful state representation.
162
+
163
+ The target-mix arms use layer-owned dense mixer weights already resident in an expert-streaming design. “Zero stored artifact” describes the added persistent weight artifact, while the state read width and runtime mixer work still matter.
164
+
165
+ ## Low-rank correction, step by step
166
+
167
+ This section derives the fitted form and gives shapes. Let a training batch at one source/target pair have `n` rows:
168
+
169
+ 1. `H_s` has shape `[n, H]`, `H_t` has shape `[n, H]`, and `W_t` has shape `[E, H]`.
170
+ 2. Project the target increment:
171
+
172
+ ```text
173
+ D = (H_t - H_s) W_t^T, shape [n, E].
174
+ ```
175
+
176
+ 3. Compute `b = mean(D, axis=0)`, shape `[E]`, and center the residual:
177
+
178
+ ```text
179
+ R = D - b, shape [n, E].
180
+ ```
181
+
182
+ 4. If the correction basis is the source state, center `X = H_s - mean(H_s)`, shape `[n,H]`. For a Qwen3.8 carrier correction, `X` can instead be `[n,10240]`; the score anchor remains a 2,560-dimensional router input.
183
+ 5. Form the cross-covariance `C = X^T R`, shape `[H,E]`, and compute its singular vectors. Keep the first `r` left singular vectors as `U`, shape `[H,r]`.
184
+ 6. Project each centered input into the learned subspace, `Z = XU`, shape `[n,r]`.
185
+ 7. Solve the regularized least-squares epilogue matrix. The implementation uses `epsilon = 1e-6 * (trace(Z^T Z) + 1)` and a linear solve, rather than explicitly forming an inverse:
186
+
187
+ ```text
188
+ Gamma = solve(Z^T Z + epsilon I, Z^T R),
189
+ Gamma shape [r,E].
190
+ ```
191
+
192
+ 8. At inference, the algebraic correction is `Z Gamma`, shape `[n,E]`, and the final score is
193
+
194
+ ```text
195
+ score = A + b + Z Gamma.
196
+ ```
197
+
198
+ Each requested rank has its own independently fitted `Gamma`; a rank-64 `Gamma` is never truncated to rank 32, even when the nested `U` bases share their leading columns.
199
+
200
+ For the same-basis case, the dense/precomposed fold follows directly. With scalar shrinkage `alpha`,
201
+
202
+ ```text
203
+ S = h W_t^T + alpha [b + (h - mu) U Gamma]
204
+ = h [W_t^T + alpha U Gamma] + alpha [b - mu U Gamma].
205
+
206
+ W_eff^T = W_t^T + alpha U Gamma
207
+ b_eff = alpha (b - mu U Gamma).
208
+ ```
209
+
210
+ Here `h:[n,H]`, `W_t^T:[H,E]`, `U:[H,r]`, `Gamma:[r,E]`, `mu:[H]`, and `b:[E]`. The effective folded head still has the router's `[E,H]` weight shape; it owns an additional precomposed copy/bias alongside native router weights, rather than changing the matrix dimensions. This identity explains why a same-basis correction can be precomposed, while a 10,240-wide carrier basis cannot be silently treated as the 2,560-wide anchor. The important statistical choice is still the constrained cross-covariance fit. A full high-capacity fit can memorize request-specific drift and fail on a new request. The session also ran a fixed-seed shuffled-pairing control: if the same structured correction survives after breaking the source/increment pairing, it is an artifact rather than evidence that the source predicts the drift.
211
+
212
+ Offline score shrinkage multiplies the fitted correction by a scalar. Qwen3.5 selected shrinkage 0.75, and the runtime uses lambda 1 because the selected artifact already contains that shrinkage. This distinction prevents applying the same factor twice.
213
+
214
+ ## Model geometry and selected configurations
215
+
216
+ Expert payload size for bf16 is computed from the three feed-forward projections:
217
+
218
+ ```text
219
+ expert_bytes = 3 * hidden_size * intermediate_size * 2.
220
+ ```
221
+
222
+ | Model | Experts E | Native K | Layers | Hidden H | Intermediate I | Expert bytes |
223
+ |---|---:|---:|---:|---:|---:|---:|
224
+ | Qwen3.5-35B-A3B | 256 | 8 | 40 | 2048 | 512 | 6,291,456 B (6 MiB) |
225
+ | Qwen3.8-Flash-Next | 512 | 10 | 48 | 2560 | 640 | 9,830,400 B (9.375 MiB) |
226
+
227
+ For a concrete memory check, one Qwen3.5 expert costs `3 × 2048 × 512 × 2 = 6,291,456` bytes. Holding eight such experts for one token/layer would be 48 MiB before cache metadata, alignment, and staging. This arithmetic is a payload example, not a measured transfer time or a claim about how many candidates admission will issue.
228
+
229
+ For Qwen3.5, the offline capture sampled 384 decode steps per request and warmed 64 steps. Fit requests were `req-003`, `req-006`, and `req-007`; validation used `req-002` and `req-005`; test used `req-000`, `req-001`, and `req-004`. Warm rows were excluded from fit/scoring. The Qwen3.5 E2E runs instead use greedy 64-token continuations. The selection metric was validation request-mean recall, with smaller rank breaking ties. The global selected policy is M=8 rank 128, M=12 rank 64, M=16 rank 64, all at shrinkage 0.75. This is a global rank policy; it is not a claim that every layer independently selected the same rank.
230
+
231
+ Qwen3.8 carrier replays used two reciprocal request folds (`req-006` and `req-007`), 512 decode steps per request, 480 steps scored after warm 32, 19 target layers (`29..47`), and 20 stored state layers (`28..47`). Warm 32 was excluded from scoring only; training includes all 512 capture steps. The focused rank grid compared source-mix, target-mix anchor, and target-mix carrier. The Qwen3.8 report labels the rank-64 target-mix result as descriptive; it is not a whole-model deployment choice.
232
+
233
+ The tuning grid screened ranks 16, 32, 64, and 128; shrinkages 0.50, 0.75, and 1.00; leads 1, 2, and 4; and cache capacities 96 and 256. The deployed headline remains lead 1. The Qwen3.5 selection rule was maximum validation request-mean recall, with smaller rank as the tie-break. Measured cost was not used to select the frozen rows; cost is reported afterward to decide whether a quality choice is practical.
234
+
235
+ ## Offline results
236
+
237
+ The following compact table reports `recall / full-set coverage / total transfer` from the final report, scoped to lead 1, Qwen3.5 cache-96 replay, and Qwen3.8 cache-32 replay. Qwen3.5 selected rows are test rows after validation selection. Recall is ordinary coverage of all native IDs; Qwen3.8 recall/full-set values are native-ID replay metrics, while the traffic denominator and total-transfer values use cache-aware replays. Neither model has a whole-model speedup interpretation here.
238
+
239
+ | Model and method | M=8 | M=12 | M=16 |
240
+ |---|---|---|---|
241
+ | Qwen3.5 incumbent | 0.7853 / 0.1378 / 1.488× | 0.8934 / 0.5283 / 2.275× | 0.9321 / 0.6932 / 3.264× |
242
+ | Qwen3.5 selected | 0.8009 / 0.1576 / 1.445× | 0.9069 / 0.5658 / 2.255× | 0.9434 / 0.7266 / 3.260× |
243
+ | Qwen3.8 source-mix rank 64 | 0.6470 / 0 / 1.227× | 0.7968 / 0.1955 / 1.606× | 0.8604 / 0.3963 / 2.143× |
244
+ | Qwen3.8 target-mix anchor rank 64 | 0.7251 / 0 / 1.124× | 0.8961 / 0.3958 / 1.467× | 0.9463 / 0.6629 / 2.013× |
245
+ | Qwen3.8 target-mix carrier rank 64 | 0.7248 / 0 / 1.125× | 0.8952 / 0.3899 / 1.469× | 0.9464 / 0.6589 / 2.013× |
246
+ | Qwen3.8 source-mix router control | 0.5868 / 0 / 1.308× | 0.7341 / 0.1181 / 1.692× | 0.8075 / 0.2957 / 2.217× |
247
+ | Qwen3.8 target-mix router control | 0.7031 / 0 / 1.155× | 0.8706 / 0.3344 / 1.500× | 0.9281 / 0.6008 / 2.031× |
248
+
249
+ The Qwen3.8 M=8 zero is the K=10 definition. Recall@M still measures the fraction of all native IDs in the proposed set; cache-aware miss coverage is reported in separate replay fields. At M=16, target-mix anchor reaches 0.9463 recall and 0.6629 full-set coverage, but the total-transfer ratio is still about 2.013×. That ratio explains why quality alone cannot justify a runtime claim.
250
+
251
+ Two worked arithmetic examples make the table concrete. For Qwen3.8 target-mix anchor at M=8, recall 0.725 means about `0.725 × 10 = 7.25` native IDs per row on average; candidate precision is therefore `0.725 × 10 / 8 ≈ 0.906` when that field is defined. For the reported M=16 row, total transfer is `(7.381 issues + 0.809 remaining misses) / 4.069 matched reactive misses ≈ 2.013`. These are replay quantities, not physical bus measurements.
252
+
253
+ The earlier sampled versus greedy distinction also matters. The final Qwen3.5 offline artifact is sampled (`do_sample=true`, temperature 1, top-k 20, top-p .95) with fixed seed 20260916, while the Qwen3.5 E2E workload uses its own frozen runtime configuration. Do not pool the two as if they were one independent sample. Native IDs are the truth: BF16/FP32 conversion, normalization, and softmax tie behavior can make a reconstructed raw-logit top-k disagree with native IDs. The exact native tuple is preserved by the Qwen3.5 router discovery path and the trace keeps native logits, scores, and indices. A diagnostic oracle that reads the future target state is useful for a ceiling, but cannot be deployed. Target-norm reweighting was a control and was excluded from deployable selection.
254
+
255
+ The stock Hugging Face control also had output-token mismatches. The cause was not established, so it is descriptive and excluded from paired functional/speed comparisons. Exact token identity was established among the six staged arms (36 rows per M, 108 rows across M=8/12/16, three requests, and two passes); it was not established against the stock control, which had 12 mismatch cells across three breadths and two unique requests.
256
+
257
+ ## Hardware and transfer measurements
258
+
259
+ The final hardware CSV contains 15 E2E rows and 276 predictor microbench rows. Transfer rows are in the final report and transfer receipt, not in that CSV. The H100 PCIe inventory was 114 SMs with Torch 2.6.0+cu124/CUDA 12.4 and Transformers 5.17. Qwen3.5 stage-2 E2E used bf16 model execution; the predictor head used FP32 with TF32 disabled. The process peak allocated figure was 76,147,564,544 B, including the resident-control scope. It is a process-memory measurement, not a physical bus measurement.
260
+
261
+ ### Final predictor microbench rows
262
+
263
+ These rows are all from the final report's exact model/layer/breadth/rank strata. They use CUDA-graph path, with wall time including ID readback/synchronization. Input update time is excluded. CUDA-event timing includes enqueue gaps and is not kernel-only time. The rank-128 Qwen3.5 rows are at layer 1:
264
+
265
+ | Model, layer, rank | Method | M=8 wall / event µs | M=12 wall / event µs | M=16 wall / event µs | Owned bytes |
266
+ |---|---|---:|---:|---:|---:|
267
+ | Qwen3.5, layer 1, r128 | incumbent | 71.9125 / 28.70 | 73.521 / 29.14 | 71.402 / 29.08 | 2,097,152 |
268
+ | Qwen3.5, layer 1, r128 | dense folded | 70.7955 / 30.13 | 72.135 / 30.89 | 74.6515 / 31.08 | 4,195,328 |
269
+ | Qwen3.5, layer 1, r128 | low-rank two-stage | 79.435 / 39.96 | 80.158 / 40.21 | 80.099 / 40.44 | 3,286,016 |
270
+
271
+ The final Qwen3.8 comparison is layer 29, rank 64, anchor/target-mix:
272
+
273
+ | Method | M=8 wall µs | M=12 wall µs | M=16 wall µs | Owned bytes |
274
+ |---|---:|---:|---:|---:|
275
+ | incumbent | 76.24 | 76.02 | 75.75 | 5,242,880 |
276
+ | target-router mixer control | 112.02 | 112.34 | 112.59 | 31,498,240 |
277
+ | low-rank two-stage | 130.30 | 130.80 | 131.29 | 32,296,960 |
278
+ | dense folded | 118.63 | 118.32 | 118.46 | 36,743,168 |
279
+
280
+ The target-mix mixer cost remains in these rows. It is not valid to reuse an older source-mix or legacy target-mix microbench as a final result. Predictor microbench rows are resident replay measurements: they do not include the full model and do not establish E2E token speed.
281
+
282
+ The final predictor bench has 30 invocations and 696 raw timing rows. A row contains 20 rounds × 64 samples; those samples are repeated measurements within an invocation, not 1,280 independent observations. The report uses medians of invocation summaries. Wall timing includes ID readback and synchronization, while input update time is excluded. CUDA-event timing includes enqueue gaps and therefore is not a kernel-only profile. Reported peak workspace excludes graph pools, input buffers, and persistent weights.
283
+
284
+ ### Transfer screen and confirmation
285
+
286
+ The exploratory transfer screen covered 216 cells: host threads 1/2/4 × requested streams 1/2/4 × packed/contiguous versus tiled payloads at 256 KiB and 1 MiB, with five rounds per cell. Packed transfer itself used one active stream. The confirmatory run fixed host threads to 1, one active CUDA stream, and a 1 MiB tile for 18 cells: three strategies (baseline, batched contiguous, tiled) × three candidate sizes × two models, over 30 paired rounds. The two comparison strategies produce 12 comparison rows against the baseline.
287
+
288
+ | Model | M | Strategy | Baseline µs | Candidate µs | Relative effect | 95% CI |
289
+ |---|---:|---|---:|---:|---:|---|
290
+ | Qwen3.5 | 8 | batched contiguous | 978.22 | 941.83 | −3.597% | [−4.781, −2.412]% |
291
+ | Qwen3.5 | 8 | tiled | 978.22 | 1099.60 | +12.555% | [+7.666, +17.444]% |
292
+ | Qwen3.5 | 12 | batched contiguous | 1436.32 | 1398.36 | −2.641% | [−2.822, −2.460]% |
293
+ | Qwen3.5 | 12 | tiled | 1436.32 | 1598.02 | +11.259% | [+10.790, +11.728]% |
294
+ | Qwen3.5 | 16 | batched contiguous | 1901.46 | 1850.86 | −2.661% | [−2.750, −2.572]% |
295
+ | Qwen3.5 | 16 | tiled | 1901.46 | 2161.75 | +13.688% | [+9.401, +17.975]% |
296
+
297
+ The corresponding Qwen3.8 confirmation rows were: M=8 batched contiguous −1.744% [−1.852, −1.635]% and tiled +12.079% [+11.921, +12.237]%; M=12 batched contiguous −2.062% [−2.570, −1.554]% and tiled +11.774% [+10.845, +12.703]%; M=16 batched contiguous −1.026% [−2.372, +0.320]% and tiled +12.045% [+11.831, +12.258]%. Relative effects are means of 30 paired-round percentage changes with t(29) intervals; they need not equal ratios of displayed means.
298
+
299
+ These payloads were synthetic uint8 byte buffers sized like corresponding bf16 expert payloads; they were not actual model expert gathers. The result supports a narrow copy-path observation, not a GPU or model speedup claim. “Command coalescing” here means merging software transfer commands. It is distinct from warp-level GPU memory coalescing, which concerns how adjacent thread accesses form memory transactions. The CPU replay merged only 2 commands out of 41,133 fetches (~0.005%); no GPU memory-coalescing gain was measured.
300
+
301
+ ## Qwen3.5 end-to-end results
302
+
303
+ Three Qwen3.5 stage-2 E2E runs tested M=8, M=12, and M=16. The router-based prefetch arm uses the same M as the corrected arm; the reactive `RES-LRU-96` arm is the comparison baseline. Positive effect means the left arm is slower.
304
+
305
+ | M | Router vs reactive LRU | Corrected precomposed vs router | Corrected precomposed vs reactive LRU |
306
+ |---:|---:|---:|---:|
307
+ | 8 | +5.124% [4.338, 5.911] | −0.121% [−0.220, −0.022] | +4.997% [4.198, 5.795] |
308
+ | 12 | +7.466% [5.232, 9.699] | +0.394% [−1.251, 2.039] | +7.885% [6.682, 9.087] |
309
+ | 16 | +8.759% [7.248, 10.270] | −0.083% [−0.110, −0.056] | +8.668% [7.140, 10.195] |
310
+
311
+ Each interval uses three request means and `t(df=2)=4.30265`; the unit of inference is the request, not each token. The tiny precomposed-versus-router effects at M=8 and M=16 have intervals excluding zero in this run, but they are small, workload-specific comparisons with n=3. M=12 includes substantial pass drift: pooled CV 6.882%, with pass 1 minus pass 0 of −15.37 ms, −11.65 ms, and −6.63 ms for prose, code, and structured requests. The result is reported descriptively rather than rejected by a post-hoc threshold. These effects do not offset the direct measured result that every corrected arm is slower than reactive LRU.
312
+
313
+ The raw augmented-row corrected arm is more expensive than the precomposed twin. At M=8 it was 4.016% slower than the router and 9.345% slower than LRU; at M=12 it was 4.213% slower than router and 11.991% slower than LRU; at M=16 it was 3.668% slower than router and 12.748% slower than LRU. Precomposition removes most of that extra head cost, but it does not create an E2E LRU win.
314
+
315
+ The engine counters show a real quality movement: corrected M=8 in-engine recall was 0.8097 versus router 0.7981; M=12 was 0.9187 versus 0.9071; M=16 was 0.9522 versus 0.9435. Yet fetched-byte totals were 1.130×, 1.391×, and 1.748× of same-M LRU respectively. These are engine software counters across six request/pass cells, including prefill. They are not PCIe or HBM bus traffic, and they do not imply that the predictor improved token latency.
316
+
317
+ Noise diagnostics were descriptive. M=8 had pooled ALLRES-BF16 CV 0.146%, M=12 6.882%, and M=16 0.348%; no preregistered acceptance threshold existed for these runs. The earlier failed diagnostic attempt and failed provider attempts remain in the evidence trail rather than being silently replaced.
318
+
319
+ Qwen3.8 whole-model E2E was not claimed. Its approximately 360 GB checkpoint, including more than 110 GiB of non-expert weights, does not fit the current single-GPU resident harness. Its measured head, cache replay, and transfer evidence are useful for design screening; they cannot be promoted to a model-level speedup.
320
+
321
+ ## Engineering repairs and reproducibility
322
+
323
+ The session spent substantial effort making results auditable. Every run has a config, seed, model revision, source identity, and result receipt. The final reducer checks the configured E2E identity, token, artifact, and noise fields, pairs rows inside each request/pass cell, and refuses to fall back to an older run. Configs are frozen once they produce evidence. Corrections go into new configs; artifact-side hashes and launch records preserve the reconstruction key. The final head and transfer receipts have remote artifact hash verification; the E2E lifecycle did not have a declared remote artifact digest, so its local artifacts were independently hashed and checked for source/config membership rather than described as remotely digest-verified.
324
+
325
+ Several practical catches mattered:
326
+
327
+ * The stock HF control produced output-token mismatches; the cause was not established, so it was excluded from paired functional and speed comparisons.
328
+ * A cache-aware replay and a runtime coalescing replay have different scopes; their counters must not be asserted equal.
329
+ * Predictor-owned bytes, workspace bytes, graph pools, persistent model weights, and physical bus traffic are different memory quantities.
330
+ * `packed_contiguous` was verified byte-exact for its synthetic source and destination. That says nothing about an arbitrary gather until the real manifest path is exercised.
331
+ * Lifecycle records bind a batch to the exact config and source. The H100 instances and ephemeral keys were deleted after artifacts were banked; no managed instances remain.
332
+
333
+ The repair chronology is part of the result. The native Qwen3.5 discovery path was changed to recognize the actual `Qwen3_5MoeTopKRouter` native tuple and preserve native logits, scores, and indices; it does not guess tuple shapes (DeepSeek's tuple layout differs). BF16 hidden exports retain bit patterns with explicit dtype provenance. The capture path was pinned to Transformers 5.17 and made portable across Windows NPZ filenames. Fit-only early coefficient exports read frozen fits and selection metadata only; those exports are hash-checked, byte-identical double emissions with additive installation. A separate interrupted test-scoring resume reads held-out states for evaluation and binds checkpoint plus frozen fit/selection hashes without refitting. The lifecycle recorder now binds a batch ID to `first_member + '+' + (member_count - 1)` and records exact per-config member/hash bindings. Shared hyper-connection, candidate, and packed D2H handling were repaired before the final measurement. Luna implemented these session changes and the root agent independently reviewed and orchestrated the final evaluation.
334
+
335
+ For context, the Qwen3.8 carrier mixer is not a linear reshape. With four streams, the code first applies grouped RMS normalization and a learned weight: `n = groupedRMSNorm(h) * (1+w)`, with concatenated `n` width 10,240. It then computes `low = silu((n @ D^T)/4)`, `gate = sigmoid(low @ U^T)`, reshapes `n` and `gate` to `[rows, 4, 2560]`, and averages `gate*n` over the four streams. The exact parameter orientation is defined in `capture/hyper_connection.py`; the point for this lecture is that target-mix work stays in the measured cost and cannot be absorbed into the same linear folded head as a 2,560-dimensional anchor.
336
+
337
+ The archive snapshot before this lecture was commit `32f885e`, ZIP size 671,287,623 B, SHA-256 `e2d54100adf5b91b0bf83f3537f73101dc3cf2997f266d8bfcf0b40d39884918`, with 2,512 members and 2,214 hashed members. Those values describe the prior final research snapshot; they are not the current archive after adding this lecture. The cumulative recorded project cost estimate is `$171.797758` against the authorized `$200` cap. It is a project ledger estimate, not a bill and not the charge for this lecture session.
338
+
339
+ The final Qwen3.5/Qwen3.8 report email was sent to `arjunghumman1995@gmail.com` at 15:39:39 UTC with Gmail ID `1a0aadfa6c6bb621`. This lecture is the companion lecture; the separate email receipt records that delivery. The empty legacy sibling shell remains because automatic review rejected its removal without a specific reason; that review outcome is recorded rather than retried.
340
+
341
+ Reproducibility has two levels. The final report can be regenerated from the banked compact evidence included in the prior research archive: receipts, CSVs, selected coefficient artifacts, source code, and provenance. Re-running the original capture and fits requires the excluded raw hidden-state/trace inputs, model weights, and suitable GPU access. The archive does not contain every raw training input or the model checkpoints. This lecture's archive counts and digest above refer only to the prior research closeout snapshot; the root agent will update the single ZIP after adding this lecture and its new email receipt.
342
+
343
+ ## What the results mean
344
+
345
+ The session supports five conclusions.
346
+
347
+ First, predictor quality and runtime benefit are separate. Qwen3.5 correction improves offline recall and slightly improves the corrected engine counters, but its measured E2E arms are still slower than reactive LRU. Candidate transfer traffic and fixed issue overhead are plausible explanations, as is the fact that LRU already captures repeated routes with a long token-scale lead. Physical bus saturation and the exact contribution of each latency component were not established: the PCIe witness used invalid sampling.
348
+
349
+ Second, the strongest Qwen3.8 offline rows are target-mix rows, but they pay mixer/head work and still have a transfer ratio above one. A target-mix carrier row can match the quality of target-mix anchor, yet it reads the full carrier. The state representation, stored artifact, and runtime compute must all be charged.
350
+
351
+ Third, rank is a hardware/software decision. Rank 128 can help Qwen3.5 M=8 offline, while rank 64 is the selected validation row at M=12 and M=16. Selection itself used held-out request-mean recall; measured head cost was applied afterward when judging practicality. The correct deployment decision combines held-out behavior with measured head cost, rather than treating rank in isolation.
352
+
353
+ Fourth, transfer layout matters, but the measured transfer result is narrow. A synthetic packed contiguous copy can be a few percent faster; tiling can be substantially slower. The data path still needs a real manifest, arbitrary-ID handling, coalescing, event dependencies, and consumer-safe cancellation before the number becomes a runtime claim.
354
+
355
+ Fifth, the negative result is useful. It tells us that improving a predictor's score is insufficient when the reactive cache and transfer schedule already dominate. The next design must optimize the entire chain: lead time, cache state, admission, readiness, transfer commands, and native compute.
356
+
357
+ ## Unexecuted next experiments
358
+
359
+ These are priorities, not completed results:
360
+
361
+ 1. Run a real Qwen3.5 E2E comparison with a preregistered noise threshold and enough independent requests to resolve sub-percent corrected-versus-router effects.
362
+ 2. Instrument physical PCIe/HBM traffic and expert readiness timestamps so software speculative-byte counters can be separated from actual bus movement.
363
+ 3. Exercise packed/coalesced transfer on arbitrary manifest-selected expert blocks, including non-contiguous IDs and cancellation.
364
+ 4. Measure a real dependent-fetch round trip and a priority DMA path; the synthetic transfer screen cannot provide those values.
365
+ 5. Test Qwen3.8 with a sharded or multi-GPU harness that can hold the approximately 360 GB model, preserving exact token identity and the carrier/mixer provenance.
366
+ 6. Re-evaluate M and rank jointly under measured bandwidth slack. A method should be admitted only when its candidate bytes can fit before the consumer deadline.
367
+ 7. Compare source-mix and target-mix under a fixed predictor budget, charging mixer compute, carrier read bytes, cache state, and readiness rather than comparing recall alone.
368
+
369
+ ## Glossary
370
+
371
+ | Term | Meaning |
372
+ |---|---|
373
+ | Anchor / router proxy | Early score `W_t h_s` computed from an earlier state. |
374
+ | Carrier | Qwen3.8 four-stream hyper-connection state, width 10,240. |
375
+ | Candidate breadth M | Number of speculative expert IDs proposed per token/layer. |
376
+ | Native K | Number of experts selected by the model's exact router. |
377
+ | Full-set coverage | Probability every native ID is in the candidate set. |
378
+ | Lead | Distance between prediction source and target consumption point. |
379
+ | Readiness | Whether required bytes are present in a consumer-usable state. |
380
+ | Reactive miss | A required expert absent or not ready when native routing asks for it. |
381
+ | Shrinkage | Scalar damping of a fitted score correction; Qwen3.5 selected 0.75 offline. |
382
+ | Rank r | Number of learned state directions used by the low-rank correction. |
383
+ | E2E | End-to-end token workload including model execution and transfer path. |
384
+ | Microbench | Isolated predictor or transfer measurement with a narrower scope. |
385
+
386
+ ## Source map
387
+
388
+ The most useful evidence and implementation references are:
389
+
390
+ * [`qwen35_qwen38_final_report.md`](../../research/results/predictor_hardware_20260915/qwen35_qwen38_final_report.md) — generated final comparison, offline tables, E2E effects, hardware scope, and limitations.
391
+ * [`qwen35_qwen38_final_report.receipt.json`](../../research/results/predictor_hardware_20260915/qwen35_qwen38_final_report.receipt.json) — input/output hashes, model revisions, seed, and report claims.
392
+ * [`qwen35_qwen38_final_comparison.csv`](../../research/results/predictor_hardware_20260915/qwen35_qwen38_final_comparison.csv) — machine-readable quality and cache traffic rows.
393
+ * [`qwen35_qwen38_final_hardware.csv`](../../research/results/predictor_hardware_20260915/qwen35_qwen38_final_hardware.csv) — 15 paired E2E rows and 276 predictor microbench rows; transfer confirmation rows are in the final report/receipt.
394
+ * [`method_metrics.md`](../../research/results/novel_predictor_tuning_20260916/method_metrics.md) — expanded offline method tables and provenance statements.
395
+ * [`novel_predictor_screen.py`](../../tools/novel_predictor_screen.py) — fitter, score-space corrections, carrier projection definitions, cost model, and controls.
396
+ * [`hyper_connection.py`](../../capture/hyper_connection.py) — Qwen3.8 carrier mixer implementation and tensor orientation.
397
+ * [`novel_predictor_tuning.py`](../../research/novel_predictor_tuning.py) — reducer that copies banked metrics into compact tables; it is not the fitter.
398
+ * [`result.json`](../../experiments/results/20260916T-analysis-qwen35-qwen38-final-report-v5/result.json) — final analysis receipt and claims.
399
+ * [`ENGINEER_HANDOFF.md`](../../ENGINEER_HANDOFF.md) — current environment, model pins, lifecycle, archive, and next-entry guidance.
400
+ * [`report.md`](../../research/results/predictor_hardware_20260915/report.md) — earlier Qwen3 closeout and E2E gate details.
401
+ * [`CODEBASE_ARCHITECTURE.md`](../20_software/CODEBASE_ARCHITECTURE.md) — controller, predictor, cache, manifest, backend, and testing contracts.
402
+ * [`EMPIRICAL_VALIDATION_PLAN.md`](../70_execution/EMPIRICAL_VALIDATION_PLAN.md) — project hypotheses, evidence gates, and the historical distinction between nominal simulation and measured runs.
403
+
404
+ ## Self-check questions
405
+
406
+ 1. For Qwen3.8, why is M=8 full-set coverage zero while recall@8 remains a valid ordinary native-ID coverage metric? How is that different from cache-aware miss coverage?
407
+ 2. Write the score decomposition `z_t = W_t h_s + W_t(h_t-h_s)`. Which term is unseen by the anchor?
408
+ 3. Why can a predictor with higher recall still increase total transfer?
409
+ 4. In the low-rank fit, what are the shapes of `D`, `U`, `Z`, and `Gamma`?
410
+ 5. Why does target-mix carrier quality require charging state-read bytes and mixer work even when stored artifact bytes are zero?
411
+ 6. Why are the Qwen3.5 offline sampled rows not interchangeable with the E2E workload rows?
412
+ 7. What does a negative corrected-versus-router ITL interval establish, and what does it fail to establish with n=3 requests?
413
+ 8. Why cannot the packed contiguous transfer result be reported as a model-level GPU gain?
414
+ 9. Which native decision remains authoritative in the runtime pipeline?
415
+ 10. What additional evidence is required before Qwen3.8 can receive a whole-model E2E claim?
416
+
417
+ ### Answers in brief
418
+
419
+ 1. Eight proposed IDs cannot contain ten native IDs, so full-set coverage is zero; recall@8 still measures native-ID overlap, while cache-aware miss coverage conditions on which IDs are resident. 2. The increment `W_t(h_t-h_s)` is unseen. 3. Extra candidates cost bytes and commands, and cache state changes the value of each candidate. 4. `D:[n,E]`, `U:[H,r]`, `Z:[n,r]`, `Gamma:[r,E]`. 5. Zero persistent artifact does not mean zero reads or compute. 6. They have different sampler/workload scopes and independence units. 7. It describes a small paired effect on this workload; it is not a broad speedup proof. 8. The payload is synthetic and contiguous, unlike arbitrary expert gathers. 9. The exact native router and its native weights. 10. A fitting sharded/multi-GPU harness with exact provenance and paired E2E controls.