I can't see the earlier thread, so I'm working from the numbers in this message. I flag every assumption below.
1. Path choice and the one measurement
Lean: Path B. Flex mode is the main reason, and it probably makes Path A's +19 ms an underestimate.
- Memory fit: I assume 24 GB total (16 dual-channel plus 8 single-channel). Q4_0 at 14.9 GB, plus OS, KV cache and the draft model, will almost certainly spill into the single-channel region. IQ3_XS at roughly 11 GB probably won't.
- Page placement: The OS doesn't prefer the fast region. Placement is partly luck, and it gets worse once memory is fragmented.
- Bandwidth blend: If 25% of the model's bytes land in the 12.5 GB/s zone, effective bandwidth is 1 / (0.75/25 + 0.25/12.5) = 20 GB/s.
- Revised cost of A: A's streaming grows from about 54 to about 74 ms (the ×1.36 byte growth that gives your +19 ms), then by another ×1.25 to about 92 ms. That is nearer +38 ms than +19 ms.
B's gain depends on how many tokens share each expert. Let r = U / (8T), where U is the unique experts per layer per verify forward and T is the verify width.
- B cuts unpack work from
8T row-unpacks to U. It saves a fraction 1 − r of the unpack time X.
- A removes most of X, leaving a residual ε (Q4_0 decoding is cheap but not free, so ε is roughly 0.2). It pays ΔS in extra streaming.
- A wins only if
ΔS < X·(r − ε). For example, with X = 40 ms, r = 0.8 and ε = 0.2, A saves 24 ms net of its residual. It breaks even against ΔS = 19 ms and loses against ΔS = 38 ms. I made up those inputs, so plug in your own.
The single measurement is U per layer per verify forward, logged at your real verify width. Log the histogram of distinct expert IDs per layer, and also log the unpack time X from your existing profile. That gives r and X, which settle the inequality.
A check you can do now with no new run: 54 ms × your achievable bandwidth is the bytes streamed per step. At about 19–25 GB/s, that is 1.0–1.35 GB. Suppose about 10 GB of the model is expert weights (my estimate). Then 1.0–1.35 GB is only 10–13% of the experts, or U ≈ 13–17 per layer.
- Under independence, that corresponds to T ≈ 2–3, not 4–8.
- So either the effective verify width was small, routing is much more correlated than independence predicts, or my expert-byte estimate is off.
- Treat this as a clue, not a result.
If you have the source weights, an end-to-end Q4_0 run on the real flex-mode box is also a good confirmation. It captures the placement penalty directly. Note that requantizing from IQ3_XS would be lossy.
2. Unique-expert growth from 4 to 8 tokens
Under independence, each token picks an expert with probability 8/128 = 1/16, so U(T) = 128·(1 − (15/16)^T).
| T | Slots (8T) | U, independent | U, moderate correlation (8·T^0.8) | U, strong correlation (8·T^0.7) |
|---|
| 4 | 32 | 29 | 24 | 21 |
| 8 | 64 | 52 | 42 | 34 |
| Growth 4→8 | ×2 | ×1.77 (+22) | ×1.74 (+18) | ×1.62 (+13) |
- The exponents are illustrative, not measured. Real routing has temporal and topical correlation, so reality should sit below the independence column. Your log will give the actual curve.
- Streaming grows with U, not with T. Going from 4 to 8 tokens costs roughly 1.6–1.8× the expert-streaming time, not 2×.
- Unpack work in the current kernel grows with 8T, not U. It doubles from 4 to 8 tokens.
- Sharing is weak, which limits B. Slots per unique expert (8T/U) are only about 1.1 at T = 4 and 1.2 at T = 8 under independence. Under strong correlation they are about 1.5 and 1.9. So B removes about 10–35% of unpack work at T = 4 and about 20–47% at T = 8.
Best verify width. Use the marginal rule, not the budget. The budget is a ceiling, not a target.
- For a chain draft with per-token acceptance p, tokens per step are
(1 − p^T)/(1 − p).
- Adding one more verified token adds about p^T tokens. It is worth it only if
p^T / tokens(T) > Δstep / step.
- Each extra token adds about 4–6 unique experts per layer at T = 4–8. That is about 60% of a batch-1 expert stream, plus its share of unpack.
A worked example, with assumed numbers: p = 0.75, step = 150 ms at T = 4, X = 40 ms.
- At T = 4, the gain from another token is 0.316/2.73 ≈ 11.6%.
- Its cost is about 11 ms streaming plus about 10 ms unpack with the current kernel, so 21 ms, or 14%. That is a slight loss.
- With B, the unpack part drops to about 6 ms, so the cost is 17 ms, or 11%. That is breakeven.
So with p around 0.75, the optimum is about 4–5 tokens. It moves to about 6–8 only if p ≥ 0.85 or so. At p around 0.7, it drops to 3–4. Measure p, because it matters as much as the kernel.
3. The one kernel change this week
Write the expert-grouped multi-token IQ3_XS verify kernel (Path B). Path A needs no kernel work, since it is just a requantization. If the logs show r above about 0.85 and X is large, run the Q4_0 test as a fallback.
- Layout: Group tokens by expert. Unpack each weight row or block once into int8 or registers. Then dot it against all tokens routed to that expert, with up to 8 accumulators. Quantize the activations once.
- Why B and not A:
- It doesn't change the memory footprint, so it avoids the flex-mode risk.
- Its payoff grows with verify width and with routing correlation, which are the directions you want to move.
- A's penalty is fixed and placement-dependent, and it doesn't improve as the verify width grows.
- The risk: If your logs show near-independent routing (r ≈ 0.9), B saves under 15% of unpack and isn't worth it. The U log tells you this before you write the kernel.