Repository navigation
qwen4_exp: MTP drafter absorbs verified rows and the prompt; dynamic-depth window (default-off, ported from Enntity) - #224
Merged
Merged
Conversation
Contributor
Author
This was referenced Oct 28, 2026
1 of 4 tasks
AzeezIsh
force-pushed
the
stack/qwen-mtp-absorb
branch
from
October 29, 2026 04:44
02e5aec to
b1ba01e
Compare
…QWEN4EXP_MTP_ABSORB) After each verify, the drafter's rows for the accepted drafts paired committed tokens with the drafter's OWN chained streams. vLLM and TensorFold re-run the MTP layer over the verified window with the target's streams instead. With ATLAS_QWEN4EXP_MTP_ABSORB=1 (default off, byte-identical) the scheduler stages the verify's accepted rows of the target's final mHC streams with the proposer (Model::stage_mtp_absorb -> DraftProposer::stage_absorb) at every verdict site (batched verify Phase 2, the K=2/3/4 single-sequence steppers), and the next propose rewinds the drafter to row 0 and rewrites those positions KV-only (TransformerLayer::decode_rows_kv_only, new: a one-layer drafter's KV row is a function of its own input row) before drafting as before. The batched propose's row-wise front (norm, fc_hidden, embedding branch) and body context move to qwen4exp_mtp_rows.rs, shared with the absorb. Rank-local (only rank 0 drafts, comm: None): no new worker command. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 166e2b1 of Enntity/atlas)
…=<rows>)
The drafter's KV started empty at each request, so its attention never saw
the prompt. vLLM and TensorFold run the MTP layer over the prompt, pairing the
target's final streams h_i with t_{i+1}. With ATLAS_QWEN4EXP_MTP_PREFILL=<rows>
(default off) each prefill capture point notes which highway rows hold the
chunk's final streams (DraftProposer::note_prompt_rows), and once the chunk's
prefill returns (logits computed; the passes reuse the activation buffers)
the drafter writes the last <rows> prompt positions KV-only, 64 rows a pass
(DraftProposer::absorb_prompt). The prompt's last row waits for the sampled
token, which the first propose hands over (DraftProposer::prompt_tail_token).
A restored prefix computed nothing and stays blind (only the computed suffix
is written); under the sequence-parallel prefill rank 0 writes its half of a
split chunk. A chunk that would leave less than 1/8 of the shared drafter KV
pool free is skipped. The batched row front takes explicit scratch
(RowScratch; the prompt passes use the pipelined BF16 GEMM), and the head's
constructor moves to qwen4exp_mtp_new.rs for the 500-LoC cap.
(cherry picked from commit e7d4e1a of Enntity/atlas; hand-resolved:
entry.rs hunk landed beside try_eager_drafter_prefill in
prefill_chunk_entry (same site, our file has an extra twophase caller),
and the note_mtp_prompt_rows call moved one statement up into
prefill_b_forward_layers, in front of the profile_tail call that holds
our tree's try_mtp_prefill_capture).
…opy runs decode_rows_kv_only computed Q+gate too (the bulk of the attention weight bytes) though a KV row never reads it: where the exact lane's K/V arm serves (NVFP4 K/V, scalar row tiers) it now projects K and V alone, then the shared q/k norms, RoPE and the cache write as before. The prompt passes copy each run of consecutive highway rows in one copy instead of one per row. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 73c19db of Enntity/atlas; applied cleanly, one -1-line offset in multi_seq/qkv.rs)
…ss fails absorb_rows returned early on an error before copying the saved highway rows back, leaving the propose to draft from the absorb's inputs. The passes move to absorb_passes; the restore runs whatever they return. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 18a54e9 of Enntity/atlas; applied cleanly)
…DEEP_WINDOW / _START) The per-request deep ceiling decides every 48 verifies from the floor (3), so a short reply spends most of its steps ramping. ATLAS_MTP_DEEP_WINDOW sets the verifies per decision (a quarter must have drafted the deepest position) and ATLAS_MTP_DEEP_START the ceiling a request starts at. Unset = as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 294d2ba of Enntity/atlas; applied cleanly)
…mpt rows With ATLAS_QWEN4EXP_MTP_PREFILL the drafter KV pool stayed one sequence's worth (max_seq_len / 16 + 1 blocks) shared by every sequence: eight sequences of 16,384 prompt rows held half of it for each request's lifetime on top of the decode rows, the 1/8 rule covered only the prompt rows, and once the pool ran dry a propose's alloc_block failed every step. The pool now holds max_seq_len + mtp_max_seqs x window rows when the switch is on (unchanged off), logged at startup. Cost at 8x262k (window 16,384, ATLAS_MTP_MAX_SEQS=8): +131,072 rows of 2 KB (2 KV heads x 256 x K/V x BF16), +256 MiB; at the default ATLAS_MTP_MAX_SEQS (32), +1 GiB. The pool is built with the proposer, after the target's KV pool is sized, so it comes out of the headroom the target's sizing left, not the target's KV tokens (measured on the pair: see the release verification). Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 5f086bd of Enntity/atlas; applied cleanly)
…r bounds - The absorb and the prompt rows check once that they can run (batched row kernels, the save buffer, a KV-only body: ATLAS_MTP_DRAFTER_QSA=1 gives the drafter an indexer, which has none), say so once, and otherwise leave the drafter as without them; before, each propose rewound the drafter and warned. - Absorb, prompt-row and pool-short failures log the 1st, 2nd, 4th, ... occurrence (warn_sparsely) instead of one line a step. - The prompt passes' 64-row save/restore and the chunk's rows are checked against hc_streams, as stage_mtp_absorb_dispatch checks its rows. - Startup refuses ATLAS_QWEN4EXP_MTP_PREFILL with the drafter-context prefill's old opt-in ATLAS_MTP_DRAFTER_PREFILL (both ask for drafter KV over the prompt; the default drafter context never writes this proposer's KV). - Src::Stage's comment says it is the rare chunk-boundary path. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 23350fb of Enntity/atlas; applied cleanly, one -18-line offset in drafter_prefill.rs)
…ll decode An #[ignore] GPU test on the real drafter (ATLAS_Q38_MTP_DIR): the same synthetic rows through decode_rows_kv_only and through decode_multi_seq_rows (the verify shape) must write byte-equal K/V rows from 4 rows up under the exact batching lane, and stay close below (other K/V arms there). Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 1aa8d99 of Enntity/atlas; applied cleanly, one -2-line offset in qwen4exp_mtp_absorb.rs)
…tial 030ec26) - decode_rows_kv_only takes its rows as one KvRows value (ported from Enntity/atlas 030ec26, AGPL-3.0-only): the shorter forwarder keeps qwen3_attention/trait_impl.rs under the 500-LoC cap, and matches the ported GPU parity test's call shape. - Register ATLAS_QWEN4EXP_MTP_ABSORB, _MTP_PREFILL and ATLAS_MTP_DEEP_WINDOW/_START for startup parity: drafter work splits across ranks under ATLAS_QWEN4EXP_MTP_DRAFT_TP, and the depth decisions steer every rank's verify. - Per-file port credit lines (sparkqwen drafter series).
File-level Ported-from-Enntity lines stay on the six files the series created; existing files carry a one-line // Ported from Enntity/atlas <sha> (AGPL-3.0-only). beside the ported item instead, and every module doc is back to its 0164cce first lines. Comments only.
AzeezIsh
force-pushed
the
stack/qwen-mtp-absorb
branch
from
October 29, 2026 07:12
b1ba01e to
71f6030
Compare
Left behind by the KvRows signature (030ec26 partial): under the real CUDA build the file has no DevicePtr use and #![deny(warnings)] fails the build (job 865, BUILD_EXIT=101). The ATLAS_SKIP_BUILD check misses it.
AzeezIsh
force-pushed
the
stack/qwen-mtp-absorb
branch
from
October 29, 2026 07:30
71f6030 to
74f0f29
Compare
AzeezIsh
marked this pull request as ready for review
October 29, 2026 07:39
1 of 2 tasks
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: main ← #198 ← #223 ← this ← queued-first-chunk PR. 12 commits, ported from Enntity/atlas (AGPL-3.0, SparkQwen's drafter series
166e2b1,e7d4e1a,73c19db,18a54e9,294d2ba,5f086bd,23350fb,1aa8d99); credit lines sit next to the ported code.Summary
ATLAS_QWEN4EXP_MTP_ABSORB=1: the drafter's KV absorbs the target's verified rows.ATLAS_QWEN4EXP_MTP_PREFILL=<rows>: drafter KV over the prompt.ATLAS_MTP_DEEP_WINDOW/_START: decision window for dynamic depth. All default-off and parity-registered. Draft-only: target tokens don't change.Measurements (vs its parent, receipts on #216;
git range-diffagainst the measured branch is=for all 12 commits)Test plan
Tracking: #220, #216.
Generated with Devin