Run chained MTP drafting in the batch Engine - #2459
Run chained MTP drafting in the batch Engine#2459Tianlei Wu (tianleiwu) wants to merge 4 commits into
Conversation
Run the paged MTP head repeatedly with a shrinking active request set so each request can use its configured draft length. Keep auxiliary request state and provisional cache rows transactional across chained forwards.
Track target and MTP head forwards plus committed draft proposal, evaluation, acceptance, and acceptance-length totals. Expose cumulative snapshots through the C, C++, and Python Engine APIs and cover aggregation and rollback semantics.
Chain MTP head stages through packed device input IDs and materialize draft tokens on the host only once before verification. Reuse Engine scratch storage and cover mixed draft lengths, acceptance, rollback, max-length clamping, cache reuse, and synchronization behavior.
H200 RC4 evidence (corrected true-plain control)Correctness: Controlled batch-1 throughput (1,024 generated tokens, K=3, medians): paged Engine versus dense RC2 eager is +2.96%, -5.08%, -3.63%, +1.97%, and -0.73% at 512, 2K, 8K, 32K, and 256K total context, respectively (geomean -0.95%). Versus pre-captured RC2 graphs the geomean is -6.33%; hybrid fixed-state Engine graph capture is not available yet. Quality gate (thinking, greedy, 8,192-token cap, historical seven-shard geometry):
The earlier result labeled plain was not plain: omitting request-level speculative options left model-configured MTP enabled. The corrected control proves the checkpoint-enabled target graph preserves historical quality when run without MTP. Disposition: the primary model configuration omits |
Quality follow-up (corrected)The result previously labeled plain still had model-configured MTP enabled. A true no-MTP control scores 54/64 on the focused diagnostic and 664/800 on MMLU-Pro, matching RC2/RC3 quality. K=1, K=2, and K=3 score 53/64, 51/64, and 48/64 at concurrency 16; K=3 returns to 54/64 at concurrency 1. Transactional state/checkpoint publication, verification-row selection, per-request bonus sampling, FP4/FP8 GEMV dispatch, paged attention selection, and isolated packed GatedDeltaNet state/checkpoints were tested and do not explain the divergence. The remaining mechanism is full-graph batch-shape numerical sensitivity during speculative target verification: mathematically valid target rows can follow different greedy trajectories in this quantized model. Release fix: use the true-plain configuration as the batch primary and a separate K=3, |
Rollback fix and corrected quality dispositionThis supersedes the earlier quality follow-ups in this thread. The continuous-batch regression was not inherent quantized batch-shape sensitivity: mixed prefill/speculative transactions could select chunked GatedDeltaNet, which does not populate the intermediate recurrent checkpoints needed for draft rejection. Commit Post-fix validation: 323/323 Engine tests; exact 438/438 batch-1 and 2,004/2,004 sustained-c16 tokens versus plain; MMLU-Pro 666/800 versus plain 664/800; GPQA 151/198 versus plain 147/198; zero unextracted answers in both. Batch-1 decode reaches 91.93 versus 49.02 tok/s (1.88x), and sustained c16 reaches 316.00 versus 288.55 tok/s (+9.5%). K=3 is therefore quality-safe for continuous batching with the safeguard. |
|
Superseded by #2495, which rebuilds the MTP batch-engine runtime on compact fixed-state replay and composite transactions without dense recurrent checkpoints or an ONNX Runtime dependency bump. |
Summary
Stack
PR 6/6. Depends on
tlwu/20260823/gdn-paged-mtp-config.Correctness fix
Packed recurrent operators choose one execution plan for the whole ragged batch. A long prefill can select chunked GatedDeltaNet, which publishes final state but not the intermediate recurrent checkpoints required to reject drafts. The Engine previously treated those checkpoint outputs as valid, so a rejected request could publish an uninitialized checkpoint and diverge on its next target call.
After paged selection, the composite cache planner now clears draft counts only when the selected transaction contains both prefill and draft rows. Decode requests still advance by one token, prefills continue, and K=3 resumes when the selected transaction is decode-only.
Validation
engine_unit_tests: 323/323 passedCompositeDefersDraftsWhilePrefillSharesTheStepregression passedgit diff --checkpassedRelease disposition
K=3 MTP is quality-safe for continuous batching with this safeguard. The prior batch-1-only disposition and numerical-shape explanation are superseded by the recurrent-checkpoint rollback root cause above. Keep the stack in draft pending CI.