MTP: GDN snapshot/restore across speculative steps (amd-qwen adapt) #136

Closed
opened 2026-09-30 09:08:36 +02:00 by tenstorrent · 10 comments
Member

Parent / blocked-by tracking via #90 (amd-qwen / tinygrad borrow-adapt lane).

Grill call: WATCH (desk-only — needs metal/vllm-tt / GDN state semantics first)

Hypothesis. Snapshot/restore or reuse of GDN recurrent state across speculative MTP steps can cut recompute or make verify/commit cheaper when draft paths share a prefix of GDN evolution. AMD path suggests state reuse; TT GDN already has scalar-commit / commit_verify_slot semantics (#63) — this is an adapt, not a copy.

Source. tinygrad / jacobrosenthal amd-qwen-on-master (AMD ROCm Qwen3.8). External — not TT silicon claims.

Depends on. MTP+GDN inventory on #63 / #82; clear desk model of which GDN tensors are live vs committed under verify_K.

Measure first. Desk: instrument one speculative round — count GDN state bytes touched on draft vs verify vs commit; estimate snapshot cost vs full recompute. Only then propose a metal/vllm-tt hook.

Out of scope. Changing production GDN dtype gates; RDNA kernels; shipping a restore path before the byte/cost model exists.

Refs: #90; related #82/#63 MTP+GDN; grill 2026-09-29/30 Tenstorrent amd-qwen eval.

Parent / blocked-by tracking via #90 (amd-qwen / tinygrad borrow-adapt lane). ## Grill call: **WATCH** (desk-only — needs metal/vllm-tt / GDN state semantics first) **Hypothesis.** Snapshot/restore or reuse of GDN recurrent state across speculative MTP steps can cut recompute or make verify/commit cheaper when draft paths share a prefix of GDN evolution. AMD path suggests state reuse; TT GDN already has scalar-commit / `commit_verify_slot` semantics (#63) — this is an *adapt*, not a copy. **Source.** tinygrad / jacobrosenthal amd-qwen-on-master (AMD ROCm Qwen3.8). External — not TT silicon claims. **Depends on.** MTP+GDN inventory on #63 / #82; clear desk model of which GDN tensors are live vs committed under verify_K. **Measure first.** Desk: instrument one speculative round — count GDN state bytes touched on draft vs verify vs commit; estimate snapshot cost vs full recompute. Only then propose a metal/vllm-tt hook. **Out of scope.** Changing production GDN dtype gates; RDNA kernels; shipping a restore path before the byte/cost model exists. Refs: #90; related #82/#63 MTP+GDN; grill 2026-09-29/30 Tenstorrent amd-qwen eval.
Owner

Eval (2026-09-30): WATCH → fold into #63 as p5 lever 2, decided by c115. Full write-up: docs/ISSUES-133-137-EVAL-2026-09-30.md.

  • The snapshot is already free. Every GDN forward is functional in its state (e698791), so a snapshot is just a kept reference.
  • The real cost is the commit: a where-chain plus copy over T candidates, ~3.3 GB/step, est 15-20 ms at B=8 (MTP-BATCH.md §2b). On top of that, T sequential GDN sub-steps at est ~2.7 ms each.
  • The adapted form is already ranked: a per-row state-slot index in decode_gated_delta_rule_packed (the vLLM K+1-slot model, no copy). Est −15-17 ms/step, bit-exact, 2 days of C++. Upstream #55548 output_per_token_state=True covers the sub-step half.
  • Byte model (est): 24 heads × 128² × fp32 = 1.5 MiB per layer per user per card, × 48 layers = 72 MiB/user (matches LEDGER R-2026-09-25-kvbudget).
  • E2E (est, dn): plain TG fell to 29.4/38.0 ms, so break-even is ≈78/101 ms per step. Lever 2 alone: 4k 87 → ~71 ms, which could win; 32k 121 → ~105 ms, which still loses. 32k also needs the NKV=2 SDPA fold. MTP at batch is still dead at B=4/8 (bench/runs/perf-loop-c69d-mtp-batch-verdict-20260927T1644Z.jsonl).
  • Experiment: the c115 -mtp-tm rung, already queued. Promote the C++ if commit > 12 ms; deprioritise if < 8 ms. Must-fail for the build: slot+1 must FAIL equiv.
  • Priority: no separate work; it rides on c115.

🤖 Generated with Claude Code

**Eval (2026-09-30): WATCH → fold into #63 as p5 lever 2, decided by c115.** Full write-up: `docs/ISSUES-133-137-EVAL-2026-09-30.md`. - **The snapshot is already free.** Every GDN forward is functional in its state (e698791), so a snapshot is just a kept reference. - **The real cost is the commit:** a where-chain plus copy over T candidates, ~3.3 GB/step, est 15-20 ms at B=8 (MTP-BATCH.md §2b). On top of that, T sequential GDN sub-steps at est ~2.7 ms each. - **The adapted form is already ranked:** a per-row state-slot index in `decode_gated_delta_rule_packed` (the vLLM K+1-slot model, no copy). Est −15-17 ms/step, bit-exact, 2 days of C++. Upstream #55548 `output_per_token_state=True` covers the sub-step half. - **Byte model (est):** 24 heads × 128² × fp32 = 1.5 MiB per layer per user per card, × 48 layers = 72 MiB/user (matches LEDGER `R-2026-09-25-kvbudget`). - **E2E (est, dn):** plain TG fell to 29.4/38.0 ms, so break-even is ≈78/101 ms per step. Lever 2 alone: 4k 87 → ~71 ms, which could win; 32k 121 → ~105 ms, which still loses. 32k also needs the NKV=2 SDPA fold. MTP at batch is still dead at B=4/8 (`bench/runs/perf-loop-c69d-mtp-batch-verdict-20260927T1644Z.jsonl`). - **Experiment:** the c115 `-mtp-tm` rung, already queued. Promote the C++ if `commit` > 12 ms; deprioritise if < 8 ms. Must-fail for the build: slot+1 must FAIL equiv. - **Priority:** no separate work; it rides on c115. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Owner

c115 timing (B=8 K=3, dn, synced split): commit phase 16.0 ms/step flat 4k and 32k (> 12 ms trigger) -> per-row state-slot commit is being built (branch mtp-state-slot, QWEN36_MTP_STATE_SLOT). verify 56.2 -> 90.0 ms 4k->32k (SDPA fold next). Record bench/runs/ttx-sweep32k-prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-mtp-tm-20260930T130345Z.jsonl

c115 timing (B=8 K=3, dn, synced split): commit phase 16.0 ms/step flat 4k and 32k (> 12 ms trigger) -> per-row state-slot commit is being built (branch mtp-state-slot, QWEN36_MTP_STATE_SLOT). verify 56.2 -> 90.0 ms 4k->32k (SDPA fold next). Record bench/runs/ttx-sweep32k-prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-mtp-tm-20260930T130345Z.jsonl
Owner

c128 (TP=2, B=8, K=3, dn arm, branch mtp-state-slot): the per-row GDN state slot is the #136 answer to snapshot/restore. It uses no where-chain or copy. Commit went 16.04 -> 2.65 ms per step (synced timing). E2E vs PLAIN_ONLY: B8/4k wall -6.64% (TG 27.25 ms), B8/32k +3.40% (TG 40.72). vs K=3 without the slot: -12.1% / -5.3%. PP unchanged (3,633 / 5,204 tok/s). Must-fail commit+1 fails 8/8; the slot is 7/8 EXACT over 128 tokens, and p5 diverges at token 118, unclassified (no logprobs). Verify is now 78-84% of the step (56 ms at 4k, 88 at 32k), and the SDPA multi-position fold targets it next. c129 repeats this on the k8v4 best arm. Record: bench/runs/perf-loop-c128-mtp-slot-verdict-20260930T1500Z.jsonl. 🤖 Generated with Claude Code

c128 (TP=2, B=8, K=3, dn arm, branch mtp-state-slot): the per-row GDN state slot is the #136 answer to snapshot/restore. It uses no where-chain or copy. Commit went 16.04 -> 2.65 ms per step (synced timing). E2E vs PLAIN_ONLY: B8/4k wall -6.64% (TG 27.25 ms), B8/32k +3.40% (TG 40.72). vs K=3 without the slot: -12.1% / -5.3%. PP unchanged (3,633 / 5,204 tok/s). Must-fail commit+1 fails 8/8; the slot is 7/8 EXACT over 128 tokens, and p5 diverges at token 118, unclassified (no logprobs). Verify is now 78-84% of the step (56 ms at 4k, 88 at 32k), and the SDPA multi-position fold targets it next. c129 repeats this on the k8v4 best arm. Record: bench/runs/perf-loop-c128-mtp-slot-verdict-20260930T1500Z.jsonl. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Owner

c129 (k8v4 best arm, TP=2, B=8, K=3): the state slot is -6.5% at 4k vs PLAIN_ONLY (39.85 vs 42.64 s, TG 27.43 ms) and +1.1% at 32k (88.92 s, TG 37.94). The slot and the where-chain diverge from plain at the same place (p3@105), so the slot is output-identical to the where-chain. GSM8K 291/300; retrieval 1.0 early and late at 16k and 32k. It still trails the resident+async best arm by ~9% (36.58 / 81.39 s), because MTP arms run without resident/async (+16.6% on the plain path). Next: the SDPA fold (c130) plus device accept with resident/async. Record: bench/runs/perf-loop-c129-k8v4-mtp-verdict-20260930T1640Z.jsonl 🤖 Generated with Claude Code

c129 (k8v4 best arm, TP=2, B=8, K=3): the state slot is -6.5% at 4k vs PLAIN_ONLY (39.85 vs 42.64 s, TG 27.43 ms) and +1.1% at 32k (88.92 s, TG 37.94). The slot and the where-chain diverge from plain at the same place (p3@105), so the slot is output-identical to the where-chain. GSM8K 291/300; retrieval 1.0 early and late at 16k and 32k. It still trails the resident+async best arm by ~9% (36.58 / 81.39 s), because MTP arms run without resident/async (+16.6% on the plain path). Next: the SDPA fold (c130) plus device accept with resident/async. Record: bench/runs/perf-loop-c129-k8v4-mtp-verdict-20260930T1640Z.jsonl 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Owner

c132 (TP=2, B=8, K=3, k8v4 slot + overlap/async/early-reseed bundle, branch mtp-async): 37.50 s at 4k (-12.0% vs PLAIN_ONLY, -6.0% vs sync slot) and 87.80 s at 32k (-0.1% / -2.8%). The same-day best arm (no MTP) is 36.61 / 81.73, so the bundle is still +2.4% / +7.4% behind. Effective decode (wall - TTFT max)/1024 is 30.4 / 41.6 ms vs 29.5 / 35.7; the batch tail (buckets 1-2 run plain, non-resident) is suspected, and c132c tests speculating in buckets 1,2. Equiv NEAR_TIE (exact tie p3@105, gap 0) and must-fail fails. Synthesis in docs/PERF-LOOP-SYNTHESIS.md. 🤖 Generated with Claude Code

c132 (TP=2, B=8, K=3, k8v4 slot + overlap/async/early-reseed bundle, branch mtp-async): 37.50 s at 4k (-12.0% vs PLAIN_ONLY, -6.0% vs sync slot) and 87.80 s at 32k (-0.1% / -2.8%). The same-day best arm (no MTP) is 36.61 / 81.73, so the bundle is still +2.4% / +7.4% behind. Effective decode (wall - TTFT max)/1024 is 30.4 / 41.6 ms vs 29.5 / 35.7; the batch tail (buckets 1-2 run plain, non-resident) is suspected, and c132c tests speculating in buckets 1,2. Equiv NEAR_TIE (exact tie p3@105, gap 0) and must-fail fails. Synthesis in docs/PERF-LOOP-SYNTHESIS.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Owner

c133 (TP=2, k8v4 slot arm): QWEN36_GDN_MULTITOKEN is INERT. At T=8/B=4 the wall is 43.88/68.45 s against a same-session control band of 43.99-44.32 / 68.41-68.72 s, verify 75.1/99.2 vs 75.6/99.8 ms. At T=4/B=8 it is +0.9%/+1.4% wall, verify +2 ms. The boot self-test is bit-exact on hardware. So the verify slope is not the GDN launches. The remaining path to 9-15-token drafts is the SDPA fold (0034, -30 ms at B8/32k) plus the head-pack. Record: bench/runs/perf-loop-c133-gdn-multitoken-verdict-20260930T2240Z.jsonl. c135 (the full MTP stack vs the best arm) is running.

c133 (TP=2, k8v4 slot arm): QWEN36_GDN_MULTITOKEN is INERT. At T=8/B=4 the wall is 43.88/68.45 s against a same-session control band of 43.99-44.32 / 68.41-68.72 s, verify 75.1/99.2 vs 75.6/99.8 ms. At T=4/B=8 it is +0.9%/+1.4% wall, verify +2 ms. The boot self-test is bit-exact on hardware. So the verify slope is not the GDN launches. The remaining path to 9-15-token drafts is the SDPA fold (0034, -30 ms at B8/32k) plus the head-pack. Record: bench/runs/perf-loop-c133-gdn-multitoken-verdict-20260930T2240Z.jsonl. c135 (the full MTP stack vs the best arm) is running.
Owner

c135: the MTP-at-batch stack (K=3 + state slot + overlap/async/early reseed + SDPA spec fold 0034 + buckets 1,2,4,8) is now the best arm (LEDGER R-2026-10-01-mtp-stack, PR #140). Against a same-session best-arm band of <=0.14%: B8/32k -4.6%, B4/32k -8.2%, B4/4k -6.5%, B8/4k +0.8%. Effective decode at B8/32k goes from 35.7 to 31.9 ms. equiv NEAR_TIE, the must-fail fails 8/8, retrieval 1.0 early and late, GSM8K 292/300.

c135: the MTP-at-batch stack (K=3 + state slot + overlap/async/early reseed + SDPA spec fold 0034 + buckets 1,2,4,8) is now the best arm (LEDGER R-2026-10-01-mtp-stack, PR #140). Against a same-session best-arm band of <=0.14%: B8/32k -4.6%, B4/32k -8.2%, B4/4k -6.5%, B8/4k +0.8%. Effective decode at B8/32k goes from 35.7 to 31.9 ms. equiv NEAR_TIE, the must-fail fails 8/8, retrieval 1.0 early and late, GSM8K 292/300.
Owner

c139: the MTP warm tail (2048) + K by bucket (8:2, 4:3, 2:3, 1:3) is now the best arm (LEDGER R-2026-10-01-mtp-warm-kb, PR #141). Against a 3-run stack control: B8/32k -2.7% (75.65 s), B8/4k -5.3%, B4/4k -6.5%, B4/32k -0.8% (in band). Acceptance at B8, K=3 goes from 0.561 to 0.608. Gates are clean (equiv NEAR_TIE, GSM8K 293/300, retrieval 1.0 early and late). The 2x2 interaction terms are in the LEDGER entry.

c139: the MTP warm tail (2048) + K by bucket (8:2, 4:3, 2:3, 1:3) is now the best arm (LEDGER R-2026-10-01-mtp-warm-kb, PR #141). Against a 3-run stack control: B8/32k -2.7% (75.65 s), B8/4k -5.3%, B4/4k -6.5%, B4/32k -0.8% (in band). Acceptance at B8, K=3 goes from 0.561 to 0.608. Gates are clean (equiv NEAR_TIE, GSM8K 293/300, retrieval 1.0 early and late). The 2x2 interaction terms are in the LEDGER entry.
Member

Shipped: snapshot/restore across speculative steps resolved as state-slot → state-once → so1-csplit (R-2026-10-03-so1-csplit; STATE_ONCE + SO1_CSPLIT banners in bench/arms/ship-cdr8g.toml). Verified 2026-11-18.

Shipped: snapshot/restore across speculative steps resolved as state-slot → state-once → so1-csplit (R-2026-10-03-so1-csplit; STATE_ONCE + SO1_CSPLIT banners in bench/arms/ship-cdr8g.toml). Verified 2026-11-18.
Owner

agent-gateway closeout (closed): cleared agent:* labels.
Hermes kanban card (if any) is left for Hermes to archive/complete.

agent-gateway closeout (closed): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
bitpartner/tt-stack#136
No description provided.