From fcd3827122858606444e92900b532b730c49570f Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 28 Nov 2026 00:40:06 +0100 Subject: [PATCH 1/9] spec(ENG-CHUNKED-PREFILL): prefill graph formation mirrors the oracle's ubatch chunking The W1 Inkling-2-Mini gate is red at raw j=5 because llama-server abca69200 (-b 16 -ub 16) computes a 10-token prompt in graphs of 1,2,6,4 tokens while our engine packs the whole scheduled range into one forward; ggml's batched accumulation is shape-dependent, so per-position Kcur differs exactly where the oracle's 6-token graph ran (projection accumulation at pos 1,3,4, conv state hand-off at 2,5,6,7; kernels and quantization bit-identical). This row adds the missing engine seam: a prefill ubatch knob, the llama.cpp split rule pinned from source, and bit-exact state hand-off, so a gate that pins the oracle's serving batch shape can also match its graph formation. Model-local consumption rides the W1 row. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [maki] --- .../ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md | 19 ++ .agents/specs/chunked-prefill.md | 167 ++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 .agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md create mode 100644 .agents/specs/chunked-prefill.md diff --git a/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md b/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md new file mode 100644 index 000000000..a3e1f6c90 --- /dev/null +++ b/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md @@ -0,0 +1,19 @@ +ID: ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J +Title: Prefill graph formation must follow the oracle server's ubatch chunking +Row: ENG-CHUNKED-PREFILL +State: OPEN +Kind: bug +GitHub: - +Mirror: PENDING +Availability: FULL +Created: 2026-11-27 +Updated: 2026-11-27 +Closed: - + +## Problem + +Our CPU prefill computes projections one token at a time (per-token matvec), so ggml-shape-dependent batched GEMM accumulation never matches a serving oracle that forms multi-token ubatches. Measured on Inkling-2-Mini W1: llama-server abca69200 with -b 16 -ub 16 forms prefill graphs of 1,2,6,4 tokens for a 10-token prompt; oracle Kcur differs from ours ~2e-4..4e-4 exactly at the positions the oracle's 6-token graph computes (evidence .agents/evidence of the W1 lane, focused.log 2026-11-27 per-position preconv/postconv table), and the exact token gate flips at raw j=5 (151663 vs 161721). Inputs match ULP; quantization matches byte-for-byte; the divergence is batch-shape-dependent matmul accumulation plus conv-state hand-off across graph boundaries. Our scheduler has token-budget chunking, but the prefill forward does not form ubatch-style multi-token graphs and --max-num-batched-tokens does not change graph formation. + +## Resolution + +- diff --git a/.agents/specs/chunked-prefill.md b/.agents/specs/chunked-prefill.md new file mode 100644 index 000000000..fcda7dd2f --- /dev/null +++ b/.agents/specs/chunked-prefill.md @@ -0,0 +1,167 @@ +# Row: ENG-CHUNKED-PREFILL — Prefill graph formation mirrors the serving oracle's ubatch chunking + +Status: ACTIVE (spec committed before implementation) +Issue: `.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md` +Base SHA: `891c4f27d` +Git integration: repository default — one pull request carries this spec and its +implementation (no recorded developer answer for this row, no split case). + +## Scope + +The engine's prefill path forms ONE forward per scheduler step: the runner packs +every scheduled token row into a single `ModelRegistry::Forward` call +(`src/vllm/v1/worker/gpu/runner.cpp:3273`, `prepare_inputs.cpp:2182`). A +whole-prompt prefill below the token budget therefore computes all positions in +one graph. A serving oracle that mirrors llama.cpp splits the same prompt into +ubatches (`-b`/`-ub`), and llama.cpp's batched GEMM accumulation is +shape-dependent: per-position results differ between one T=10 graph and the +ubatch sequence the oracle actually ran. + +This row adds the missing chunk dimension: a model-facing prefill ubatch +(`n_ubatch`) split at the runner/model boundary that mirrors llama.cpp's batch +splitting, so a gate that pins the oracle's serving batch shape can also match +its graph formation. `--max-num-batched-tokens` (the scheduler token budget) +stays the scheduler-level knob; this row adds the ubatch-level knob and its +split rules. + +In scope: + +- An engine-level prefill chunk size (the `-ub` analog), plumbed from + `EngineParams`/CLI through the runner to the forward boundary. +- The split rule that turns a scheduled token range into chunks, pinned from + llama.cpp source at the oracle revision (see Upstream anchors). +- Conv/recurrent-state hand-off across chunk boundaries, mirroring how + llama.cpp carries hybrid state from one ubatch to the next. +- A focused test proving the chunk sequence for a fixed prompt shape. + +Out of scope: + +- Model-local rewrites of per-token loops (the consuming model port owns its + forward; the W1 Inkling-2-Mini row consumes this seam in its own change). +- Scheduler-level token-budget behavior (already landed, + `ResolveMaxNumBatchedTokens`, `model_loader.cpp:1365`). +- Partial-prefill concurrency (`max_num_partial_prefills`) — separate row. +- vLLM parity of the split rule itself: vLLM's CUDA path does not expose + llama.cpp's ubatch concept; this seam exists because our GGUF/CPU lane is + gated against llama.cpp. The vLLM-mirror obligation for scheduler chunking is + already discharged; this row is the llama.cpp-parity lane and states so + explicitly. + +## Upstream anchors + +- Oracle: llama.cpp `abca69200` (pinned in the W1 row's evidence, + `docs/bench-evidence/new-candidate-inkling2-w1-20261125/oracle-revision.txt`). +- Batch splitting: `src/llama-batch.cpp`, `llama_batch_allocr::split` and + `llama_batch_allocr::ubatch_add` at `abca69200` — the implementer pins the + exact rule (file:line) before coding. The observed denominator: a 10-token + prompt with `-b 16 -ub 16` produced graphs of **1, 2, 6, 4 tokens** in one + request (`focused.log` 2026-11-26 record); the 1-token graph is the first + prefill graph, warmup graphs are separate and excluded by `--no-warmup`. +- Server prompt processing loop: `tools/server/server.cpp` prompt-processing + path at `abca69200` (how the server hands batches to the context). +- Hybrid state carry: `src/llama-context.cpp` / `src/llama-graph.cpp` + memory-hybrid input handling at `abca69200`. + +## Design + +1. `EngineParams` gains a prefill ubatch field (0 = default). CLI/server flag + follows the existing knob pattern (`--max-num-batched-tokens`, + `examples/bench/main.cpp:124`). Default preserves current behavior where the + whole scheduled range is one chunk (no silent gate change for existing + models). +2. The runner applies the split rule to the scheduled token range BEFORE + building forward input, producing an ordered chunk sequence. Each chunk is + one `ModelRegistry::Forward` call with the chunk's token rows. Conv/recurrent + state inputs (the model's cached-state slots) must be read and written at + chunk boundaries exactly as llama.cpp does: the state entering chunk k+1 is + the state chunk k wrote. +3. The split rule is transcribed, not invented: pin the llama.cpp rule from + source, record `file:line` in this spec's Outcome, and encode the rule in one + function with a table test. The observed 10-token/`-ub 16` sequence + (1, 2, 6, 4) is the concrete case. +4. Bit-parity contract: with the oracle's serving batch shape pinned + (`-b`/`-ub` equivalents) and this row's chunking enabled, a consuming model + port running the exact token gate must reproduce the oracle's graph + boundaries and its per-position arithmetic. The kernel-selection rule + (nrc by batch shape) is already landed in the tree + (`vt::cpu::QuantMmlaVecDot`, shape-selected). + +## Risks + +- R1: The pinned split rule may not reproduce 1,2,6,4 from first principles + (the observed sequence could depend on server-side prompt-cache state, not + only `-b`/`-ub`). Evidence: the W1 probe with growing prefixes hit cache hits + and produced no further graphs (`focused.log` 2026-11-26). Mitigation: pin + from `llama-batch.cpp` source, not from logs alone; if source and observation + disagree, stop and report `NEEDS_DECISION` — do not invent a rule that fits + the logs. +- R2: Within-graph position dependence is not yet fully explained: in the W1 + per-position table, position 1 (inside the oracle's 2-token graph) differs + pre-conv at 2.0e-4 while position 0 (same graph) matches at 9.1e-8. Chunking + alone may not close the residue. Mitigation: this row lands the seam + tests; + the consuming row's gate is the judge. If the gate stays red with boundaries + matched, the residue hunt returns to the consuming row with the new + instrument (planner-allocated wdata capture) — that is a stop condition for + THIS row's parity claim, not a failure of the seam. +- R3: Chunking the forward multiplies graph-build overhead per prefill. The + default (one chunk) must keep existing benchmarks byte-identical in behavior; + the enabled path is opt-in via the knob, and the consuming gate sets it to + the oracle's shape. +- R4: Conv-state hand-off across boundaries is where the postconv-only + differences (positions 2, 5, 6, 7 in the W1 table) live. The hand-off must be + proven state-exact, not approximately carried: the focused test asserts the + entering state of chunk k+1 equals the written state of chunk k bit-for-bit. + +## Tests + +Red-first, smallest failing test first: + +- T1: the split-rule function, table-driven: 10-token prompt with ub=16 yields + chunks (1, 2, 6, 4); boundary cases (prompt <= ub, prompt == ub, prompt > + ub with remainder, multi-sequence ranges) each asserted against the pinned + rule. RED before the rule exists. +- T2: runner-level: with the knob set, one scheduled prefill step of N tokens + produces N_chunk forward calls with the pinned chunk sizes, in order. RED + before plumbing. +- T3: state hand-off: chunk k+1's input state equals chunk k's output state + (bit-for-bit on a synthetic model). RED before the hand-off exists. +- T4: default inertness: knob unset → exactly one forward call per step, + unchanged from today. Guards R3. + +## Gates + +- Full gate on the touched targets; preflight `--staged` before commit. +- The exact token gate that judges this row's parity is the consuming model + row's gate (Inkling-2-Mini W1: raw j=5 flips 151663 → 161721 with chunking + enabled at the oracle's shape). That flip is recorded here as evidence when + it lands; until then this row's own gates are T1–T4 plus the full suite. +- No tolerance change, no distributional gate. The gate is token-exact. + +## Evidence + +- W1 lane record: `/tmp/inkling2-w1/docs/bench-evidence/new-candidate-inkling2-w1-20261125/focused.log` + (2026-11-26 graph-boundary observation; 2026-11-27 per-position + preconv/postconv table; kernel four-way bit-identity; instrument attempts). +- Oracle server logs with `-b 16 -ub 16` behavior: same directory. +- Tap build: `/tmp/llamacpp-inkling-tap` (scratch worktree at `abca69200`), + captures under `/tmp/inkling-ref/master-abca69200/`. + +## Stop conditions + +- The pinned llama.cpp split rule contradicts the observed 1,2,6,4 sequence and + no source-level explanation exists → stop, report `NEEDS_DECISION` with both + readings. Never encode a fitted rule. +- Chunk boundaries match and the consuming gate stays red with a residue + explainable only by a new mechanism → this row lands its seam and tests, and + files the follow-up on the consuming row. Do not expand this row's scope into + kernel arithmetic (that lane is proven bit-identical already). +- Any change that would alter default-path behavior (knob unset) beyond the + declared inertness contract → stop, revise the spec first. + +## Owed + +- Split-rule mirror for multi-sequence mixed prefill/decode steps beyond the + single-request prefill case (T2 covers single-request; concurrency shapes are + a follow-up once a consuming gate needs them). +- vLLM-side anchor for the ubatch concept does not exist; if vLLM later gains a + matching surface, reconcile this seam onto it and record the change here. From fa55078bc17172fffa7fac975fab4543ca90cc96 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 29 Nov 2026 06:56:14 +0100 Subject: [PATCH 2/9] docs(ENG-CHUNKED-PREFILL): amend the spec to the pinned server checkpoint split The decisive instrumented experiment (two clean passes, exact 10-token golden prompt, cache_prompt=false, -b 16 -ub 16) observed the oracle's real prefill formation: ubatches 6 then 4, produced by the llama-server pre_decode checkpoint policy (checkpoint_offsets {4+n_ubatch, 4}, upstream PR #20288), NOT llama-batch.cpp splitting, which fills greedily and never splits a 10-token prompt at ub=16. The record's 1- and 2-token graphs are load-time probes that survive --no-warmup, which resolves the 13!=10 contradiction and falsifies the original spec anchor; T1 is retargeted to (6,4) with a checkpoints-disabled boundary case, and the residue analysis loses the probe-graph attribution. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [maki] --- .agents/specs/chunked-prefill.md | 77 +++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 27 deletions(-) diff --git a/.agents/specs/chunked-prefill.md b/.agents/specs/chunked-prefill.md index fcda7dd2f..cacd6978b 100644 --- a/.agents/specs/chunked-prefill.md +++ b/.agents/specs/chunked-prefill.md @@ -29,7 +29,9 @@ In scope: - An engine-level prefill chunk size (the `-ub` analog), plumbed from `EngineParams`/CLI through the runner to the forward boundary. - The split rule that turns a scheduled token range into chunks, pinned from - llama.cpp source at the oracle revision (see Upstream anchors). + llama.cpp source at the oracle revision (see Upstream anchors). The pinned + mechanism is the SERVER prompt-fill checkpoint policy, not `llama-batch.cpp` + splitting (amended 2026-11-29 after the decisive experiment, below). - Conv/recurrent-state hand-off across chunk boundaries, mirroring how llama.cpp carries hybrid state from one ubatch to the next. - A focused test proving the chunk sequence for a fixed prompt shape. @@ -49,18 +51,37 @@ Out of scope: ## Upstream anchors -- Oracle: llama.cpp `abca69200` (pinned in the W1 row's evidence, - `docs/bench-evidence/new-candidate-inkling2-w1-20261125/oracle-revision.txt`). -- Batch splitting: `src/llama-batch.cpp`, `llama_batch_allocr::split` and - `llama_batch_allocr::ubatch_add` at `abca69200` — the implementer pins the - exact rule (file:line) before coding. The observed denominator: a 10-token - prompt with `-b 16 -ub 16` produced graphs of **1, 2, 6, 4 tokens** in one - request (`focused.log` 2026-11-26 record); the 1-token graph is the first - prefill graph, warmup graphs are separate and excluded by `--no-warmup`. -- Server prompt processing loop: `tools/server/server.cpp` prompt-processing - path at `abca69200` (how the server hands batches to the context). -- Hybrid state carry: `src/llama-context.cpp` / `src/llama-graph.cpp` - memory-hybrid input handling at `abca69200`. +Oracle: llama.cpp `abca69200` (pinned in the W1 row's evidence, +`docs/bench-evidence/new-candidate-inkling2-w1-20261125/oracle-revision.txt`). + +AMENDED 2026-11-29 — the decisive instrumented experiment (two clean passes, +exact 10-token golden prompt, `cache_prompt=false`, `--no-warmup`, `-b 16 +-ub 16`; logs `/tmp/ubatch-exp-pass{1,2,5,6,7}.log`; fprintf at the ubatch +consumption point `/tmp/llamacpp-inkling-tap/src/llama-context.cpp:2355`) +observed the oracle's real prefill graph formation and falsified the original +anchor: + +- The observed prefill sequence is **6, then 4** ubatches (`tokens_evaluated=10`). +- The 6/4 split is the **server prompt-fill checkpoint policy**: + `tools/server/server-context.cpp` `pre_decode()` breaks the fill early at + `checkpoint_offsets[] = {4 + n_ubatch, 4}` when + `task->n_tokens() == prompt_n + min(n_batch, offset)` (upstream PR #20288, + `n_ctx_checkpoints` default ON for completion tasks). It is NOT + `llama-batch.cpp` splitting: `llama_memory_hybrid_iswa::init_batch` + (`src/llama-memory-hybrid-iswa.cpp:92`) calls + `split_equal(n_ubatch, ..., n_keep_tail = n_rs_seq > 0 ? n_rs_seq+1 : 0)`; + with `n_rs_seq = 0` the fill is greedy — one ubatch per server batch + (`src/llama-batch.cpp:665-833`, `split_equal`, `split_seq`, `split_simple`, + `ubatch_add`). +- **The 1- and 2-token graphs in the old W1 record are LOAD-TIME PROBES**, not + prompt tokens: the 2-token graph fires before `srv load_model: initializing` + and survives `--no-warmup`. This resolves the record's internal contradiction + (1+2+6+4 = 13 ≠ 10). Probe graphs are excluded by CONSTRUCTION (they precede + serving), not by `--no-warmup` — the original spec's claim is falsified and + stands withdrawn. +- Server anchor: `tools/server/server-context.cpp` `pre_decode()` at + `abca69200` — the implementer pins the exact checkpoint-offset rule + (file:line) and encodes IT, not a fitted sequence. ## Design @@ -78,7 +99,8 @@ Out of scope: 3. The split rule is transcribed, not invented: pin the llama.cpp rule from source, record `file:line` in this spec's Outcome, and encode the rule in one function with a table test. The observed 10-token/`-ub 16` sequence - (1, 2, 6, 4) is the concrete case. + (6, 4) is the concrete case; load-time probe graphs are excluded by + construction, not by `--no-warmup`. 4. Bit-parity contract: with the oracle's serving batch shape pinned (`-b`/`-ub` equivalents) and this row's chunking enabled, a consuming model port running the exact token gate must reproduce the oracle's graph @@ -88,17 +110,17 @@ Out of scope: ## Risks -- R1: The pinned split rule may not reproduce 1,2,6,4 from first principles - (the observed sequence could depend on server-side prompt-cache state, not - only `-b`/`-ub`). Evidence: the W1 probe with growing prefixes hit cache hits - and produced no further graphs (`focused.log` 2026-11-26). Mitigation: pin - from `llama-batch.cpp` source, not from logs alone; if source and observation - disagree, stop and report `NEEDS_DECISION` — do not invent a rule that fits - the logs. +- R1: RESOLVED by the 2026-11-29 experiment — the observed sequence is server + checkpoint policy (`pre_decode()` `checkpoint_offsets`), which the original + reading missed; the 1/2-token graphs are load-time probes. The remaining risk + is checkpoint-policy gating (`n_ctx_checkpoints` defaults, task type): the + split rule must encode those gates, not a hard-coded {6,4}. If a gate is + ambiguous in source, stop and report `NEEDS_DECISION`. - R2: Within-graph position dependence is not yet fully explained: in the W1 - per-position table, position 1 (inside the oracle's 2-token graph) differs - pre-conv at 2.0e-4 while position 0 (same graph) matches at 9.1e-8. Chunking - alone may not close the residue. Mitigation: this row lands the seam + tests; + per-position table, position 1 differs pre-conv at 2.0e-4 while position 0 + (same 6-token oracle graph; the old "2-token graph" attribution was a + load-time probe mislabel) matches at 9.1e-8. Chunking alone may not close the + residue. Mitigation: this row lands the seam + tests; the consuming row's gate is the judge. If the gate stays red with boundaries matched, the residue hunt returns to the consuming row with the new instrument (planner-allocated wdata capture) — that is a stop condition for @@ -117,9 +139,10 @@ Out of scope: Red-first, smallest failing test first: - T1: the split-rule function, table-driven: 10-token prompt with ub=16 yields - chunks (1, 2, 6, 4); boundary cases (prompt <= ub, prompt == ub, prompt > - ub with remainder, multi-sequence ranges) each asserted against the pinned - rule. RED before the rule exists. + chunks (6, 4) under the pinned server checkpoint rule; boundary cases (prompt + <= ub, prompt == ub, prompt > ub with remainder, checkpoints disabled + (`n_ctx_checkpoints` off -> no split), multi-sequence ranges) each asserted + against the pinned rule. RED before the rule exists. - T2: runner-level: with the knob set, one scheduled prefill step of N tokens produces N_chunk forward calls with the pinned chunk sizes, in order. RED before plumbing. From 12c68041f837bbbef41407153f926f385790f601 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 29 Nov 2026 08:03:20 +0100 Subject: [PATCH 3/9] feat(ENG-CHUNKED-PREFILL): engine prefill chunking mirrors the oracle's server checkpoint split The runner formed ONE forward per scheduler step, so a whole-prompt prefill below the token budget computed every position in one graph while the llama.cpp oracle the GGUF/CPU lane is gated against split the same prompt into checkpoint chunks. This adds the missing ubatch-level seam: - EngineParams::prefill_ubatch (the -ub analog, 0 = default = inert) wired through LoadedEngine to GPUModelRunner via set_prefill_ubatch. - PrefillCheckpointChunks (include/vllm/v1/worker/gpu/prefill_chunks.h) transcribes the pinned llama.cpp abca69200 rule from tools/server/server-context.cpp pre_decode(): the fill loop breaks early at checkpoint_offsets {4 + n_ubatch, 4} when task->n_tokens() == prompt_n + min(n_batch, offset), gated on do_checkpoint (n_ctx_checkpoints ON for COMPLETION tasks, PR #20288). n_batch maps to the per-step max_num_batched_tokens budget. The {6, 4} observed sequence falls out of the rule; nothing is fitted. - The forward site plans the chunk sequence BEFORE building forward input and runs one ModelRegistry::Forward per chunk, in order, only for eligible single-request gathered-logits prefill steps. The GDN state hand-off is bit-exact by address identity: every chunk's rebuilt metadata addresses the same persistent state slot, with has_initial_state from the chunk's own context. The final chunk carries the last-prompt-token lm_head row. - tests/vllm/v1/worker/test_prefill_chunks.cpp: T1 table-driven rule (the (10,16,16)->{6,4} case plus boundaries and a 320-combination sweep), the T2 slice/planning gates, the T3 state-slot hand-off, and the T4 default inertness. RED was the missing-header compile failure; GREEN is 5 cases / 1274 assertions. The multi-sequence mixed-prefill mirror stays Owed per the spec. Focused ctest gate (prefill_chunks, runner, prepare_inputs, input_batch, engine_core, llm_engine, engine_types): 7/7. Staged preflight: exit 0 after repairing the ENG-MOE-LOADSTREAM anchor this change shifted in .agents/engine-matrix.md (2576 -> 2580). The row's parity judge remains the consuming model row's token gate. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [task] --- .agents/engine-matrix.md | 12 +- .../eng-chunked-prefill-20261128/PROCESS.md | 186 +++++++++++++ include/vllm/entrypoints/model_loader.h | 14 + include/vllm/v1/worker/gpu/prefill_chunks.h | 148 +++++++++++ include/vllm/v1/worker/gpu/runner.h | 11 + src/vllm/entrypoints/model_loader.cpp | 4 + src/vllm/v1/worker/gpu/runner.cpp | 87 ++++++- tests/CMakeLists.txt | 3 + tests/vllm/v1/worker/test_prefill_chunks.cpp | 244 ++++++++++++++++++ 9 files changed, 698 insertions(+), 11 deletions(-) create mode 100644 .agents/evidence/eng-chunked-prefill-20261128/PROCESS.md create mode 100644 include/vllm/v1/worker/gpu/prefill_chunks.h create mode 100644 tests/vllm/v1/worker/test_prefill_chunks.cpp diff --git a/.agents/engine-matrix.md b/.agents/engine-matrix.md index 8213ce1f3..84e38b51f 100644 --- a/.agents/engine-matrix.md +++ b/.agents/engine-matrix.md @@ -172,8 +172,8 @@ lifecycle are unchanged. |---|---|---|---|---|---|---|---|---| | `SPEC-MTP` | Qwen3.6 MTP heads, k=1 first. **M-mtp-0 CLOSED 2026-07-24: the standalone draft head is oracle-parity-proven on BOTH checkpoints** (27B dense + 35B MoE, k=1, vLLM 0.25.0 executable @ pin `e24d1b24`) - argmax exact on 26/26 unambiguous rows each; the one remaining row per checkpoint is an EXACT oracle top1==top2 tie where vLLM's own `argmax` and `topk` disagree and our pick is a tied maximum; logits within the whole-model bound (atol 0.05 + rtol 0.05), 0/216 out-of-tol on both; shared lm_head isolated is bit-exact on the 35B NVFP4 head. **I2 scheduler-half LANDED (2026-07-24)**: host-side spec plumbing + the FROZEN spec-metadata ABI (spec §2.7) - `SpeculativeConfig`, `DraftTokenIds`, `Request::spec_token_ids`/`NumTokensWithSpec`, populated `scheduled_spec_decode_tokens`, `Scheduler::update_draft_token_ids`, `take_draft_token_ids` seam, `EngineCore::post_step`, `InputBatch::num_accepted_tokens`/`update_req_spec_token_ids`; DEFAULT-OFF and INERT (no `SpeculativeConfig` => `num_lookahead_tokens == 0`). **I3 verify-half LANDED (2026-07-24)**: greedy rejection sampler + per-request logits expansion (see `SPEC-REJECTION`, now `ACTIVE`). **I4 GDN-half LANDED (2026-07-24)**: the GDN speculative slot path + bit-exact state rollback, the piece BOTH GDN-hybrid gate checkpoints need (see `SPEC-GDN-SEGMENTS`, now `ACTIVE`). **I5a GDN LAYER ROUTING + runner spec-metadata upload LANDED (2026-07-24, `CLAIM-SPEC-MTP-I5A`)**: `GdnBlockPaged` now routes a pure-spec batch through `vt::GdnSpecDecode`/`vt::CausalConv1dSpecUpdate` and the runner uploads I4's six spec device tensors — first sub-increment of the scoped M-mtp-1 (I5a GDN wiring → I5b prepare_prefill → I5c MTP paged propose → I5d config+runner-loop+the 27B token gate, spec §5). DEFAULT-OFF INERT, bit-exact vs the I4 ops, no e2e loop yet. **I5b `prepare_prefill_inputs` LANDED (2026-07-24, `CLAIM-SPEC-MTP-I5B`, recorded under `SPEC-REJECTION`)**: the drafter prefill input-prep host routine (shift-splice + `query_len -= num_rejected` + last-token index / metadata) — second scoped M-mtp-1 sub-increment, DEFAULT-OFF INERT, unit-gated RED-first, additive. **I5d CONFIG + RUNNER LOOP LANDED, PARTIAL (2026-07-25, `CLAIM-SPEC-MTP-I5D`)**: `--speculative-config` JSON parse -> `EngineParams::speculative_config`; `LoadedEngine` resolution (`ResolveSpecConfig`/`ResolveMtp`, widened KV `MakeQwen3_5KVCacheSpec(num_spec>0)`, `BuildMtpDraft`, forced sync scheduling, `MakeScheduler(spec)`, `EngineCore(check_for_draft=true)`); the full runner verify/propose loop (draft splice, hidden-tap capture, GDN builder spec-overload feed, k+1 GDN state-slot remap + widened conv cache + draft-KV alloc, `MtpProposePrefill` post-sampling, `take_draft_token_ids`, acceptance telemetry). CUDA `-Werror` 0 warnings, cutlass-ON banner. SPEC-OFF BYTE-IDENTICAL (all gated on `spec_on()`): SACRED 27B 235/235, 35B 315/315, Coder 138/138 + unit test_runner 257 / test_mtp_speculator 169 / test_gdn_metadata_builder 483 / test_ops_gdn 3630 ALL PASS. **The three-way 27B token gate is NOT yet passing** (`tests/parity/test_qwen27_spec_decode.cpp` RUNS the loop + MEASURES the blocker): the spec-ON engine throws on the FIRST prefill step at `gdn_state_gather: working/cache row shapes must match` (`src/vt/ops.cpp:1773`) — I4's spec conv rollback needs the conv row widened to `(K-1)+num_spec` but the non-spec GDN conv ops assume `(K-1)`. Closing needs widened-cache-aware non-spec GDN conv ops + the MIXED `GdnBlockPaged` split/merge. Row LEFT `GATING` at I5e. **I5e LANDED 2026-07-25 (`CLAIM-SPEC-MTP-I5E`) — `SPEC-MTP` LEAVES `GATING`.** Made the non-spec GDN conv ops widened-cache-aware (mirror vLLM `state_len=KERNEL_WIDTH-1` + physical `stride_conv_state_tok`; leading `(K-1)` sub-window; byte-identical at `num_spec==0`, contiguous fast path kept) AND RCA'd the resulting 0-acceptance dead-drafter to the async input-combine overwriting the verify batch's draft position with the committed token (forced off under spec, nullopt-guarded). **THREE-WAY 27B GATE PASSES** (single-request greedy): our-ON == vLLM `--speculative-config mtp` greedy == our-OFF token-for-token; **acceptance 16/16 drafts accepted**, ~16 target steps saved. Spec-OFF SACRED byte-identical (27B 235/235, 35B 315/315, Coder 138/138), `test_ops_gdn` 3678, compute-sanitizer 0 on the spec step. NOT `DONE`: MIXED `GdnBlockPaged` split/merge (concurrency) + throughput A/B are I6. **I6 LANDED 2026-07-25 (`CLAIM-SPEC-MTP-I6`), `benchmark_binding=true` — the §5 c1 THROUGHPUT GATE, first spec-decode speed number:** OURS spec-ON (`examples/vllm-bench` + an additive `--speculative-config` flag, production config) vs pinned vLLM 0.25.0 spec-ON (graphed `vllm serve --speculative-config mtp` + `vllm bench serve`, `enforce_eager=False`/`FULL_AND_PIECEWISE`/inductor; MTP confirmed `Resolved architecture: Qwen3_5MTP`), SAME `{"method":"mtp","num_speculative_tokens":1}`, 27B `~/bench/q36-27b-nvfp4-vllm`, c1, greedy, 8 real prompts x 256 out, prose + code, idle box one-engine-at-a-time under one `flock`, 3 reps (cold TTFT discarded), token-identity re-confirmed FIRST (`test_qwen27_spec_decode` PASS 16/16). RESULT — **ours AT/ABOVE vLLM on EVERY measured axis** (prose / code): TPOT 66.2/62.95 vs 69.1/65.3 ms (ours ~1.04x faster), output tput 15.10/15.72 vs 14.43/15.13 tok/s (+4.6%/+3.9%), ITL 121.6/121.1 vs 123.2 ms, TTFT(warm) 131/131 vs 151.5/181 ms, acceptance ours 0.85/0.92 vs vLLM 0.838 overall (within noise, live drafter both), peak RSS 28.4 GB ON / 24.8 GB OFF (both inside the 119 GiB pool). Spec helps both (ours 1.52x/1.59x, vLLM 1.51x/1.60x TPOT); ours already ~4% faster spec-OFF. STAYS `ACTIVE`: the c>1 mixed spec+non-spec `GdnBlockPaged` split/merge is still refused (needs a row `IndexSelect`/`IndexCopy` vt op) + owes a c>1 A/B, and no user-facing supported `--speculative-config` on the OpenAI server yet (bench flag example-only/additive). Raw logs dgx `~/work/mtp-bench-i6/{results,vresults}`. **I7 LANDED 2026-07-25 (`CLAIM-SPEC-MTP-I7`, `benchmark_binding=true`) — the MIXED spec+non-spec GDN batch (concurrency), the server/CLI `--speculative-config`, and the c>1 A/B — implementation COMPLETE + at vLLM parity; STAYS `ACTIVE` for one honest reason (below), NOT a lag.** New row op `vt::IndexSelect`/`vt::IndexCopy` (CUDA==CPU bit-exact at GDN widths, RED-first); `GdnBlockPagedMixedSpec` split/merge (mirror `qwen_gdn_linear_attn.py:1329-1576`) proven MODEL-INDEPENDENTLY bit-exact (mixed == pure spec + pure prefill, 27B/35B, `test_qwen3_5_gdn_spec_routing`, RED-first by a broken merge); compute-sanitizer 0 on the mixed step + op; server (I5d) + CLI (ABI v6) `--speculative-config`. **c>1 A/B (both spec-ON, same config):** ours ON-PAR-OR-ABOVE vLLM at c2/c4/c8 (output tput within ~+/-2%, ours +1.6%/+2.5% c2, +0.9%/+1.7% c4, +0.9%/-1.1% c8 within noise, prose/code; both ~1.5x spec speedup — does NOT go neutral; acceptance 0.84-0.92 vs vLLM 0.835). **Why STAYS `ACTIVE` (honest, not a lag):** the DONE criterion's strict `token-exact at c>1` clause is a proven MODEL impossibility — the 27B greedy is bf16-batch-nondeterministic (spec-OFF max_seqs 4-vs-1 differs 2/3 short prompts, NO spec involved), affecting vLLM identically, so exact c>1 token identity cannot be met by any correct implementation; c>1 correctness is instead established by the model-independent bit-exact split/merge proof + acceptance parity (near-tie-distributional-gate), with token-exact strict at c1 (I6). No missing work, no lever — the DONE final call is deferred to the user given this criterion ambiguity. SACRED spec-OFF byte-identical 27B 235/235, 35B 315/315, Coder 138/138; CUDA `-Werror` 0 warnings. Raw logs dgx `~/work/mixed-batch/{cN_results,cN_vresults}`. **I8 — `SPEC-MTP` → `DONE` 2026-07-26 (`CLAIM-SPEC-MTP-DONE`, records-only, ZERO code):** the user RATIFIED the deferred c>1 criterion — at concurrency > 1 the DONE bar is the near-tie-distributional form (ours ∈ vLLM's batch-nondeterministic set) + the SPEED delta, NOT strict token-exact (a proven bf16-batch-nondeterminism MODEL impossibility that affects vLLM identically). Both I6-owed DONE items are therefore CLOSED: (1) the MIXED spec+non-spec `GdnBlockPaged` split/merge (I7, model-independently bit-exact + compute-sanitizer 0) with the c2-c8 A/B on-par-or-above vLLM, and (2) the server + CLI + C-ABI(v6) `--speculative-config` flag (I5d/I7, `examples/server/main.cpp`+`examples/cli/main.cpp`+`src/capi/vllm_c.cpp`). MTP k=1 spec-decode is COMPLETE and gated: 27B three-way token-exact at c1 (I5e), c1 above vLLM on every axis (I6), c2-c8 on-par-or-above (I7), spec-OFF byte-identical SACRED (27B 235/235, 35B 315/315, Coder 138/138). This transition is byte-identical BY CONSTRUCTION (`git diff --stat` = records only; ZERO `src/`/`include/`/`examples/` touched, so the I5d/I6/I7 GPU gates stand on this exact code). Tracked follow-ons: the 35B `Qwen3_5MoeMTP` full e2e token gate (M-mtp-2) is now **CLOSED — `DONE` 2026-07-26 (`CLAIM-SPEC-MTP-M-MTP-2`)**: three-way token-exact 16/16 vs the live vLLM 0.25.0 oracle (spec-ON AND spec-OFF), acceptance 16/16 both sides, c1 spec-ON 1.19x TPOT / +16.3% output-tput vs spec-OFF (0.908) — `MODEL-SPEC-qwen3-5-mtp-qwen3-5-moe-mtp` `GATING`→`DONE`, so MTP is `DONE` on BOTH gate models. Remaining spec-decode follow-on: `SPEC-DFLASH` (oracle-BLOCKED, vllm#40898) | T1 | `vllm/v1/worker/gpu/spec_decode/mtp/speculator.py:12`; `vllm/model_executor/models/qwen3_5_mtp.py:63,129-165,192-301`; **I5d** `vllm/engine/arg_utils.py` (`--speculative-config`); `vllm/v1/worker/gpu/model_runner.py:1455-1489` | `include/vllm/config/speculative.h`; `include/vllm/v1/core/sched/scheduler.h`; `src/vllm/v1/core/sched/scheduler.cpp`; `include/vllm/v1/worker/gpu/input_batch.h`; `include/vllm/model_executor/models/qwen3_5_mtp.h:23,58`; `src/vllm/model_executor/models/qwen3_5_mtp.cpp:271`; `src/vllm/model_executor/models/qwen3_5.cpp:3336,3359`; **I5d** `src/vllm/config/speculative.cpp`; `src/vllm/entrypoints/model_loader.cpp` (`ResolveSpecConfig`/`MakeKVCacheMaybeSpec`/ctor wiring); `src/vllm/v1/worker/gpu/runner.cpp` (splice/tap/GDN spec feed/`propose_drafts`/`take_draft_token_ids`/spec-slot remap/draft-KV alloc); `examples/server/main.cpp` | `tests/vllm/v1/test_scheduler.cpp:1135,1238,1272,1316`; `tests/vllm/v1/worker/test_input_batch.cpp`; `tests/vllm/v1/spec_decode/test_mtp_speculator.cpp:201,225,263,299,331` (7/7 cases, 141 assertions); oracle runner `tests/parity/test_op_parity.cpp:1373` + focused case `:1914` (20/20 assertions, both checkpoints, `VLLM_MTP_REQUIRE_CHECKPOINTS=1`); goldens `tests/parity/goldens/qwen3_5_mtp_head_{27b,35b}/`; dump `tools/parity/dump_qwen3_5_mtp.py:144`; **I5d** `tests/parity/test_qwen27_spec_decode.cpp` (three-way gate, RUNS + measures the RCA blocker); **I6** `examples/bench/{main.cpp,bench_core.h}` (additive `--speculative-config` bench flag + acceptance telemetry); **I7** `tests/vllm/models/test_qwen3_5_gdn_spec_routing.cpp` (mixed == pure spec + prefill bit-exact), `tests/parity/test_qwen27_spec_decode_concurrent.cpp`, `tests/vt/test_ops_gdn.cpp` (IndexSelect/IndexCopy); DONE closure [ledger](parity-ledger.md#L714) | [mtp-spec-decode.md](specs/mtp-spec-decode.md) | `DONE` | `72f9fb1` | | `SPEC-MTP-K-GT-1` | **MTP speculation DEPTH (`num_speculative_tokens` > 1).** Ports the autoregressive multi-step propose the k=1 early exit sits in front of, so a configured depth is SERVED instead of silently degraded. Before it, `--num-speculative-tokens 3` reserved KV for 3, captured the verify shape at T=4 and stashed ONE draft per request, with no error and no log; a refusal by name landed first and this row removed it in the same flow. `MtpProposeDrafts` runs the prefill, the k=1 early exit, then `prepare_decode_inputs` and the k-1 single-token draft decode steps over the draft's own paged KV, with `update_draft_inputs` recording each step and feeding it forward. Greedy plus accept-if-equal makes the emitted sequence INDEPENDENT of k, so a token-identity gate cannot see a clamped drafter and every depth assertion needs a positive witness beside the identity. The per-depth counters were the FIRST witness and a fresh review proved them BLIND: they report the LENGTH of the emitted draft list, so a propose that runs one forward and pads all k columns satisfies them, and acceptance is zero at every depth on the CPU model, so no acceptance figure separates the arms either. TWO witnesses survive, because one does not cover both failures. `spec_mtp_draft_decode_forwards() == spec_mtp_propose_calls() * (k - 1)`, counted after each draft decode forward RETURNS and guarded by a non-zero call count, catches a propose that SHORT-CIRCUITS or CLAMPS. A third fresh review then proved it does NOT catch PADDING, since a loop that runs every forward and then discards what it sampled increments it honestly. `spec_mtp_proposals_with_varied_drafts()`, read at the CONSUMER on the array the propose delivered, catches exactly that. NEITHER shows per-column provenance, and neither does a non-zero acceptance count AT DEPTH, which a padded row earns whenever the target repeats a token. The owed DGX gate closes it with a per-depth acceptance RATE against a PADDED CONTROL. The CPU tier therefore proves k drafts are PROPOSED and VERIFIED, never ACCEPTED at depth. DEFAULT unchanged at k=1 (both checkpoints' `n_predict`). **NO speed number at any k>1**: the GPU was held by another session for the whole flow, so the DGX three-way at k=2..4 on the 27B and 35B and the matched-k throughput A/B are OWED, as is the bf16 GDN-state arm (the CPU gate runs the f32 arm because `vt::CausalConv1dSpecUpdate` rejects bf16 off CUDA). Also owed and filed: [#1020](https://github.com/mudler/vllm.cpp/issues/1020), a step whose ACTUAL draft count differs from the configured k leaves the captured verify graph silently. | T1 | `vllm/v1/worker/gpu/spec_decode/autoregressive/speculator.py:129-274,335-371,374-419,426-471,597-671,674-771` @ `555967922`; `vllm/config/speculative.py:967-991` | [`src/vllm/v1/worker/gpu/spec_decode/mtp/speculator.cpp`](../src/vllm/v1/worker/gpu/spec_decode/mtp/speculator.cpp) (`MtpProposeDrafts`); [`prepare_decode_inputs.cpp`](../src/vllm/v1/worker/gpu/spec_decode/autoregressive/prepare_decode_inputs.cpp); `Qwen3_5MTPModel::GatherHiddenRows` ([qwen3_5.cpp](../src/vllm/model_executor/models/qwen3_5.cpp)); `GPUModelRunner::propose_drafts` + the per-depth counters ([runner.cpp](../src/vllm/v1/worker/gpu/runner.cpp), [runner.h](../include/vllm/v1/worker/gpu/runner.h)); the in-memory `mtp_weights` seam ([model_loader.h](../include/vllm/entrypoints/model_loader.h)) | [`test_mtp_depth`](../tests/vllm/v1/spec_decode/test_mtp_depth.cpp) 5/5, 63 assertions (k=1,2,3,4 through `LoadedEngine`, greedy tokens identical to spec-OFF, each arm witnessed BOTH by the draft decode forwards the propose RAN and by whether the DELIVERED draft row varied with depth; neither witness shows per-column provenance, which is owed to the DGX gate); [`test_prepare_decode_inputs`](../tests/vllm/v1/spec_decode/test_prepare_decode_inputs.cpp) 8/8, 33 (both kernel ports + both `max_model_len` clamps, 5 mutations caught); [`test_speculative_mtp_depth`](../tests/vllm/config/test_speculative_mtp_depth.cpp) 4/4, 20; full CPU suite ctest 493 passed / 0 failed / 2 skipped of 495 (the two skips checkpoint-gated and unrelated) | [mtp-k-gt-1.md](specs/mtp-k-gt-1.md) | `ACTIVE` | `CLAIM-SPEC-MTP-K-GT-1` ([#81](https://github.com/mudler/vllm.cpp/issues/81)) | -| `SPEC-MTP-GGUF` | MTP speculative decoding from a GGUF TARGET. Today `FromModelDir` refuses `mtp`+GGUF outright (`src/vllm/entrypoints/model_loader.cpp:717-723`) on the original spike's assumption that GGUF exports carry no `mtp.*` ([mtp-spec-decode.md](specs/mtp-spec-decode.md):979-980, "until we re-export GGUFs with the head"). That is stale: llama.cpp's Qwen3.5 converter DOES emit the head, under layer-indexed `nextn` naming, and our own `HfConfigFromGguf` ALREADY reads `nextn_predict_layers` (it just discards the value into the trunk layer count). Gap is a `TensorResolver` over `GgufFile` mapping `mtp.*` onto `blk.{L+i}.nextn.*` with dequant-to-bf16, one config field, and narrowing the rejection to `dflash`. `ngram`+GGUF already works and is untouched. Qwen3.5/3.6 only (the widened spec KV path serves no other arch). NO ABI change | T2 | llama.cpp (the producer contract; vLLM has no GGUF MTP path) `conversion/qwen.py:535-604` `_Qwen35MtpMixin` (the authoritative `mtp.*`->`nextn` remapper + `add_nextn_predict_layers`); `gguf-py/gguf/constants.py:129,910-917,1494-1501`; `gguf-py/gguf/tensor_mapping.py` `NEXTN_*` | **G1-G3 LANDED 2026-07-28.** `HfConfigFromGguf` republishes the head depth `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:598` (`c.raw["mtp_num_hidden_layers"] = nextn`, previously read then discarded); the head loader `LoadQwen3_5MTPFromGguf` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1609` (+ decl `include/vllm/model_executor/models/qwen3_5_gguf_weights.h:143`) reusing the TRUNK helpers `OwnNormMinus1`/`OwnMatmulWeight`/`OwnBf16`/`LoadAttnGguf`/`LoadMoeGguf` so the head inherits the GGUF (w+1) norm storage, quantization/residency routing and torch [N,K] shapes; `NumMtpLayers`/`UsesDedicatedEmbeddings` exported out of the anon namespace `include/vllm/model_executor/models/qwen3_5_mtp.h`; rejection narrowed to dflash + a head-less-GGUF check `src/vllm/entrypoints/model_loader.cpp` and the head attached in the GGUF branch; **G4 GREEN + `CPU-SPEC-DIVERGENCE` FIXED 2026-07-28**: root cause `src/vllm/model_executor/models/qwen3_5.cpp:3616` sized the GDN state gather/scatter row by `(Kw-1)` while the speculative persistent row is `(Kw-1)+num_spec`, so `GatherRows`/`ScatterRows` mis-strode the slot AND every channel past the first, corrupting post-prefill recurrent state. Fix = `CopyStateRowsStrided` (same TU) used by `GatherStateF32`/`ScatterStateF32` when `cache.shape[2] != work.shape[2]`; the contiguous helpers are kept when the widths agree, so every non-spec path is byte-identical by construction. CPU-only in effect (the fp16/bf16 arm routes through the `GdnStateGather`/`Scatter` ops, so CUDA was never exposed; no GPU result affected) | `tests/vllm/models/test_qwen3_5_gguf_mtp.cpp:109,146,156,184` **4 cases, and the split is the 2026-08-21 repair** ([#1454](https://github.com/mudler/vllm.cpp/issues/1454)): the file used to be the env-gated pair ALONE, each opening on a bare `return`, so with `VLLM_MTP_GGUF_MODEL` unset it reported `test cases: 2 \| 2 passed`, **`assertions: 0`**, `Status: SUCCESS!`, exit 0 - which is every CI run of this repository, the variable being set nowhere in `.github/workflows/`. The `18 assertions` this cell used to record was the LIVE count and was never once reached in CI. Now `:109` and `:146` are **HERMETIC** (KV-only synthetic GGUFs, no weight bytes, 18 assertions on any machine) and pin the arithmetic the old file only NAMED in a comment above `CHECK(c.num_hidden_layers > 0)`: `num_hidden_layers + mtp_num_hidden_layers == block_count` over 65/1, 25/1 and 28/3 - the third arm separating `- nextn` from `- 1` - plus the head-less arm, where the key is NOT published and `NumMtpLayers` answering 1 for an absent key is exactly why the invariant cannot be written with that helper alone. `:156` and `:184` stay env-gated on `VLLM_MTP_GGUF_MODEL` (so CI stays asset-free) and now SKIP LOUDLY with a `MESSAGE` naming the variable, as `tests/vllm/entrypoints/test_gguf_mmproj_reach.cpp` does; `:156` re-derives the same invariant from the file's OWN `block_count` kv. Unset: **4 cases / 18 assertions / `Status: SUCCESS!` / rc 0**. Live on `Qwen3.8-27B-Q4_K_M.gguf` (`block_count` 65, `nextn_predict_layers` 1): **4 cases / 38 assertions / `Status: SUCCESS!` / rc 0**. Mutation-proved on the production line `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:889`, both compiling clean and both restored against a pre-taken sha256: `= block_count` (drop the subtraction) 3/4 cases, 9/18 red, exit 1; `= block_count - 1` (the wrong constant) 2/4 cases, 5/18 red, exit 1. The SAME mutations left the PREVIOUS file at 2/2 cases, 0 assertions, `SUCCESS!`, exit 0. Correctness of the production line is unchanged and was never in question (`1a4db5c3c`, `493327b4e`); this was a test defect. Live-arm content unchanged: depth reaches config.raw; fc is [H,2H] verbatim; 3 norms [H]; head block is full-attention. **RED-first BEHAVIOURAL** (reverting only the G1 line fails both cases 2/2). Trunk inertness: `test_gguf` 103, `test_gguf_qwen36_loader` 99, `test_gguf_keep_quant` 5958, `test_gguf_dequant` 215, `test_capi` 33/232 all unchanged; `tests/parity/test_qwen35_gguf_spec_decode.cpp:74,139` - spec-ON == spec-OFF token-exact with 13 proposed/11 accepted, plus an `ngram` regression guard (widens the cache, never runs the spec conv update) that was token-exact throughout and pinned the widening as innocent. Regression sweep all unchanged: ops_gdn 1825, gdn_metadata_builder 483, gdn_prefill_conv 28, gdn_spec_routing 12, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, gguf_dequant 215, llm_engine 196, input_batch 163, runner 257, capi 232 **GPU CLOSE-OUT + DEVICE-DELTA ATTRIBUTION 2026-07-28 (`G5`-`G7`), ledger [parity-ledger.md#L800](parity-ledger.md#L800).** The GPU end-to-end gate re-run on a from-scratch RELEASE-TARGET build (`-DVLLM_CPP_CUDA_ARCHITECTURES=121a`, build dir DELETED first; arch VERIFIED by `build-cuda/CMakeFiles/vllm.dir/flags.make` `--generate-code=arch=compute_121a,code=[compute_121a,sm_121a]` and by `cuobjdump -lelf` 20 cubins ALL `sm_121a` zero sm_75, NOT by `CMakeCache.txt`, whose `CMAKE_CUDA_ARCHITECTURES:STRING=75` is the `enable_language(CUDA)` compiler-probe default shadowed by the normal variable at `CMakeLists.txt:186` - the prior wrong-arch conclusion was that decoy): dgx.casa GB10 under `flock $HOME/gpu.lock`, 35B A3B NVFP4 GGUF, **2/2 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, 13 proposed / 11 accepted, 90.2 GiB peak RSS, 8m01s; re-run on the EXACT committed source **3/3 cases, 10/10 assertions, exit 0**, 7m25s, the new probe case SKIPping and adding zero assertions. **The CPU-vs-GPU token delta is a MEASURED near-tie, not a defect** (it was never this row's bar - spec-ON == spec-OFF WITHIN a device is): NEW double-gated spec-OFF-only probe `tests/parity/test_qwen35_gguf_spec_decode.cpp:217` (asset + `VLLM_MTP_GGUF_PROBE=1`, 20 alternatives per position, 484/484 assertions per arm, GPU then `CUDA_VISIBLE_DEVICES=` in one `flock` series) shows both arms picking `11751` at position 0 and forking at position 1 on a BIT-IDENTICAL prefix: GPU rank1 `13` -0.773180 over rank2 `11` -0.847055 (margin 0.0739 nats), CPU rank1 `11` -0.765499 over rank2 `13` -0.830374 (margin 0.0649 nats). Each device's pick is the other's rank 2, both ~7x inside the ratified 0.5-nat band, and the cross-device disagreement on the SAME token (0.057 and 0.082 nats) EXCEEDS the margin being decided, so rounding settles it; the 24 texts look unrelated only because positions 2+ cascade off that one coin flip. Margin sweep over all 24 positions: **GGUF GPU and GGUF CPU carry ZERO exact ties**, minimum margins 0.0482 and 0.0649 nats, and both arms reproduced their sequence across every run. **Gate 4 MET on the safetensors sibling of the same quantization run** (`FromModelDir` takes it unchanged): acceptance 12 proposed / 11 accepted vs the GGUF's 13 / 11. That arm, however, FAILS spec-ON == spec-OFF at concurrency 1 and does not reproduce its own spec-OFF sequence run to run, and the probe attributes both to THREE EXACT ties (positions 7, 10, 16, bit-identical logprobs) produced by its 1/16-grid quantized-GEMM logits - which EXONERATES the GGUF arm and opens a recorded, not-root-caused `SPEC-MTP` item on the safetensors NVFP4 path, not on this row. Gate 3 is NOT APPLICABLE twice over: no F16/F32 head-carrying export exists, and the only same-weights sibling is not token-stable against itself. **EVIDENCE RE-ANCHORED 2026-07-29 to a PRODUCTION-CONFIGURED build, because every GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`** (the defect `CLAIM-27B-GATE-RCA` proved, which runs the emulation fp4 GEMM + hand GDN kernels). Re-run from a clean `git archive` tree of `main` `3f34534d`, build proven correct three ways (configure log has ZERO `CUTLASS not found` and prints `CUTLASS found ... sm120a NVFP4 cutlass GEMM` + `FlashAttention-2 ... ENABLED for arch(es) [121a]` + the vendored `sm_121a` Triton-AOT lines with `MANIFEST hashes OK`; `cuobjdump -lelf` 40 cubins ALL `sm_121a`, zero `sm_75`; SACRED `test_qwen27_paged_engine` **235/235 exit 0**, and the build precondition proven to FIRE by recompiling only that TU without the two defines against the same `libvllm.a`, which throws and exits 1 with 0 assertions). **The row PASSES UNCHANGED:** `tests/parity/test_qwen35_gguf_spec_decode` **3/3 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, **13 proposed / 11 accepted (identical to the recorded number)**, 90.26 GiB, 7m13.59s; loader gate 19 assertions on the Qwen3.5-2B and 18 on the 35B A3B, unchanged. **ONE recorded finding is RETRACTED by the re-measurement: the CPU-vs-GPU token delta was a BUILD artifact, not a device near-tie cascade.** On the production build both devices emit the SAME 24 tokens; the probe shows GPU rank1 `11` -0.763897 over rank2 `13` -0.824083 where the defective build had rank1 `13` -0.773180 over rank2 `11` -0.847055, while the CPU arm is bit-identical to the earlier measurement (CUTLASS and Triton are CUDA-only). Zero exact ties in either arm, min margins 0.060186 GPU / 0.064875 CPU, 484/484 assertions per arm. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md) | [specs/gguf-mtp-spec-decode.md](specs/gguf-mtp-spec-decode.md) | `DONE` | `edf91449` | -| `SPEC-DFLASH-GGUF` | DFlash speculative decoding from GGUF, two axes: (A) GGUF DRAFT + safetensors target, (B) GGUF target too. llama.cpp master carries a full `dflash` GGUF contract (arch string `dflash`, tensors `fc`/`enc.output_norm`/`output_norm`/`blk.N.*`, KVs `dflash.target_layers` + `dflash.target_hidden_size`); the arch is ABSENT from checkouts older than ~2026-07, so a stale tree reads as "no contract exists". The GGUF tensor set omits `token_embd`/`output` because the draft SHARES the target's embed+lm_head, which is exactly what `LoadDflashDraft` already does. Blockers are in the loader, not the model: `MakeDflashDraftConfig` reads `draft_dir/config.json` (a GGUF has none), `ResolveDflashDraftDir` probes for `config.json` so it cannot see a `.gguf`, and `LoadDflashDraft` is typed on `std::vector` for the shared bf16 head (the axis-B blocker). Axis A independently shippable. NO ABI change | T2 | llama.cpp `origin/master` @ 2026-07-28 (tag era `b10158`): `gguf-py/gguf/constants.py:547,1151,4350`; `gguf-py/gguf/tensor_mapping.py:1297-1305` (`ENC_OUTPUT_NORM`<-`model.hidden_norm`, `FC`<-`model.fc`); `conversion/qwen.py:351` (mask token via the standard tokenizer KV); `convert_hf_to_gguf.py --target-model-dir` | **GD1-GD7 LANDED 2026-07-28 (BOTH AXES COMPLETE and PROVEN end to end on GB10)**: `MakeDflashGgufConfig` + `LoadQwen3DFlashFromGguf` `src/vllm/model_executor/models/qwen3_dflash_gguf.cpp:88,227` (+ header), `IsDflashGgufDraft` + the `.gguf` branch in `ResolveDflashDraftDir`/`LoadDflashDraft` `src/vllm/entrypoints/model_loader.cpp:121,222`. Goes through the `TensorResolver` seam (unlike `SPEC-MTP-GGUF`) because dflash norms are RAW, so the existing `LoadQwen3DFlash` qkv/gate_up concatenation is reused unchanged. **`GD4` defect FIXED** (`model_loader.cpp:238-249`): the GGUF branch left `config.vocab_size` 0 - correct for `MakeDflashGgufConfig` (the DFLASH arch has no vocab KV and no `token_embd`) but fatal for the forward, which sizes the shared embedding view as `{config.vocab_size, H}`, so the first propose threw `cuda embedding: empty table (vocab 0)`. Now back-filled from the target's `embed_tokens` rows (the condition is on the VALUE, not the draft source, so it generalizes to a GGUF target). Load-level green had hidden it; only GENERATING found it. **GD5-GD7 = axis B**: `SharedHeadSource` `src/vllm/entrypoints/model_loader.cpp` re-expresses the shared bf16 `embed_tokens`+`lm_head` seam as a SOURCE and re-types `LoadDflashDraft`'s second parameter - THAT TYPE was the whole axis-B blocker - with the GGUF arm `LoadGgufSharedEmbedAndHeadBf16` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1085` reusing the trunk loader's tied-embedding rule and sidecar-aware dequant instead of restating them; the shared-head load moved into ONE common tail so all four (draft format x target container) combinations run identical code; the `dflash` half of the GGUF-branch rejection `model_loader.cpp` is deleted (the `mtp` half untouched) and the draft load is wired into the GGUF branch | `tests/vllm/models/test_qwen3_dflash_gguf.cpp:36,84` 2 cases / 47 assertions against the REAL published Qwen3.6-27B DFlash draft (env-gated `VLLM_DFLASH_GGUF_MODEL`, CI asset-free): the +1 target-layer offset undone against the KV read back from the same file, block_size/mask_token present, vocab_size left 0, layer_types cover every block, fc `[H, H*num_taps]` with `nk` SET, qkv/gate_up row-concat shapes, embed/lm_head left EMPTY for the target. **RED-first BEHAVIOURAL** (dropping the `-1` fails the offset checks). **`GD4` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp:343` (second case, draft source env-driven via `VLLM_DFLASH_DRAFT`/`_B`; asset-gated, CI-inert): on dgx GB10 sm_121a against the Qwen3.6-27B NVFP4 safetensors target, the Q4_K_M GGUF draft and the bf16 z-lab safetensors draft produce **token-for-token IDENTICAL** DFlash-ON continuations with **IDENTICAL** accepted/proposed (20/80 on a 24-token prompt, 42/96 on a 48-token prompt), spec-OFF self-reproducible 3/3 and 0 exact ties (min margin 0.197/0.400 nats). Regression: gguf_mtp 19, qwen35_gguf_spec_decode 10, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, ops_gdn 1825, llm_engine 196, capi 232, runner 257 all unchanged. **`GD5` unit gate** `tests/vllm/test_gguf_qwen36_loader.cpp` 3 new synthetic-GGUF cases (6 cases / 286 assertions total, CPU and the dgx CUDA build): the untied head really comes from `output.weight` and not the embedding (distinct fill values), the tied fallback aliases it onto `token_embd`, the `nk` flags separate the gather table from the MatmulBT weight, a file with no `token_embd` is refused. 3-mutant battery, 3 caught (`nk` flipped, head forced to the embedding, tied forced false). **`GD7` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp` third case (targets env-driven via `VLLM_DFLASH_TARGET_B`; asset-gated, CI-inert): on dgx GB10 sm_121a the Qwen3.6-27B NVFP4 **GGUF** target + `Q4_K_M` GGUF draft loads, takes the shared head from the GGUF, generates, and its DFlash-ON continuation is **token-for-token IDENTICAL to that same target's spec-OFF** (24/24, the STRICT form) with acceptance ALIVE at 14/160; 1 case / 15 assertions, exit 0. **The spike's highest risk is EMPTY on this asset, proven not assumed**: the 27B NVFP4 GGUF stores `token_embd`/`output` as ggml BF16, byte-identical to the safetensors sibling (2,542,796,800 bytes each, ZERO differing), so B1's shared-head read is verbatim, not a dequant. Acceptance IS lower than the safetensors-target arm and is NOT chargeable to the head: the two containers diverge at index 4 with NO speculation, because `QUANT-GGUF-NVFP4` is dequant-only so the GGUF target computes in bf16 while the safetensors target runs the true W4A4 kernels. **RE-MEASURED 2026-07-29 on a PRODUCTION-CONFIGURED build (`CLAIM-GGUF-SPEC-REVERIFY`), because every GD4/GD7 GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`.** Build proven correct three ways (see the `SPEC-MTP-GGUF` row; SACRED 27B **235/235**, `cuobjdump` 40 cubins all `sm_121a`). **AXIS B HOLDS EXACTLY**: `test_qwen27_dflash_spec_decode -tc="dflash axis-B*"` **15/15 assertions, exit 0**, GGUF-target DFlash-ON token-identical to that target's own spec-OFF 24/24, acceptance **14/160 unchanged**, cross-target spec-OFF divergence still at index 4, 81.01 GiB peak RSS, 6m53.08s. **AXIS A WAS RED ON THE 48-TOKEN PROMPT (reproducibly, 3 of 3 runs) AND IS NOW CLOSED.** The RED was real: cross-format TOKEN identity held on both prompts, but the exact accept-count half of bar (a) failed (`arm_a.proposed == arm_b.proposed` / `arm_a.accepted == arm_b.accepted`) because the Q4_K_M draft measured **46/112** against the bf16 z-lab draft's **47/96** (one extra 16-wide propose block, one fewer acceptance, zero token difference), 15/17, exit 1; the 24-token prompt stayed green at 17/17 with both drafts at 15/144. **`GD9` 2026-07-29 root-caused it IN WEIGHT SPACE as ordinary `Q4_K_M` cost, category (a), not a defect in our GGUF draft path - and the bar's own premise ("Same weights, two containers") was false for the asset it was pointed at.** The publishing repo also carries an UNQUANTIZED `BF16` GGUF (3,471,497,440 B) beside `Q8_0`/`Q6_K`/`Q5_K`/`Q4_K_M`, which the spec had recorded as nonexistent; that retired the `NOT APPLICABLE` on gate 2. CPU gate `tests/vllm/models/test_qwen3_dflash_gguf.cpp` third case (asset-gated `VLLM_DFLASH_GGUF_BF16_MODEL` + `VLLM_DFLASH_ST_DIR`): `LoadQwen3DFlashFromGguf(BF16)` is **BYTE-IDENTICAL to `LoadQwen3DFlash(z-lab shards)` on all 58 tensors, 302/302 assertions, exit 0**, and FUNCTIONALLY RED against the `Q4_K_M` file (21/302 red, exactly the 21 quantized matmul tensors), so not a vacuous pass. Supporting: our `DequantGgufRowToBf16` is bit-equal to `gguf-py`'s `gguf.quants.dequantize` on the real `fc.weight` (Q4_K), `blk.0.attn_q.weight` (Q4_K) and `blk.2.ffn_down.weight` (Q6_K), zero differing bf16 values; the ladder's mean relative weight error is monotone and uniform with NO outlier tensor (BF16 0, Q8_0 5.6e-3, Q6_K 1.85e-2, Q5_K 3.85e-2, Q4_K_M 7.6e-2); the only numeric config delta is `rms_norm_eps` at 2.5e-9 relative. Also landed: an off-by-default `VT_SPEC_TRACE=1` per-block propose/accept trace in `GPUModelRunner::sample_tokens_with_rejection` (`src/vllm/v1/worker/gpu/runner.cpp`). **`GD10` 2026-07-29 CONFIRMED IT END TO END ON GB10 and closed gates 3 and 5.** Build proven production-configured three ways (configure log 0 `CUTLASS not found`; `cuobjdump -lelf` 40 cubins ALL `sm_121a` zero `sm_75` on both binaries; SACRED `test_qwen27_paged_engine` **235/235, exit 0**, 31.34s, 23.67 GiB). The **`BF16` GGUF draft reads EXACTLY 47/96**, the safetensors draft's own number, at 48 tokens on the discriminating prompt - reproduced 2 of 2 - plus 27/64 = 27/64 at 24 tokens and 15/144 = 15/144 on the second prompt, tokens IDENTICAL throughout, 17/17 exit 0 each time; the `Q4_K_M` arm reads 46/112 on the SAME binary in the SAME `flock` series. Restoring only the draft's numeric precision restores the count, so quantization is the whole cause and nothing structural survives. Bar (a) is consequently SPLIT rather than relaxed (`tests/parity/test_qwen27_dflash_spec_decode.cpp`): tokens stay EXACT unconditionally; accept counts are EXACT on a cross-FORMAT arm and BANDED (`abs(d_accepted) <= 2`, `abs(d_proposed) <= k*2`) on a cross-QUANTIZATION one, with the arm chosen by `IsQuantizedGgufDraft` reading the draft file's ggml types (`GgmlTraits().block_elems > 1`) rather than by a flag. The band is derived, not picked: measured `d_accepted` is 0, 0, -1, so the bound is that maximum plus one quantum; and `d_proposed = -k * d_accepted` EXACTLY once the token streams match (confirmed at -1 / +16), so the proposed bound follows. **Mutation-proved non-vacuous**: rebuilt at band 0 the `Q4_K_M` arm is 15/17 exit 1 while the `BF16` arm stays 17/17 exit 0 on the exact branch. **AXIS B BROADENED from ONE prompt to THREE**, strict form green on all: "The capital of France is" IDENTICAL 14/160 (15/15), "Write a Python function that reverses a string:" IDENTICAL 24/64 (15/15), "Photosynthesis is the process by which" IDENTICAL 15/128 (9/9), all exit 0, ~6m30-6m52 and ~81 GiB peak RSS each. The second prompt REFINES the recorded acceptance claim: the safetensors-target arm is ALSO 24/64 there with the two containers' DFlash-ON streams IDENTICAL, so the GGUF target's lower acceptance is prompt-dependent (their spec-OFF streams diverge at index 4 on the first prompt, index 16 on the second) and not a standing penalty; the cause remains `QUANT-GGUF-NVFP4` being dequant-only, with the shared head excluded by a byte comparison. Gates 1-5 and 7 MET; gate 6 (speed) `PENDING` BY DESIGN and not owed - a DFlash-ON throughput A/B between the two target containers is not a fair comparison until a native NVFP4 GGUF GEMM exists. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md#L845) | [specs/gguf-dflash-draft.md](specs/gguf-dflash-draft.md) | `DONE` | `c62f2fa3` | +| `SPEC-MTP-GGUF` | MTP speculative decoding from a GGUF TARGET. Today `FromModelDir` refuses `mtp`+GGUF outright (`src/vllm/entrypoints/model_loader.cpp:717-723`) on the original spike's assumption that GGUF exports carry no `mtp.*` ([mtp-spec-decode.md](specs/mtp-spec-decode.md):979-980, "until we re-export GGUFs with the head"). That is stale: llama.cpp's Qwen3.5 converter DOES emit the head, under layer-indexed `nextn` naming, and our own `HfConfigFromGguf` ALREADY reads `nextn_predict_layers` (it just discards the value into the trunk layer count). Gap is a `TensorResolver` over `GgufFile` mapping `mtp.*` onto `blk.{L+i}.nextn.*` with dequant-to-bf16, one config field, and narrowing the rejection to `dflash`. `ngram`+GGUF already works and is untouched. Qwen3.5/3.6 only (the widened spec KV path serves no other arch). NO ABI change | T2 | llama.cpp (the producer contract; vLLM has no GGUF MTP path) `conversion/qwen.py:535-604` `_Qwen35MtpMixin` (the authoritative `mtp.*`->`nextn` remapper + `add_nextn_predict_layers`); `gguf-py/gguf/constants.py:129,910-917,1494-1501`; `gguf-py/gguf/tensor_mapping.py` `NEXTN_*` | **G1-G3 LANDED 2026-07-28.** `HfConfigFromGguf` republishes the head depth `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:598` (`c.raw["mtp_num_hidden_layers"] = nextn`, previously read then discarded); the head loader `LoadQwen3_5MTPFromGguf` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1569` (+ decl `include/vllm/model_executor/models/qwen3_5_gguf_weights.h:143`) reusing the TRUNK helpers `OwnNormMinus1`/`OwnMatmulWeight`/`OwnBf16`/`LoadAttnGguf`/`LoadMoeGguf` so the head inherits the GGUF (w+1) norm storage, quantization/residency routing and torch [N,K] shapes; `NumMtpLayers`/`UsesDedicatedEmbeddings` exported out of the anon namespace `include/vllm/model_executor/models/qwen3_5_mtp.h`; rejection narrowed to dflash + a head-less-GGUF check `src/vllm/entrypoints/model_loader.cpp` and the head attached in the GGUF branch; **G4 GREEN + `CPU-SPEC-DIVERGENCE` FIXED 2026-07-28**: root cause `src/vllm/model_executor/models/qwen3_5.cpp:3616` sized the GDN state gather/scatter row by `(Kw-1)` while the speculative persistent row is `(Kw-1)+num_spec`, so `GatherRows`/`ScatterRows` mis-strode the slot AND every channel past the first, corrupting post-prefill recurrent state. Fix = `CopyStateRowsStrided` (same TU) used by `GatherStateF32`/`ScatterStateF32` when `cache.shape[2] != work.shape[2]`; the contiguous helpers are kept when the widths agree, so every non-spec path is byte-identical by construction. CPU-only in effect (the fp16/bf16 arm routes through the `GdnStateGather`/`Scatter` ops, so CUDA was never exposed; no GPU result affected) | `tests/vllm/models/test_qwen3_5_gguf_mtp.cpp:109,146,156,184` **4 cases, and the split is the 2026-08-21 repair** ([#1454](https://github.com/mudler/vllm.cpp/issues/1454)): the file used to be the env-gated pair ALONE, each opening on a bare `return`, so with `VLLM_MTP_GGUF_MODEL` unset it reported `test cases: 2 \| 2 passed`, **`assertions: 0`**, `Status: SUCCESS!`, exit 0 - which is every CI run of this repository, the variable being set nowhere in `.github/workflows/`. The `18 assertions` this cell used to record was the LIVE count and was never once reached in CI. Now `:109` and `:146` are **HERMETIC** (KV-only synthetic GGUFs, no weight bytes, 18 assertions on any machine) and pin the arithmetic the old file only NAMED in a comment above `CHECK(c.num_hidden_layers > 0)`: `num_hidden_layers + mtp_num_hidden_layers == block_count` over 65/1, 25/1 and 28/3 - the third arm separating `- nextn` from `- 1` - plus the head-less arm, where the key is NOT published and `NumMtpLayers` answering 1 for an absent key is exactly why the invariant cannot be written with that helper alone. `:156` and `:184` stay env-gated on `VLLM_MTP_GGUF_MODEL` (so CI stays asset-free) and now SKIP LOUDLY with a `MESSAGE` naming the variable, as `tests/vllm/entrypoints/test_gguf_mmproj_reach.cpp` does; `:156` re-derives the same invariant from the file's OWN `block_count` kv. Unset: **4 cases / 18 assertions / `Status: SUCCESS!` / rc 0**. Live on `Qwen3.8-27B-Q4_K_M.gguf` (`block_count` 65, `nextn_predict_layers` 1): **4 cases / 38 assertions / `Status: SUCCESS!` / rc 0**. Mutation-proved on the production line `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:889`, both compiling clean and both restored against a pre-taken sha256: `= block_count` (drop the subtraction) 3/4 cases, 9/18 red, exit 1; `= block_count - 1` (the wrong constant) 2/4 cases, 5/18 red, exit 1. The SAME mutations left the PREVIOUS file at 2/2 cases, 0 assertions, `SUCCESS!`, exit 0. Correctness of the production line is unchanged and was never in question (`1a4db5c3c`, `493327b4e`); this was a test defect. Live-arm content unchanged: depth reaches config.raw; fc is [H,2H] verbatim; 3 norms [H]; head block is full-attention. **RED-first BEHAVIOURAL** (reverting only the G1 line fails both cases 2/2). Trunk inertness: `test_gguf` 103, `test_gguf_qwen36_loader` 99, `test_gguf_keep_quant` 5958, `test_gguf_dequant` 215, `test_capi` 33/232 all unchanged; `tests/parity/test_qwen35_gguf_spec_decode.cpp:74,139` - spec-ON == spec-OFF token-exact with 13 proposed/11 accepted, plus an `ngram` regression guard (widens the cache, never runs the spec conv update) that was token-exact throughout and pinned the widening as innocent. Regression sweep all unchanged: ops_gdn 1825, gdn_metadata_builder 483, gdn_prefill_conv 28, gdn_spec_routing 12, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, gguf_dequant 215, llm_engine 196, input_batch 163, runner 257, capi 232 **GPU CLOSE-OUT + DEVICE-DELTA ATTRIBUTION 2026-07-28 (`G5`-`G7`), ledger [parity-ledger.md#L800](parity-ledger.md#L800).** The GPU end-to-end gate re-run on a from-scratch RELEASE-TARGET build (`-DVLLM_CPP_CUDA_ARCHITECTURES=121a`, build dir DELETED first; arch VERIFIED by `build-cuda/CMakeFiles/vllm.dir/flags.make` `--generate-code=arch=compute_121a,code=[compute_121a,sm_121a]` and by `cuobjdump -lelf` 20 cubins ALL `sm_121a` zero sm_75, NOT by `CMakeCache.txt`, whose `CMAKE_CUDA_ARCHITECTURES:STRING=75` is the `enable_language(CUDA)` compiler-probe default shadowed by the normal variable at `CMakeLists.txt:186` - the prior wrong-arch conclusion was that decoy): dgx.casa GB10 under `flock $HOME/gpu.lock`, 35B A3B NVFP4 GGUF, **2/2 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, 13 proposed / 11 accepted, 90.2 GiB peak RSS, 8m01s; re-run on the EXACT committed source **3/3 cases, 10/10 assertions, exit 0**, 7m25s, the new probe case SKIPping and adding zero assertions. **The CPU-vs-GPU token delta is a MEASURED near-tie, not a defect** (it was never this row's bar - spec-ON == spec-OFF WITHIN a device is): NEW double-gated spec-OFF-only probe `tests/parity/test_qwen35_gguf_spec_decode.cpp:217` (asset + `VLLM_MTP_GGUF_PROBE=1`, 20 alternatives per position, 484/484 assertions per arm, GPU then `CUDA_VISIBLE_DEVICES=` in one `flock` series) shows both arms picking `11751` at position 0 and forking at position 1 on a BIT-IDENTICAL prefix: GPU rank1 `13` -0.773180 over rank2 `11` -0.847055 (margin 0.0739 nats), CPU rank1 `11` -0.765499 over rank2 `13` -0.830374 (margin 0.0649 nats). Each device's pick is the other's rank 2, both ~7x inside the ratified 0.5-nat band, and the cross-device disagreement on the SAME token (0.057 and 0.082 nats) EXCEEDS the margin being decided, so rounding settles it; the 24 texts look unrelated only because positions 2+ cascade off that one coin flip. Margin sweep over all 24 positions: **GGUF GPU and GGUF CPU carry ZERO exact ties**, minimum margins 0.0482 and 0.0649 nats, and both arms reproduced their sequence across every run. **Gate 4 MET on the safetensors sibling of the same quantization run** (`FromModelDir` takes it unchanged): acceptance 12 proposed / 11 accepted vs the GGUF's 13 / 11. That arm, however, FAILS spec-ON == spec-OFF at concurrency 1 and does not reproduce its own spec-OFF sequence run to run, and the probe attributes both to THREE EXACT ties (positions 7, 10, 16, bit-identical logprobs) produced by its 1/16-grid quantized-GEMM logits - which EXONERATES the GGUF arm and opens a recorded, not-root-caused `SPEC-MTP` item on the safetensors NVFP4 path, not on this row. Gate 3 is NOT APPLICABLE twice over: no F16/F32 head-carrying export exists, and the only same-weights sibling is not token-stable against itself. **EVIDENCE RE-ANCHORED 2026-07-29 to a PRODUCTION-CONFIGURED build, because every GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`** (the defect `CLAIM-27B-GATE-RCA` proved, which runs the emulation fp4 GEMM + hand GDN kernels). Re-run from a clean `git archive` tree of `main` `3f34534d`, build proven correct three ways (configure log has ZERO `CUTLASS not found` and prints `CUTLASS found ... sm120a NVFP4 cutlass GEMM` + `FlashAttention-2 ... ENABLED for arch(es) [121a]` + the vendored `sm_121a` Triton-AOT lines with `MANIFEST hashes OK`; `cuobjdump -lelf` 40 cubins ALL `sm_121a`, zero `sm_75`; SACRED `test_qwen27_paged_engine` **235/235 exit 0**, and the build precondition proven to FIRE by recompiling only that TU without the two defines against the same `libvllm.a`, which throws and exits 1 with 0 assertions). **The row PASSES UNCHANGED:** `tests/parity/test_qwen35_gguf_spec_decode` **3/3 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, **13 proposed / 11 accepted (identical to the recorded number)**, 90.26 GiB, 7m13.59s; loader gate 19 assertions on the Qwen3.5-2B and 18 on the 35B A3B, unchanged. **ONE recorded finding is RETRACTED by the re-measurement: the CPU-vs-GPU token delta was a BUILD artifact, not a device near-tie cascade.** On the production build both devices emit the SAME 24 tokens; the probe shows GPU rank1 `11` -0.763897 over rank2 `13` -0.824083 where the defective build had rank1 `13` -0.773180 over rank2 `11` -0.847055, while the CPU arm is bit-identical to the earlier measurement (CUTLASS and Triton are CUDA-only). Zero exact ties in either arm, min margins 0.060186 GPU / 0.064875 CPU, 484/484 assertions per arm. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md) | [specs/gguf-mtp-spec-decode.md](specs/gguf-mtp-spec-decode.md) | `DONE` | `edf91449` | +| `SPEC-DFLASH-GGUF` | DFlash speculative decoding from GGUF, two axes: (A) GGUF DRAFT + safetensors target, (B) GGUF target too. llama.cpp master carries a full `dflash` GGUF contract (arch string `dflash`, tensors `fc`/`enc.output_norm`/`output_norm`/`blk.N.*`, KVs `dflash.target_layers` + `dflash.target_hidden_size`); the arch is ABSENT from checkouts older than ~2026-07, so a stale tree reads as "no contract exists". The GGUF tensor set omits `token_embd`/`output` because the draft SHARES the target's embed+lm_head, which is exactly what `LoadDflashDraft` already does. Blockers are in the loader, not the model: `MakeDflashDraftConfig` reads `draft_dir/config.json` (a GGUF has none), `ResolveDflashDraftDir` probes for `config.json` so it cannot see a `.gguf`, and `LoadDflashDraft` is typed on `std::vector` for the shared bf16 head (the axis-B blocker). Axis A independently shippable. NO ABI change | T2 | llama.cpp `origin/master` @ 2026-07-28 (tag era `b10158`): `gguf-py/gguf/constants.py:547,1151,4350`; `gguf-py/gguf/tensor_mapping.py:1297-1305` (`ENC_OUTPUT_NORM`<-`model.hidden_norm`, `FC`<-`model.fc`); `conversion/qwen.py:351` (mask token via the standard tokenizer KV); `convert_hf_to_gguf.py --target-model-dir` | **GD1-GD7 LANDED 2026-07-28 (BOTH AXES COMPLETE and PROVEN end to end on GB10)**: `MakeDflashGgufConfig` + `LoadQwen3DFlashFromGguf` `src/vllm/model_executor/models/qwen3_dflash_gguf.cpp:88,227` (+ header), `IsDflashGgufDraft` + the `.gguf` branch in `ResolveDflashDraftDir`/`LoadDflashDraft` `src/vllm/entrypoints/model_loader.cpp:121,222`. Goes through the `TensorResolver` seam (unlike `SPEC-MTP-GGUF`) because dflash norms are RAW, so the existing `LoadQwen3DFlash` qkv/gate_up concatenation is reused unchanged. **`GD4` defect FIXED** (`model_loader.cpp:238-249`): the GGUF branch left `config.vocab_size` 0 - correct for `MakeDflashGgufConfig` (the DFLASH arch has no vocab KV and no `token_embd`) but fatal for the forward, which sizes the shared embedding view as `{config.vocab_size, H}`, so the first propose threw `cuda embedding: empty table (vocab 0)`. Now back-filled from the target's `embed_tokens` rows (the condition is on the VALUE, not the draft source, so it generalizes to a GGUF target). Load-level green had hidden it; only GENERATING found it. **GD5-GD7 = axis B**: `SharedHeadSource` `src/vllm/entrypoints/model_loader.cpp` re-expresses the shared bf16 `embed_tokens`+`lm_head` seam as a SOURCE and re-types `LoadDflashDraft`'s second parameter - THAT TYPE was the whole axis-B blocker - with the GGUF arm `LoadGgufSharedEmbedAndHeadBf16` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1067` reusing the trunk loader's tied-embedding rule and sidecar-aware dequant instead of restating them; the shared-head load moved into ONE common tail so all four (draft format x target container) combinations run identical code; the `dflash` half of the GGUF-branch rejection `model_loader.cpp` is deleted (the `mtp` half untouched) and the draft load is wired into the GGUF branch | `tests/vllm/models/test_qwen3_dflash_gguf.cpp:36,84` 2 cases / 47 assertions against the REAL published Qwen3.6-27B DFlash draft (env-gated `VLLM_DFLASH_GGUF_MODEL`, CI asset-free): the +1 target-layer offset undone against the KV read back from the same file, block_size/mask_token present, vocab_size left 0, layer_types cover every block, fc `[H, H*num_taps]` with `nk` SET, qkv/gate_up row-concat shapes, embed/lm_head left EMPTY for the target. **RED-first BEHAVIOURAL** (dropping the `-1` fails the offset checks). **`GD4` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp:343` (second case, draft source env-driven via `VLLM_DFLASH_DRAFT`/`_B`; asset-gated, CI-inert): on dgx GB10 sm_121a against the Qwen3.6-27B NVFP4 safetensors target, the Q4_K_M GGUF draft and the bf16 z-lab safetensors draft produce **token-for-token IDENTICAL** DFlash-ON continuations with **IDENTICAL** accepted/proposed (20/80 on a 24-token prompt, 42/96 on a 48-token prompt), spec-OFF self-reproducible 3/3 and 0 exact ties (min margin 0.197/0.400 nats). Regression: gguf_mtp 19, qwen35_gguf_spec_decode 10, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, ops_gdn 1825, llm_engine 196, capi 232, runner 257 all unchanged. **`GD5` unit gate** `tests/vllm/test_gguf_qwen36_loader.cpp` 3 new synthetic-GGUF cases (6 cases / 286 assertions total, CPU and the dgx CUDA build): the untied head really comes from `output.weight` and not the embedding (distinct fill values), the tied fallback aliases it onto `token_embd`, the `nk` flags separate the gather table from the MatmulBT weight, a file with no `token_embd` is refused. 3-mutant battery, 3 caught (`nk` flipped, head forced to the embedding, tied forced false). **`GD7` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp` third case (targets env-driven via `VLLM_DFLASH_TARGET_B`; asset-gated, CI-inert): on dgx GB10 sm_121a the Qwen3.6-27B NVFP4 **GGUF** target + `Q4_K_M` GGUF draft loads, takes the shared head from the GGUF, generates, and its DFlash-ON continuation is **token-for-token IDENTICAL to that same target's spec-OFF** (24/24, the STRICT form) with acceptance ALIVE at 14/160; 1 case / 15 assertions, exit 0. **The spike's highest risk is EMPTY on this asset, proven not assumed**: the 27B NVFP4 GGUF stores `token_embd`/`output` as ggml BF16, byte-identical to the safetensors sibling (2,542,796,800 bytes each, ZERO differing), so B1's shared-head read is verbatim, not a dequant. Acceptance IS lower than the safetensors-target arm and is NOT chargeable to the head: the two containers diverge at index 4 with NO speculation, because `QUANT-GGUF-NVFP4` is dequant-only so the GGUF target computes in bf16 while the safetensors target runs the true W4A4 kernels. **RE-MEASURED 2026-07-29 on a PRODUCTION-CONFIGURED build (`CLAIM-GGUF-SPEC-REVERIFY`), because every GD4/GD7 GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`.** Build proven correct three ways (see the `SPEC-MTP-GGUF` row; SACRED 27B **235/235**, `cuobjdump` 40 cubins all `sm_121a`). **AXIS B HOLDS EXACTLY**: `test_qwen27_dflash_spec_decode -tc="dflash axis-B*"` **15/15 assertions, exit 0**, GGUF-target DFlash-ON token-identical to that target's own spec-OFF 24/24, acceptance **14/160 unchanged**, cross-target spec-OFF divergence still at index 4, 81.01 GiB peak RSS, 6m53.08s. **AXIS A WAS RED ON THE 48-TOKEN PROMPT (reproducibly, 3 of 3 runs) AND IS NOW CLOSED.** The RED was real: cross-format TOKEN identity held on both prompts, but the exact accept-count half of bar (a) failed (`arm_a.proposed == arm_b.proposed` / `arm_a.accepted == arm_b.accepted`) because the Q4_K_M draft measured **46/112** against the bf16 z-lab draft's **47/96** (one extra 16-wide propose block, one fewer acceptance, zero token difference), 15/17, exit 1; the 24-token prompt stayed green at 17/17 with both drafts at 15/144. **`GD9` 2026-07-29 root-caused it IN WEIGHT SPACE as ordinary `Q4_K_M` cost, category (a), not a defect in our GGUF draft path - and the bar's own premise ("Same weights, two containers") was false for the asset it was pointed at.** The publishing repo also carries an UNQUANTIZED `BF16` GGUF (3,471,497,440 B) beside `Q8_0`/`Q6_K`/`Q5_K`/`Q4_K_M`, which the spec had recorded as nonexistent; that retired the `NOT APPLICABLE` on gate 2. CPU gate `tests/vllm/models/test_qwen3_dflash_gguf.cpp` third case (asset-gated `VLLM_DFLASH_GGUF_BF16_MODEL` + `VLLM_DFLASH_ST_DIR`): `LoadQwen3DFlashFromGguf(BF16)` is **BYTE-IDENTICAL to `LoadQwen3DFlash(z-lab shards)` on all 58 tensors, 302/302 assertions, exit 0**, and FUNCTIONALLY RED against the `Q4_K_M` file (21/302 red, exactly the 21 quantized matmul tensors), so not a vacuous pass. Supporting: our `DequantGgufRowToBf16` is bit-equal to `gguf-py`'s `gguf.quants.dequantize` on the real `fc.weight` (Q4_K), `blk.0.attn_q.weight` (Q4_K) and `blk.2.ffn_down.weight` (Q6_K), zero differing bf16 values; the ladder's mean relative weight error is monotone and uniform with NO outlier tensor (BF16 0, Q8_0 5.6e-3, Q6_K 1.85e-2, Q5_K 3.85e-2, Q4_K_M 7.6e-2); the only numeric config delta is `rms_norm_eps` at 2.5e-9 relative. Also landed: an off-by-default `VT_SPEC_TRACE=1` per-block propose/accept trace in `GPUModelRunner::sample_tokens_with_rejection` (`src/vllm/v1/worker/gpu/runner.cpp`). **`GD10` 2026-07-29 CONFIRMED IT END TO END ON GB10 and closed gates 3 and 5.** Build proven production-configured three ways (configure log 0 `CUTLASS not found`; `cuobjdump -lelf` 40 cubins ALL `sm_121a` zero `sm_75` on both binaries; SACRED `test_qwen27_paged_engine` **235/235, exit 0**, 31.34s, 23.67 GiB). The **`BF16` GGUF draft reads EXACTLY 47/96**, the safetensors draft's own number, at 48 tokens on the discriminating prompt - reproduced 2 of 2 - plus 27/64 = 27/64 at 24 tokens and 15/144 = 15/144 on the second prompt, tokens IDENTICAL throughout, 17/17 exit 0 each time; the `Q4_K_M` arm reads 46/112 on the SAME binary in the SAME `flock` series. Restoring only the draft's numeric precision restores the count, so quantization is the whole cause and nothing structural survives. Bar (a) is consequently SPLIT rather than relaxed (`tests/parity/test_qwen27_dflash_spec_decode.cpp`): tokens stay EXACT unconditionally; accept counts are EXACT on a cross-FORMAT arm and BANDED (`abs(d_accepted) <= 2`, `abs(d_proposed) <= k*2`) on a cross-QUANTIZATION one, with the arm chosen by `IsQuantizedGgufDraft` reading the draft file's ggml types (`GgmlTraits().block_elems > 1`) rather than by a flag. The band is derived, not picked: measured `d_accepted` is 0, 0, -1, so the bound is that maximum plus one quantum; and `d_proposed = -k * d_accepted` EXACTLY once the token streams match (confirmed at -1 / +16), so the proposed bound follows. **Mutation-proved non-vacuous**: rebuilt at band 0 the `Q4_K_M` arm is 15/17 exit 1 while the `BF16` arm stays 17/17 exit 0 on the exact branch. **AXIS B BROADENED from ONE prompt to THREE**, strict form green on all: "The capital of France is" IDENTICAL 14/160 (15/15), "Write a Python function that reverses a string:" IDENTICAL 24/64 (15/15), "Photosynthesis is the process by which" IDENTICAL 15/128 (9/9), all exit 0, ~6m30-6m52 and ~81 GiB peak RSS each. The second prompt REFINES the recorded acceptance claim: the safetensors-target arm is ALSO 24/64 there with the two containers' DFlash-ON streams IDENTICAL, so the GGUF target's lower acceptance is prompt-dependent (their spec-OFF streams diverge at index 4 on the first prompt, index 16 on the second) and not a standing penalty; the cause remains `QUANT-GGUF-NVFP4` being dequant-only, with the shared head excluded by a byte comparison. Gates 1-5 and 7 MET; gate 6 (speed) `PENDING` BY DESIGN and not owed - a DFlash-ON throughput A/B between the two target containers is not a fair comparison until a native NVFP4 GGUF GEMM exists. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md#L845) | [specs/gguf-dflash-draft.md](specs/gguf-dflash-draft.md) | `DONE` | `c62f2fa3` | | `SPEC-REJECTION` | Rejection sampler. **I3 verify half LANDED (2026-07-24)**: per-request logits EXPANSION to `1 + k_i` rows (`StepInputs::cu_num_logits` / `num_draft_tokens_per_req` / expanded `logits_indices`) plus the GREEDY rejection sampler — accept a draft iff it equals the target argmax at its own position, emit the target argmax on the FIRST mismatch and stop, emit the bonus argmax when all `k_i` accept, `num_sampled = accepted + 1`, `num_rejected = k_i - accepted` (feeds I2's `num_computed_tokens` rollback and `InputBatch::num_accepted_tokens`). One additive vt op (`kGreedyRejectionSample`) with a CPU reference and a CUDA two-phase mirror of upstream's row-argmax + one-thread-per-request accept walk. DEFAULT-OFF and INERT: with no `SpeculativeConfig` no drafts are ever scheduled, `cu_num_logits` is `arange(num_reqs+1)`, `logits_indices` is the pre-change array and the runner never enters the rejection branch. STOCHASTIC/Gumbel, block verification, `apply_sampling_params` over the expanded batch, and the spec grammar bitmask stay DEFERRED (M-mtp-3). **I5b DRAFTER PREFILL INPUT-PREP LANDED (2026-07-24, `CLAIM-SPEC-MTP-I5B`)**: the draft-token input splice this row's I3 note deferred to I5 — `vllm::v1::prepare_prefill_inputs` + its `SpecPrefillInputs` output struct shift each request's `input_ids` left one within its query span, splice the just-sampled next token (`num_sampled>0 ? last_sampled[idx_mapping[r]] : next_prefill_tokens[...]`) into the freed slot, `query_len -= num_rejected`, and emit last-token index / query_start_loc / seq_lens + CG padding (mirror `speculator.py:469-588`, k=1 early-exit :236-238). A HOST routine in a NEW spec_decode-tree TU (no new CUDA kernel; mirrors the DEVICE-NEUTRAL `prepare_inputs`/`combine_sampled_and_draft_tokens` family — the DGX runner leaf ports the loop to the Triton kernel at I5d), unit-gated `test_prepare_prefill_inputs` 7 cases / 27 assertions RED-first, DEFAULT-OFF INERT (nothing calls it until I5d), additive by construction. Row stays `ACTIVE` — the e2e greedy token gate (M-mtp-1) is owed before `DONE` | T1 | `vllm/v1/worker/gpu/spec_decode/rejection_sampler.py:43,101-160`; `rejection_sampler_utils.py:524,564-585,628,828-841,846-849,863-1125`; `vllm/v1/worker/gpu/model_runner.py:866-898,1065-1077`; `vllm/v1/worker/gpu/input_batch.py:303-397,408-453`; **I5b** `vllm/v1/worker/gpu/spec_decode/autoregressive/speculator.py:469-588,236-238` | `include/vllm/v1/spec_decode/rejection_sampler.h`; `src/vllm/v1/spec_decode/rejection_sampler.cpp`; `include/vt/ops.h` (`kGreedyRejectionSample`, `vt::GreedyRejectionSample`); `src/vt/cpu/cpu_sample.cpp` (CPU reference); `src/vt/cuda/cuda_sample.cu` (`RejectionRowArgmaxKernel` + `GreedyRejectAcceptKernel`); `src/vt/ops.cpp`; `include/vllm/v1/worker/gpu/prepare_inputs.h` + `src/vllm/v1/worker/gpu/prepare_inputs.cpp` (the expansion); `include/vllm/v1/worker/gpu/runner.h` + `src/vllm/v1/worker/gpu/runner.cpp` (`step_num_logits`, `sample_tokens_with_rejection`); **I5b** `include/vllm/v1/worker/gpu/spec_decode/autoregressive/prepare_prefill_inputs.h` + `src/vllm/v1/worker/gpu/spec_decode/autoregressive/prepare_prefill_inputs.cpp` — anchor `include/vllm/v1/spec_decode/rejection_sampler.h:96` | `tests/vllm/v1/spec_decode/test_rejection_sampler.cpp`; `tests/vllm/v1/worker/test_prepare_inputs.cpp` (expansion + no-draft byte-identity); `tests/vt/test_cuda_ops.cpp` (CUDA==CPU bit-exact at vocab 248320); **I5b** `tests/vllm/v1/spec_decode/test_prepare_prefill_inputs.cpp` (7 cases / 27 assertions, RED-first) — anchor `tests/vllm/v1/spec_decode/test_rejection_sampler.cpp:128` | [mtp-spec-decode.md §2.4,§5](specs/mtp-spec-decode.md) | `ACTIVE` | `CLAIM-SPEC-REJECTION-I3`, `CLAIM-SPEC-MTP-I5B` | | `SPEC-GDN-SEGMENTS` | GDN speculative metadata and slot-snapshot rollback. **I4 LANDED (2026-07-24):** the spec/non-spec metadata split with decode→prefill reclassification (the #34845 case), the `T>1`/`IS_SPEC` GDN recurrence with per-timestep state snapshots, the conv sliding window advancing by the ACCEPTED count, and the k+1 state-slot allocation. DEFAULT-OFF and INERT (`num_spec==0` ⇒ `num_spec_decodes==0`, no shipped kernel branched — both spec kernels are NEW op ids). ROLLBACK PROVEN bit-exact: for every rejection point j the surviving SSM state and conv window are memcmp-identical to running only the accepted prefix through the shipped `vt::GdnDecode`/`CausalConv1dUpdate`, at the real 27B (Hv=48) and 35B (Hv=32) GDN dims on CPU and CUDA. MEASURED state cost: one f32 SSM slot = Hv·Dv·Dk·4B ⇒ 144 MiB/req (27B, 48 layers) / 60 MiB/req (35B, 30 layers) per extra slot; k=1 doubles the GDN SSM state. **I5a GDN LAYER ROUTING WIRED (2026-07-24, `CLAIM-SPEC-MTP-I5A`):** `GdnBlockPaged`'s `num_spec_decodes>0` branch now routes a PURE-spec batch through `vt::CausalConv1dSpecUpdate` + `vt::GdnSpecDecode` (mirror `qwen_gdn_linear_attn.py:1344-1357,1455-1475`), and the runner per-step upload (`StepDevInputs`/`BuildStepDevInputs` + the two decode-graph `Refresh` copies) now carries I4's six spec device tensors, gated by the extended `ValidateGdnAttentionMetadata` spec contract. DEFAULT-OFF INERT (`num_spec_decodes==0` ⇒ stub uploads + the identical non-spec branch). BIT-EXACT vs the I4 ops applied as a token-sequential decode chain, at the real 27B/35B GDN dims, via `GdnBlockPagedForTest` (`tests/vllm/models/test_qwen3_5_gdn_spec_routing.cpp`, CPU bit-exact + CUDA on-device); RED-first by a reverted stub (spec recurrence zeroed ⇒ 4/8 fail, maxΔ 1.3-1.6). MIXED spec+non-spec batch refused loudly — lands with I5d's runner loop. Row advances to `ACTIVE`: the M-mtp-1 e2e greedy token gate (verify/propose runner wiring) is owed before `DONE`, and `SPEC-MTP` STAYS `GATING` | T1 | `vllm/v1/attention/backends/gdn_attn.py:189-326,413-462`; `fla/ops/fused_sigmoid_gating.py:66-72,103-116,156-166`; `mamba/ops/causal_conv1d.py:818-1067,1181-1184`; `qwen_gdn_linear_attn.py:1329-1576`; `mamba_utils.py:213-234`; `mamba/abstract.py:55-59` | `include/vllm/v1/attention/backends/gdn_attn.h`; `src/vllm/v1/attention/backends/gdn_attn.cpp`; `include/vt/ops.h` (`kGdnSpecDecode`, `kCausalConv1dSpecUpdate`); `src/vt/ops.cpp`; `src/vt/cpu/cpu_ops.cpp`; `src/vt/cuda/cuda_gdn.cu`; `src/vllm/model_executor/models/qwen3_5_common.{h,cpp}` (`MakeQwen3_5KVCacheSpec`); **I5a:** `src/vllm/model_executor/models/qwen3_5.cpp` (`GdnBlockPaged` spec branch, `StepDevInputs`/`BuildStepDevInputs`, `ValidateGdnAttentionMetadata`), `src/vllm/model_executor/models/qwen3_5_internal.h` (`GdnBlockPagedForTest`) | `tests/vllm/v1/attention/test_gdn_metadata_builder.cpp` (20 cases / 483 assertions incl. the full upstream `GDN_BUILD_TEST_CASES` + default-off byte-identity); `tests/vt/test_ops_gdn.cpp` (reject-at-every-j rollback, CPU + CUDA, real dims); `tests/vllm/models/test_model_registry.cpp` (k+1 slot / widened-conv sizing + `num_spec==0` identity); **I5a** `tests/vllm/models/test_qwen3_5_gdn_spec_routing.cpp` (spec-routing bit-exact, RED-first) — anchor `tests/vllm/v1/attention/test_gdn_metadata_builder.cpp:83` | [mtp-spec-decode.md §3,§5](specs/mtp-spec-decode.md) | `ACTIVE` | `CLAIM-SPEC-GDN-I4`, `CLAIM-SPEC-MTP-I5A` | | `SPEC-DFLASH` | Block-diffusion drafter. **READINESS RE-ASSESSED 2026-07-25 (`CLAIM-SPEC-DFLASH-READINESS`, design-only, DONE) against the LANDED MTP machinery (`SPEC-MTP` I1..I7).** Verdict **GREEN, dispatch-ready, NO hardware/oracle/download blocker** (spec [§0](specs/dflash-spec-decode.md)). Refreshed reuse-vs-new map: DFlash gets FREE from landed MTP — the frozen spec-metadata ABI, the greedy rejection sampler (k-general, I3 tested k∈{1,3}), the GDN spec slot path + rollback + mixed spec/non-spec batch (`GdnBlockPagedMixedSpec`/`IndexSelect`/`IndexCopy`, general `num_spec`), the widened-cache-aware conv ops (I5e), the draft-KV layer pattern (`fa_draft`), the I5d/I7 runner verify/propose loop, and **`num_lookahead_tokens=k+1` ALREADY coded** (`speculative.h:91-108` `use_dflash()`); EXTENDS the single I5d-pre `hidden_tap` seam to multi-tap `[T,H×taps]`; builds NEW the `qwen3_dflash` drafter, the project's FIRST non-causal in-block attention primitive, context-KV precompute, `prepare_dflash_inputs`, and the uniform-1+k FULL CG. **k>1 verdict:** the landed rejection + GDN machinery is MECHANICALLY k-general (no `k==1` hardwiring) — DFlash's k=15 blocks need NO mechanism extension, only exercise/validation at scale (D4) + the k+1-slot memory measurement (~2.3 GiB/req 27B GDN state at block-16, the #1 risk, §5). **Checkpoint-fit:** both z-lab drafts EXIST on HF (27B 1.73 GB / 35B 368 MB bf16, DFlashDraftModel) and FIT the 119 GiB pool trivially (drafts NOT yet on dgx — D0 downloads ≤1.73 GB); the active dgx oracle `vllm-oracle-v0.25.0-stage` CONSTRUCTS DFlash (registry `DFlashDraftModel→qwen3_dflash`, speculator dir present) — soft D0 risk = confirm it SERVES DFlash+NVFP4 on sm_121 (non-causal backend; community `AEON-7/vllm-dflash` container proves the combination runs on GB10). W-plan D0-D6 in the spec. **D0+D1 LANDED 2026-07-26 (`CLAIM-DFLASH-D0D1`) on the ADVANCED pin `555967922`/vLLM 0.26.0.dev0 — `SPEC-DFLASH` → `ACTIVE`.** D0 UNBLOCKED (vllm#40898 resolved under `VLLM_USE_V2_MODEL_RUNNER=1`): the mixed-attn z-lab 27B draft CONSTRUCTS + the drafter is ALIVE (acceptance 2.21/8.80/4.75/4.57 > 1, `num_spec=16`, flashinfer-native fp8-KV, goldens committed); gate FORM measured STRICT MODE-MATCHED (vLLM-ON run-deterministic K>=3 but != vLLM-OFF — the k=16 block verify diverges at bf16 near-ties, so NOT the MTP three-way identity). D1 `DF-AUX-TAPS` DONE: `Qwen3_5AuxTaps` + `ModelForwardInput::aux_tap` route to `Qwen3_5{,Dense}Model::ForwardDeviceMultiTap` capturing `(hidden+res)` at `target_layer_ids` into `[T,H×taps]` (eagle3 `_maybe_add_hidden_state`, aux key L+1); config-gated byte-identical off. Unit gate 598 assertions (independent truncated-model reference, RED-first reversed-concat 384 fail); CUDA 697/697 + compute-sanitizer 0; INERTNESS PROVEN — 27B MTP e2e 9/9 + 27B text SACRED 235/235 byte-identical on the new oracle. **D2 `DF-DRAFT-MODEL` CODE LANDED + CPU-GATED 2026-07-26 (`CLAIM-DFLASH-D2`, kernel row `KERNEL-ATTN-DFLASH-BLOCK`):** the `qwen3_dflash` draft model (plain 5-layer Qwen3-dense reusing `dense_attn_block.h` ops), the project's FIRST non-causal / bidirectional attention primitive `vt::DFlashBlockAttention` (a SEPARATE op — causal `kAttention`/`kPagedAttention` byte-identical), the fc aux-combine, mask-embed, per-layer SWA/full resolution, and the z-lab loader. CPU gate GREEN (op 12/12 incl. RED non-causal; model forward 95/95 incl. RED full-layer-causal-flip + block isolation + fc RED); existing causal `test_ops_attention` 9/9 + `test_qwen3_forward` 1028 UNCHANGED. **D2 GPU PROMOTION GREEN on dgx (`CLAIM-DFLASH-D2`):** CUDA `-Werror` clean, CUDA==CPU 198412/198412 + compute-sanitizer 0, draft-forward parity vs the REAL vLLM draft (fc rel-L2 0.46%, hidden ≤1.3%, 11 STRICT + 5 near-tie ids), 27B SACRED 235/235 + MTP 9/9 byte-identical — **D2 DONE.** **D3 `DF-DRAFT-KV-PREP` DONE 2026-07-26 (`CLAIM-DFLASH-D3`):** `PrecomputeContextKV` + `PrepareDflashInputs` + `ForwardBlockLogitsWithContext` (reuse the UNCHANGED D2 kernel via [context;block]); GPU numeric-parity `test_qwen3_dflash_kvprep_parity` 61/61 (prepare INTEGER bit-exact vs vLLM's Triton kernel, context-KV K/V rel-L2 0.31%/0.26%, 13 STRICT + 3 near-tie = 16/16), CPU 114/114 RED-proven, inertness 235/235 + 9/9 + D2 37/37 byte-identical. **D4 `DF-ENGINE-INTEGRATION` propose brick + `dflash` config-select CODE LANDED + CPU-GATED 2026-07-26 (`CLAIM-DFLASH-D4D5`):** `DflashProposeBlock`/`SampleDflashBlockDrafts` (the non-autoregressive whole-block propose composing D3 `ForwardBlockLogitsWithContext` + greedy per-mask argmax, anchor not sampled, `dflash/speculator.py:300-413`) + `ParseSpeculativeConfigJson`/`ResolveDflash` accept `method:"dflash"`. CPU gate `test_dflash_propose` 5/19 GREEN (RED-first anchor-read fails 4/5; brick composes forward+sampler; empty-ctx degenerates to D2; config lookahead k+1). Additive + config-gated ⇒ MTP + non-spec byte-identical BY CONSTRUCTION (`git diff --stat` = new speculator TU + config accept-list + CMake + test, NO runner/model/loader/scheduler edit). **D5 `DF-ENGINE-INTEGRATION` runner-loop LANDED + e2e RUNS on dgx 2026-07-26 (`CLAIM-DFLASH-D5`):** full verify/propose loop wired — loader loads the SEPARATE z-lab draft (`LoadDflashDraft`, host bf16 + target-SHARED bf16 embed/lm_head) via a `--speculative-config` `model` key + `ResolveSpecConfig` dflash branch + `runner.set_dflash_draft`; the verify forward captures the D1 multi-tap (`aux_tap`→`ForwardDeviceMultiTap`) instead of the MTP single tap; `propose_drafts_dflash` ACCUMULATES the per-request combined-feature context (`CombineAuxFeatures(aux_tap)`) across steps and honors the `num_rejected` rollback by appending only the `(T_req−num_rejected)` accepted-prefix features, then runs `DflashProposeBlock` (k=16 GDN-spec exercised first time). **e2e (`test_qwen27_dflash_spec_decode`, 4 prompts×32 tok, our-DFlash-ON vs the committed vLLM-DFlash-ON golden): 2/4 STRICT token-exact (fibonacci, three-laws) + acceptance ~ vLLM on ALL 4 (accepted 19/39/29/25 vs golden 17/39/30/25, deltas +2/0/−1/0 — the MANDATORY dead-drafter-trap condition MET).** The 2 divergences (France tok11 `2972`↔`11751`, 17*23 tok12 `567`↔`488`) are SINGLE bf16 near-tie flips (17*23 RE-CONVERGES after one token = proven near-tie; France cascades from one flip) — the ratified near-tie ROOT the D0 gate-form anticipated, rooted in the D3-documented inline bf16 context-KV recompute envelope (~0.3-1.3% rel-L2), NOT a wiring bug (proven by the 2 exact prompts + near-exact acceptance + a non-trivial shared prefix). Inertness GREEN on this build: SACRED `test_qwen27_paged_engine` 235/235 + MTP `test_qwen27_spec_decode` 9/9 byte-identical; CUDA `-Werror` clean; NO new CUDA kernel (host orchestration reusing D1/D2/D3-sanitized ops). **NOT a clean strict-4/4 pass; STRICT 4/4 token-identity + the speed A/B = D6 (the persistent paged draft-KV bit-matching vLLM's fused context-KV projections + the uniform-1+k FULL CG).** Row STAYS `ACTIVE` (correctness at the ratified near-tie envelope; D6 remains) **D6 2026-07-27 (`CLAIM-DFLASH-D6`) — c1 SPEED A/B DONE + STRICT-irreducibility RCA + CG feasibility (records-only, NO source code):** (1) **c1 speed A/B** (`examples/vllm-bench` at `361189a7`, 8 prose+code prompts×256 tok greedy c1, 2 reps): our DFlash-ON = **2.50x TPOT (40.4 vs 101.2 ms) / 2.48x output-tput (24.4 vs 9.86 tok/s)** over our OFF, acceptance 0.22 (3.56/16), rep-stable <1.5%; `benchmark_binding=true`. vs vLLM-DFlash-ON graphed (same workload): vLLM-DFlash-ON graphed = 28.5 tok/s / 35.1 ms TPOT / acceptance_len 4.30 (same 8 prompts, `VLLM_USE_V2_MODEL_RUNNER=1`, mm-off, gpu_util 0.30), so OURS IS ~14% BELOW vLLM-DFlash-ON on output throughput (24.4 vs 28.5 tok/s) - both ~on-par at spec-OFF (9.86 vs 9.83 tok/s), but vLLM extracts a larger DFlash speedup (2.90x vs our 2.47x) because its draft step is fully device-resident + CUDA-graphed (ours host-orchestrates 13 downloads/step) + slightly higher acceptance (~4.3 vs ~3.6 draft tokens/step). The DONE speed bar (ours >= vLLM) is NOT met; closing it = the device-resident draft rewrite + FULL CG (D6 part 2). (2) **STRICT-4/4 proven bf16-IRREDUCIBLE** — the draft KV cache is bf16 not fp8 (`torch_utils.py:398` `auto`→model dtype; the D0 "fp8-KV" was the backend name, not the KV storage dtype), the D3 golden already compares pre-storage bf16 (residual K 0.31%/V 0.26% = sub-ULP kernel noise), and a fused multi-layer KV GEMM is per-element invariant to our per-layer GEMMs ⇒ bit-exact needs vLLM's exact kernels ⇒ the ratified near-tie gate is the FINAL correctness form (no fused-KV code landed). (3) **FULL CG BLOCKED** on a device-resident draft-path rewrite (the D5 path does 13 device→host downloads/step + host `[context;block]` interleaving) — the remaining throughput-parity increment (the perf form of persistent-paged-KV + the graph). Inertness by construction (the gated binary is the D5 binary; SACRED 235/235 + MTP 9/9 stand). Evidence tool `scripts/spec/vllm_dflash_timing.py`. **D7 2026-07-27 (`CLAIM-DFLASH-D7`) — within-step draft forward made DEVICE-RESIDENT (source-owning): `PrecomputeContextKVDevice` keeps per-layer K/V on device; `ForwardBlockLogitsWithContext` builds [context;block] with `vt::IndexCopy`/`IndexSelect` (removes ~30 D→H `Download`s/step). BIT-IDENTICAL (identity bf16↔f32 round-trips replaced) — e2e `test_qwen27_dflash_spec_decode` 27/27 SAME tokens (2/4 STRICT + 2/4 near-tie, acceptance 19/39/29/25), SACRED 235/235 + MTP 9/9, CUDA `-Werror` clean, compute-sanitizer 0 (198412). But the direct old-vs-new A/B = +2.0% output-tput (IN-NOISE) ⇒ D6's "downloads = the ~14% gap" REFUTED by measurement; ours 19.68 tok/s STILL ~33% BELOW vLLM-DFlash-ON 29.2 tok/s (reconstructed 8-prompt set, more prose-heavy); OFF parity our 9.97 ≥ vLLM 9.66. Residual re-attributed: acceptance (ours 2.49 vs vLLM ~3.13 accepted draft-tok/step, bf16-irreducible) + per-step context-KV RECOMPUTE (O(context²), needs the cross-step persistent paged draft-KV store) + eager-vs-graphed. SPEED BAR NOT met; SPEC-DFLASH stays `ACTIVE`; next = persistent paged draft-KV store → then FULL CG. **D9 2026-07-27 (`CLAIM-DFLASH-D9`) — PERSISTENT PAGED DRAFT-KV LANDED (bit-identical, +22.7% throughput, 0.69×→0.917×); D8 acceptance-ceiling REFUTED; residual = FULL CG ONLY:** `qwen3_dflash.cpp` `AppendContextKVHost` (project ONLY newly-accepted rows → per-layer bf16 K/V, append to `PrecomputedContextKV`) + `ForwardBlockLogitsWithPrecomputedKV` (upload the persistent store, NO re-projection) share the core `ForwardWithCtxKVDev` with the old recompute; `runner.cpp::propose_drafts_dflash` swaps the O(context²) per-step recompute (`dflash_ctx_feats_`) for an append-only per-request `dflash_kv_store_` (rollback=don't-append). NO new CUDA kernel; config-gated. BIT-IDENTICAL: CPU `test_dflash_propose` two new D9 cases = exact float equality vs full recompute; GPU e2e `test_qwen27_dflash_spec_decode` **27/27 SAME tokens** (acceptance 19/39/29/25, same divergences France@11/17×23@12); SACRED 235/235 + MTP 9/9 byte-identical; CUDA `-Werror` clean. **A/B (c1, 8 prose+code×256 tok input-len 512, 2 reps <0.1%, `benchmark_binding=true`):** ours-ON **25.75 tok/s** (was D8 20.99, +22.7%) / 38.40 ms TPOT / acc **3.68/step** vs vLLM-ON graphed **28.09** / 35.60 / acc 3.31 = **0.917×** (~8% below, was 0.69×). **Part 1 same-trajectory:** on the 2 token-identical-trajectory prompts ours per-step acceptance == vLLM's EXACTLY (fibonacci 7.80/7.80, three-laws 3.571/3.571, ratio 1.00) AND on the A/B ours acceptance (3.68) is HIGHER than vLLM's (3.31) ⇒ D8's 0.80–0.85× "bf16 acceptance ceiling" is a trajectory-divergence CONFOUND, REFUTED. Residual (~8%) = eager-vs-graphed ONLY (ours ON/OFF 2.60× vs vLLM 2.91×, OFF at parity, recompute eliminated, acceptance higher) — NOT an irreducible ceiling; the FULL uniform-(1+k) CG (device paged-KV store + paged attn, new-CUDA multi-file) is the SOLE un-landed increment. SPEC-DFLASH stays `ACTIVE` (speed not yet ≥ vLLM; residual isolated to FULL CG). **D12 2026-07-27 (`CLAIM-DFLASH-D12`) — A-wire + Part B LANDED + GPU-gated; Part C (capture) remaining; 0.917×:** A-wire makes the D11 Part-A device store the PRODUCTION path (`runner.{h,cpp}` `dflash_kv_store_`→`shared_ptr`, `MakeDeviceKVStore`/`AppendContextKVDevice`/`ForwardBlockLogitsWithDeviceKV`; GPU-gated e2e `test_qwen27_dflash_spec_decode` 27/27 all-exact acceptance 19/39/29/25 + SACRED 235/235 + MTP 9/9 byte-identical, `-Werror` clean). Part B adds `vt::DFlashPagedBlockAttention` (`OpId::kDFlashPagedBlockAttention`), the capture-safe paged kernel with EVERY metadata input a persistent DEVICE tensor and NO function-local host `cu_seqlens` upload (fixes the `cuda_ops.cu:1277-1280` capture-UAF class), gated CPU==CUDA + cross-check vs materialized `DFlashBlockAttention` `test_ops_dflash_paged_block_attn` 795648/795648 + compute-sanitizer 0. Speed 0.917× (A-wire eager + Part B not yet wired into the forward); `benchmark_binding=false`. Part C (static-shape capture + device mask-scatter + `BeginCapture`/replay + the ≥vLLM c1 A/B) is the SOLE remaining piece; if ours-ON-graphed ≥ vLLM-ON → SPEC-DFLASH DONE. Stays `ACTIVE`. **D13 2026-07-27 (`CLAIM-DFLASH-D13`) — Part C LANDED + GPU-GATED; capture-correctness PROVEN; c1 throughput NEAR-PARITY (ours 0.978x, ~2% below vLLM); gap CLOSED 0.917x→0.978x; STAYS `ACTIVE` (≥vLLM bar not yet met):** single-file additive change (`qwen3_dflash.cpp` +368/-58). (C.1) `DflashDeviceKVStore` → fixed-capacity PAGED cache (per-layer pool `[max_pages,16,Hkv,Dh]` + identity `block_table` + `seq_lens`; append = `vt::IndexCopy` scatter at slot==abs-pos, bit-identical to the D9/D11 store). (C.2) `ForwardPagedBody` runs the (1+k) block through the D12 `vt::DFlashPagedBlockAttention` reading the paged store (no `[context;block]` materialization, no function-local host uploads); runner P==1 propose routes through it, P>1 bit-identical materialized fallback. (C.3) per-request CUDA GRAPH over the paged draft step (warm-in-step repopulates the shared pool free-list right before `BeginCapture` — the fix for a `cudaMalloc`-in-capture `Get` miss from the intervening 27B target forward — then `BeginCapture → ForwardPagedBody → EndCaptureGraph`, replay with growing context entering only via in-place `seq_lens`). **Capture-correctness (MANDATORY): `test_qwen27_dflash_spec_decode` 27/27 with the graph (VT_DFLASH_GRAPH=1) BIT-IDENTICAL to eager (=0)** — same divergence tokens (France@11 got[…2972…], 17×23@12 got[…567…]), same acceptance 19/39/29/25 as D5/D7/D9/D12; graph ENGAGED (5 captures C=2048/5/4/15/6, 32+ replays); the token-diff is the capture-safety proof ([[cudagraph-capture-bakes-stack-addresses]]). **c1 A/B (one flock series, cold rep discarded, 8 prompts×256 tok):** our OFF 10.24 / our ON eager-paged 28.65 (28.69,28.61) / **our ON GRAPHED 28.70 (28.70,28.70), TPOT 34.40** / vLLM-ON graphed steady-state 29.35 (tight 3-rep 29.33/29.37/29.33, TPOT 34.07, acc_len 4.44); D9's 28.09 was a colder cross-session outlier — **NEAR-PARITY: ours 0.978× (~2% below) on the rigorous same-session band** (across sessions ours 28.70 falls inside vLLM's observed 28.09–29.37 range). ON/OFF 2.80× (vLLM ~2.98×), our OFF ≥ vLLM OFF. Per the acceptance rule ("below on any axis = an open gap; near-parity is NOT met"), the ≥vLLM bar is NOT met; STAYS `ACTIVE`. Residual (data-grounded): NOT acceptance (ours realized ~3.68 accepted draft-tok/step > vLLM's 3.44) and NOT launch/graph (both graphed, CG neutral) — per-step COMPUTE (~2% slower target-step); next lever = nsys both draft steps (`--cuda-graph-trace=node`), no premature ceiling. **ATTRIBUTION (supersedes D9):** the CUDA graph is perf-NEUTRAL (+0.3%); the ACTUAL lever was the paged context read (C.1/C.2) removing the D9/D12 per-layer `[context;block]` `IndexCopy` materialization of the whole growing context (25.75 D9 → 28.65 eager-paged, +11%) — the roadmap's "the full CG closes the gap" premise is corrected by measurement. Inertness VERIFIED on the capture binary: SACRED 235/235 + MTP 9/9 byte-identical, CUDA `-Werror` clean, no new kernel (D12 paged kernel already memcheck-0 795648), `check-device-leakage` not increased (paged path REMOVES the materialized-buffer allocs + host uploads). `benchmark_binding=true`. Correctness-complete (ratified near-tie); throughput NEAR-PARITY (0.978×, ~2% residual) ⇒ STAYS `ACTIVE` (the capture-correctness gate is MET; the ≥vLLM speed bar is the sole remaining item, a ~2% per-step-compute residual for an nsys). Anchors: `src/vllm/model_executor/models/qwen3_dflash.cpp` (`DflashDeviceKVStore` paged store, `ForwardPagedBody`, the per-request graph in `ForwardBlockLogitsWithDeviceKV`). **D14 2026-07-27 (`CLAIM-DFLASH-D14`) — SPEED GATE MET → SPEC-DFLASH `DONE`:** an nsys (`--cuda-graph-trace=node`) of the graphed spec-on step attributed the D13 ~2% residual to the from-scratch `DFlashPagedBlockAttentionKernel` draft attention (242.9 ms = 1.8% of GPU time, median ~460 us/call over context C~500-640, vs vLLM's fused flash draft-attn ~0.15%; BOTH engines run identical `cutlass_80_wmma` for the draft bf16 GEMMs, so the GEMMs were NOT the gap). Ported it to a WARP-scoped online-softmax variant `DFlashPagedBlockAttentionWarpKernel` (mirrors the shipped `AttentionWarpKernel`: one warp per (block-query,head), `__shfl_xor` butterfly reduction, register accumulator, NO `__syncthreads` storm; SAME paged/block combined-index read + causal/SWA mask + GQA; default ON, `VT_DFLASH_ATTN_BLOCK=1` keeps the bit-identical D12/D13 block kernel for A/B). Draft attn 242.9 → 77.9 ms (3.1x); our-ON c1 28.60 → 29.32 tok/s (+2.5%). **FINAL same-session 3-rep A/B (8 prompts×256 tok, cold leg discarded): our-ON graphed 29.42/29.27/29.32 (med 29.32) vs vLLM-ON graphed 29.240/29.247/29.233 (med 29.240) — our WORST rep (29.27) > vLLM's BEST (29.247), NON-OVERLAPPING bands, 1.003× ⇒ the ≥vLLM speed gate is MET.** Correctness UNCHANGED (output is exact by spec-decode construction — the target verify is untouched, only which draft proposals are accepted can shift): e2e `test_qwen27_dflash_spec_decode` 27/27 with graph==eager BIT-IDENTICAL, acceptance 19/39/29/25 unchanged (draft accepted 1629 identical warp-vs-block across the whole A/B set), 2/4 STRICT (France@11, 17×23@12 unchanged); CUDA==CPU `test_ops_dflash_paged_block_attn` 795648/795648 (warp within the f32 1e-4 / bf16 3e-2 envelope) + compute-sanitizer 0. Inertness SACRED 235/235 + MTP 9/9 byte-identical; CUDA `-Werror` clean; `check-device-leakage` not increased. `benchmark_binding=true`. Block-diffusion drafting is now correctness-complete (ratified near-tie) AND at/above vLLM throughput — this was the roadmap's FINAL open speed item. Anchors: `src/vt/cuda/cuda_ops.cu` (`DFlashPagedBlockAttentionWarpKernel` + `UseDflashAttnBlockKernel`; the D12 block kernel retained as the `VT_DFLASH_ATTN_BLOCK=1` reference). | T1 | `vllm/v1/worker/gpu/spec_decode/dflash/speculator.py`; `vllm/model_executor/models/qwen3_dflash.py`; `vllm/model_executor/models/interfaces.py:1382` (aux value); `eagle3_utils.py:41-56` (+1 shift) | `include/vllm/model_executor/models/qwen3_5.h` (`Qwen3_5AuxTaps`, `ForwardDeviceMultiTap`); `qwen3_5_dense.h`; `model_registry.h` (`aux_tap`); `src/vllm/model_executor/models/qwen3_5.cpp` (`MaybeCaptureAuxTap`/`ValidateAuxTapLayerIds`/`ForwardDeviceMultiTap`); `qwen3_5_moe.cpp`+`qwen3_5_dense.cpp` (routing); D2/D3 `include/vllm/model_executor/models/qwen3_dflash.h` + `src/vllm/model_executor/models/qwen3_dflash{,_weights}.cpp`; D4 `include/vllm/v1/worker/gpu/spec_decode/dflash/speculator.h` + `src/vllm/v1/worker/gpu/spec_decode/dflash/speculator.cpp` (`DflashProposeBlock`/`SampleDflashBlockDrafts`); D5 `src/vllm/entrypoints/model_loader.cpp` (`LoadDflashDraft`/`DflashDraft`) + `include/vllm/entrypoints/model_loader.h`; D5 `src/vllm/v1/worker/gpu/runner.cpp` (`set_dflash_draft`/`propose_drafts_dflash`/aux-tap capture) + `include/vllm/v1/worker/gpu/runner.h`; `src/vllm/config/speculative.cpp` + `include/vllm/config/speculative.h` (`ResolveDflash` + `dflash`/`model` parse); D14 warp kernel [cuda_ops.cu](../src/vt/cuda/cuda_ops.cu#L1433) | `tests/vllm/models/test_qwen27_paged_forward.cpp` (multi-tap 598); `tests/vt/test_ops_dflash_block_attn.cpp`; `tests/vllm/models/test_qwen3_dflash_forward.cpp`; `tests/vllm/v1/spec_decode/test_dflash_kvprep.cpp`; `tests/parity/test_qwen3_dflash_{draft,kvprep}_parity.cpp`; D4 `tests/vllm/v1/spec_decode/test_dflash_propose.cpp` (5/19, RED-first); D5 `tests/parity/test_qwen27_dflash_spec_decode.cpp` (e2e 27/27, 2/4 strict + acceptance~vLLM); `scripts/spec/d{0,2,3}_dflash_*.py`; `tests/parity/goldens/dflash_27b{,_draft,_kvprep}/`; D6 `scripts/spec/vllm_dflash_timing.py` (vLLM-DFlash c1 timing); D7 device-resident `src/vllm/model_executor/models/qwen3_dflash.cpp` (`PrecomputeContextKVDevice` + `ForwardBlockLogitsWithContext` via `vt::IndexCopy`/`IndexSelect`); D9 persistent paged draft-KV `qwen3_dflash.{h,cpp}` (`AppendContextKVHost`/`ForwardBlockLogitsWithPrecomputedKV`/`ForwardWithCtxKVDev`/`PrecomputedContextKV`) + `runner.{h,cpp}` (`dflash_kv_store_`/`propose_drafts_dflash`) + `tests/vllm/v1/spec_decode/test_dflash_propose.cpp` (2 D9 bit-identity cases); D12 A-wire `runner.{h,cpp}` (device store as production path) + D12 Part B `include/vt/ops.h`/`src/vt/ops.cpp`/`src/vt/cpu/cpu_ops.cpp`/`src/vt/cuda/cuda_ops.cu` (`kDFlashPagedBlockAttention`) + `tests/vt/test_ops_dflash_paged_block_attn.cpp` (CPU==CUDA + cross-check, 795648/795648 + sanitizer-0); D13 `src/vllm/model_executor/models/qwen3_dflash.cpp` (fixed-capacity paged `DflashDeviceKVStore` + `ForwardPagedBody` + the per-request draft-step CUDA graph in `ForwardBlockLogitsWithDeviceKV`); D14 [test_ops_dflash_paged_block_attn](../tests/vt/test_ops_dflash_paged_block_attn.cpp#L79) + [ledger](parity-ledger.md#L738) | [dflash-spec-decode.md](specs/dflash-spec-decode.md) | `DONE` | `489a7544` | @@ -280,13 +280,13 @@ claims it. | `LOAD-SAFETENSORS` | General safetensors loading, stacked parameters, weights mapping. Binding memory scan finds all source mappings live through load plus a persistent CPU mirror of selected tensors; windowed progressive `madvise(DONTNEED)` release now drops each copied-then-dead source range during the copy loop so the mirror build no longer double-resides with the full source mmap | T0 | streamed target-device construction `vllm/model_executor/model_loader/base_loader.py:43-82`; incremental `safe_open` yield `vllm/model_executor/model_loader/weight_utils.py:905-954`; immediate parameter copy `vllm/model_executor/models/utils.py:170-180,252-279` | all mappings opened/retained `src/vllm/entrypoints/model_loader.cpp:47-63,303-312`; `MAP_PRIVATE` reader `src/vllm/model_executor/model_loader/safetensors_reader.cpp:43-70`; windowed release primitive/gate `src/vllm/model_executor/model_loader/safetensors_reader.cpp:285-340`; copy-helper instrumentation `src/vllm/model_executor/models/qwen3_5_weights.cpp:88,104,119,171,190,226,231` + `qwen3_5_dense_weights.cpp:64,80,109,159,164,263,323` | [reader contracts + windowed-release cases](../tests/vllm/test_safetensors.cpp#L68) green (smaps-Rss drop, byte-identity, gate semantics, neighbor safety); exact 27B accounting finds **1,155 tensors / 24,610,136,064 B (22.920 GiB)** persistent host bytes. **VmHWM A/B MEASURED** at `cb2d310` (root `~/work/vllm.cpp-windowed-load/cb2d310c…518/evidence`, one flock, single 27B load per arm): OFF **48,285,916 kB** vs ON **24,750,704 kB = VmRSS** (**−23.54 GB**, load transient eliminated), ON-arm smoke 6/6; ledger row 2026-07-15. Exact-grid memory axes remain `FAILED` (projected PASS); direct-device streaming gate still open | [specs/safetensors-windowed-load.md](specs/safetensors-windowed-load.md) | `PARTIAL` | - | | `ENG-LOAD-DIRECT-UPLOAD` | Cut the SECOND copy out of a safetensors load: a weight the device consumes VERBATIM VIEWS the read-only shard mmap (`OwnedBytes::Borrow`, keep-alive carried on `StTensor::mapping`) instead of being copied into an owned host buffer, so `ResidentWeight` uploads straight from the file mapping and the load moves those bytes ONCE. Backend- and arch-agnostic: it lives in the shared dense loader helpers, so every arch that routes through them inherits it. Additive leaf below `LOAD-SAFETENSORS`; the windowed source-page release is preserved and now also runs after the device upload. Non-verbatim paths (transpose, dtype conversion, dequant, concatenation, GGUF load-time repack) are unchanged and keep their copy. Also lands the measurement half of issue #150: per-phase load timing plus host-copy / borrowed / device-upload byte counters (`VT_LOAD_STATS`) | T1 | one move per byte: streamed shard iterator `vllm/model_executor/model_loader/weight_utils.py:905-954`; immediate copy into the destination parameter `vllm/model_executor/models/utils.py:252-279`; driver `vllm/model_executor/model_loader/base_loader.py:43-82` @ `555967922` | refcounted mapping `src/vllm/model_executor/model_loader/safetensors_reader.cpp:46-80,231-262`; byte counters `:337-400`; `BorrowStTensorBytes` + post-upload adoption/release `src/vllm/model_executor/models/qwen3_5_weights.cpp`; qualifying call sites `include/vllm/model_executor/models/dense_weight_loaders.h` (`LoadBf16Direct`, `LoadCtNvfp4W4A16`, `LoadCtMxfp4W4A16`), `src/vllm/model_executor/models/qwen3_5_dense_weights.cpp` (`LoadModelBf16Direct`, `LoadCtNvfp4Raw`), `src/vllm/model_executor/models/qwen3_5_weights.cpp` (35B `LoadBf16Direct`); upload counter `include/vllm/model_executor/models/dense_attn_block.h`; fp4 resident upload counter + post-upload residency `include/vllm/model_executor/models/dense_nvfp4_gemm.h` (`ResidentNvfp4`) and `src/vllm/model_executor/models/qwen3_5.cpp` (private `ResidentNvfp4`); shared checker text normalization `scripts/checker_text.py` | [mechanism gate](../tests/vllm/test_load_direct_upload.cpp#L1) 14/14, 183 assertions (178 through round 4) — the 6 borrow-mechanism cases, 4 post-upload residency cases that pin the adopt branch, its RELEASE-BEFORE-REASSIGN ordering and the `VT_ADOPT_DEVICE_BYTES` decoupling, 3 fp4-resident cases that pin `ResidentNvfp4`'s upload accounting, its `d_dev` publication, its adoption and the previously unexercised NON-borrowed/host-addressable regime, and 1 case that pins the GENERAL adopt branch's `MADV_DONTNEED` by OBSERVING RESIDENCY (`mincore()` over the host mirror's interior pages, glibc pinned to the sbrk arena so `free()` cannot return them by itself) — the RSS half of this row, which every value assertion was blind to. RED under eleven mutations, each applied alone with the binary rebuilt (a failed build aborts rather than re-running a stale one), tree md5-verified restored and re-GREEN after each. Mutations are named by the TEST CASE they land on, never by a line ref, because carried-forward line refs are how the counts below were twice recorded wrong: drop the size-identity check 1 case / 5 assertions; skip the borrow in `LoadBf16Direct` 2 / 7; delete the adopt branch 5 / 19; move the release after the `bytes` reassignment 5 / 7 (incl. the ordering assertions read from inside the munmap); move the release after the host-addressable early return but BEFORE the env one 2 / 3; move it after the `VT_ADOPT_DEVICE_BYTES` early return, i.e. after BOTH, 3 / 4; delete the general branch's `MADV_DONTNEED` 1 / 1; `ResidentNvfp4` drop both `AddDeviceUpload` 3 / 3; drop both `d_dev` publications 3 / 20; drop both `AdoptDeviceBytesAsHost` 3 / 16; all six at once 3 / 23. FOUR of those rows had been recorded wrong (1/1, 2/2, 3/7 and 3/3) — every one a count measured against an older suite and copied forward rather than re-measured; all eleven are measured on this tree. The `qwen3_5.cpp` duplicate of `ResidentNvfp4` is in an anonymous namespace no test can call, so it is held to the same invariant by [`scripts/check-fp4-resident-consistency.py`](../scripts/check-fp4-resident-consistency.py) (42-case mutation suite), which checks PER BUFFER inside each buffer's own `if (!w.d_)` upload block — body-wide matching let one surviving `AddDeviceUpload` satisfy both buffers, so dropping exactly one counter passed (reproduced against the real `qwen3_5.cpp` text: old checker exit 0, new exit 1). Nine drop-one/substitute-one mutations of the LIVE duplicate now go RED. Round 5 closed two holes in it. It matched RAW source, so a statement left behind as a COMMENT, inside `#if 0`, or inside `if (false)` read as present while the compiler saw a deletion; the clause matchers now run on [`scripts/checker_text.py`](../scripts/checker_text.py)'s `normalize_source`, which blanks all three IN PLACE so byte offsets and line numbers survive — `strip_comments` had existed as two byte-identical private copies (check-runner-routing-consistency.py, check-surface-coverage.py) and both now import the shared helper instead of a third copy being written. And the ordering clause required PUBLISH-before-ADOPT but not COPY-before-ADOPT, so a body whose adoption runs BEFORE its copy passed although the upload then reads pages the adoption already released; new clause (f) READ-FIRST covers it. WHICH MOTION produces that order is part of the claim, because the two are different mutations: SINKING `d.b.Copy(...)` to below `AdoptDeviceBytesAsHost` leaves the `d_dev` publication in place so ONLY clause (f) bites (MEASURED on the live duplicate, old exit 0 / new exit 1 — the 0/1 row below), whereas HOISTING the adoption above the copy also lifts it above the publication and trips the PRE-EXISTING clause (e), which the old checker already caught (MEASURED 1/1) and which is therefore no evidence for (f). The equivalent mutations of the SHARED `dense_nvfp4_gemm.h` copy are red at run time, MEASURED one at a time with the binary DELETED before each rebuild and the header md5-verified (`4665255f7af6f52254367f9118ad92ee`) before and after each: sink `packed`'s `Copy` 2 cases / 2 assertions, sink `scale`'s 2 / 2, sink BOTH 2 / 4 — the failures are `w..bytes.data()[0] == kSrcPattern` and `AllBytesMatchPattern(...)` in `fp4 resident: ResidentNvfp4 COUNTS its upload…` and `fp4 resident: a host-addressable device adopts an OWNED fp4 mirror too`, TWO per mutated buffer, so an ODD count is not obtainable; hoist `packed`'s adoption 3 / 8 and hoist both 3 / 16, wider because a null `d_dev` makes the adoption return immediately and also takes the NON-host-addressable case. This clause had been recorded as **2 cases / 3 assertions**, which is the count of the *release after the host-addressable early return, BEFORE the env one* row carried onto a different mutation — the same failure mode as the four rows above, found by a fifth reviewer and re-measured here rather than copied. MEASURED on the LIVE `qwen3_5.cpp` on disk, one mutation at a time, md5-verified restored after each (35b5ea250f490105d579f4ffb573aa36 before and after all eleven) — old checker exit / new checker exit: delete the packed adoption 1/1, `//` it out 0/1, `/* */` it out 0/1, `#if 0` around it 0/1, `if (false)` around it 0/1, `//` the packed upload counter 0/1, `//` the packed `d_dev` publication 0/1, `#if 0` around that publication 0/1, `if (false)` around it 0/1, SINK the packed `Copy` to below its adoption 0/1. That gate is STRUCTURAL: it guards the duplicate against DELETION — including deletion disguised as a comment, an `#if 0` or a never-taken branch — against gross substitution and against mis-ordering, NOT against corruption, and it does not model the preprocessor (extending it to arbitrary `#ifdef` conditions is DECLINED: `#ifdef VT_CUTLASS_NVFP4` around the live adoption stays exit 0 in both checkers, because a build configuration is not a disguised deletion). Run-time proof exists only for the shared copy. The `mincore()` residency case now also carries a RUNTIME allocator guard — `#if __GLIBC__` proves the headers, not that glibc's allocator is running — which goes red (1 case / 1 assertion) when a purging allocator is simulated; the `mallopt` calls leave glibc's `no_dyn_threshold` set for the process either way, MEASURED as not specific to `M_TRIM_THRESHOLD` (glibc 2.39, `mallinfo2().hblks` probe: no mallopt LIVE, `M_TRIM_THRESHOLD` DISABLED, `M_MMAP_MAX` DISABLED), so it is recorded rather than removed. Round-4 re-run on the dev box, CLEAN Vulkan/llvmpipe Release build: `test_load_direct_upload` 14/14 (178), `test_safetensors` 34/34 (79), `test_qwen36_weights` 7/7 (45), `test_vulkan_backend` 35/35 (2107), `test_backend_cross_device` 11/11 (132), `test_opt_paged_engine` **6/6 token-exact (96/96), 0 declines, device type 3**. Round-5 re-run on the same box, branch rebased onto `a0fa12c7`, all identical except `test_load_direct_upload` **14/14 (183)** — the five added assertions are the RSS-reclaim case's runtime allocator guard, no case-count change — plus `test_checker_text` 33/33 and `scripts/gen-vulkan-spirv.py --check` `committed SPIR-V is up to date` run with the pinned `~/tools/glslang-16.5.0/bin/glslang` (without it the script exits 1 on this tree, so the green is a real compile-and-compare and not a skip). Round 6 changed NO compiled file — this row, the spec, the `(f)` clause docstring and one checker-test name — and re-ran the whole battery on the branch rebased onto `e3cc4f64`, CLEAN Release Vulkan build, 0 warnings: every count above reproduces byte-for-byte, `check-fp4-resident-consistency` rc 0, its suite 42, `test_checker_text` 33, `test_check_surface_coverage` 46, `test_check_runner_routing_consistency` 31, SPIR-V check up to date, preflight all green. GB10 Vulkan gates on the changed tree: `test_vulkan_backend` 35/35 (2650), `test_backend_cross_device` 11/11 (132), `test_opt_paged_engine` **6/6 prompts token-exact (96/96), 0 declines, device type 3**. GB10 CUDA (cutlass+triton) full `ctest` **383/393**, BOTH SACRED gates PASS (`test_qwen36_paged_engine`, `test_qwen27_paged_engine`); all 10 failures reproduce with the same signature on a clean `origin/main` CUDA build. MEASURED 27B bf16 load **1.54x warm / 1.61x cold**, bytes moved **100.196 -> 81.260 GiB** | [specs/load-direct-upload.md](specs/load-direct-upload.md) | `ACTIVE` | `CLAIM-ENG-LOAD-DIRECT-UPLOAD` | | `LOAD-SAFETENSORS-DIRECT-DENSE` | Layer-bounded target-device loading for ordinary plain-BF16 Qwen3.5 dense safetensors on discrete CUDA; additive leaf below `LOAD-SAFETENSORS`, preserving windowed source release and owned-shard lifetime. Plain weights, stacked raw-NK owners, tied logits, logical resident state and same-queue layer staging are implemented and locally CUDA-gated. H32 Triton AOT, plain-BF16 decode graphs and ratio-4 FA2 repair the transplanted hot path; the broader row remains speed-gating | T1 | target-device model construction `vllm/model_executor/model_loader/base_loader.py:43-82`; incremental safetensors yield `vllm/model_executor/model_loader/weight_utils.py:820-954`; stacked/tied parameters `vllm/model_executor/models/qwen3_5.py:276-303,483-492` | load/dispatch `src/vllm/model_executor/models/qwen3_5_dense_weights.cpp:52-133,187-246,334-472`; discrete/unified classifier `src/vt/cuda/cuda_backend.cu:251-265`; plain execution/residency and graph selection `src/vllm/model_executor/models/qwen3_5.cpp`, `src/vllm/model_executor/models/qwen3_5_dense.cpp`; H32 recurrence `src/vt/cuda/cuda_gdn.cu`; ratio-4 FA2 `src/vt/cuda/cuda_flash_attn_fa2.cu`, `src/vt/cuda/cuda_paged_attn.cu`; exact benchmark corpus/output capture `examples/bench/bench_core.h:61-68,357-386,409-589`; reference metrics/token collector `tools/bench/vllm_closed_loop_metrics.py`; guarded driver and summarizer `tools/bench/run_qwen35_4b_compare.sh`, `tools/bench/summarize_qwen35_4b_compare.py` | [Real 4B graph/direct ON/OFF/eager gate](../tests/vllm/models/test_qwen35_plain_weights.cpp#L80) passes **3/3, 1672/1672**; [H32/GDN tests](../tests/vt/test_ops_gdn.cpp#L1) **10/10** flag and **66/66, 4242/4242** full; [paged-attention tests](../tests/vt/test_ops_paged_attn.cpp#L1354) **25/25, 454474/454474**. Final 18-leg root `/tmp/qwen35-main-final-fa2-20260725` plus stable vLLM confirmation: direct ON/OFF/vLLM-0.25 total **5769.99/5660.70/5849.80 tok/s**, output **638.03/625.94/646.85**, TPOT/ITL **43.72/43.84/38.55 ms**, peak PSS **2.406/8.592/7.662 GiB**, stable PSS **0.759/8.589/4.029 GiB**, VRAM **12850.7/12843.3/12942.7 MiB**. ON=OFF output IDs 128/128 every pair; ON is **+1.93%** total and cuts peak/stable PSS **72.0%/91.2%**. H32 AOT/graph/FA2 A/B gains are **+4.59%/+0.39%/+1.60%**. Graph-node trace has 453 launches and 200972 child kernels; local FA2 is 180.28 us/call vs vLLM 178.40, so the remaining **0.9864x** throughput and TPOT gap is host/engine-side. Sanitizer availability and external 27B/35B remain open | [plain-BF16 direct-load spike](specs/qwen35-plain-bf16-direct-load.md); [2026-07-25 evidence](../docs/bench-evidence/qwen35-4b-main-repair-20260725.md) | `GATING` | - | -| `ENG-MOE-HOSTFREE` | MoE Marlin resident host-weight release: after `BuildMoeMarlinResident` uploads+repacks the routed experts to the device Marlin resident, free the per-expert fp4 HOST mirror (`OwnedTensor` packed+scale bytes) and `madvise(MADV_DONTNEED)` the pages back to the OS — returns the ~16.9 GiB steady 35B host double-store (`LoadNvfp4Raw` `MakeOwned` copies kept resident forever). Guarded to the committed Marlin path (`MarlinMoeEnabled()`; retained for the `VT_NVFP4_MARLIN=0` wmma fallback that re-reads them); `VT_MOE_HOST_FREE=0` A/B rollback. Realizes `release_host_weights_after_upload` for the dominant host consumer. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the host-free decision is now CONSUMED from `GetPlatform(d.q.device.type).residency_policy()` via `vllm::platforms::ShouldReleaseHostWeights(policy, MarlinMoeEnabled()/*kernel-path*/, VT_MOE_HOST_FREE/*env*/)` — `CudaPlatform` flag flipped false→true (reproduces today EXACTLY); `MarlinMoeEnabled()` stays the orthogonal KERNEL-PATH safety gate.** | T0 | streamed target-device weight construction `vllm/model_executor/model_loader/base_loader.py:43-82`; residency capability `vllm/platforms/interface.py:134-229`; Marlin MoE in-place repack (no host mirror) `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434` | free region `src/vllm/model_executor/models/qwen3_5.cpp:3743-3781`; `OwnedTensor::ReleaseHost` decl `include/vllm/model_executor/models/qwen3_5_weights.h:65` + impl (madvise+swap) `src/vllm/model_executor/models/qwen3_5_weights.cpp:24`; public hook `Qwen3_5Model::PrepareMarlinResident` `src/vllm/model_executor/models/qwen3_5.cpp:9478` | `tests/vllm/test_qwen36_weights.cpp:283` (`ReleaseHost` frees buffer+capacity) + `:314` (`PrepareMarlinResident` release under Marlin / retention under `VT_NVFP4_MARLIN=0`, DGX release 27/27 + retention 15/15); DGX A/B (`VT_MOE_HOST_FREE`) 35B STEADY serving PSS **20.17→3.53 GiB** (root `dgx:~/work/mem35-hostfree`); token-neutral 315/315 + 235/235; c2 smoke clean; memcheck clean. Whole-window load-phase PEAK bounded by the `ENG-MOE-LOADSTREAM` follow-up. Ledger [parity-ledger.md#L521](parity-ledger.md#L521) | [moe-marlin-host-free.md](specs/moe-marlin-host-free.md) | `DONE` | `ac77bec` | -| `ENG-MOE-LOADSTREAM` | 35B load-phase PEAK-PSS interleave (follow-up to `ENG-MOE-HOSTFREE`): the steady free returns the routed-expert host mirror only AFTER the whole model loads, so whole-window `peak_pss`/`peak_rss` (~19.8 GiB) is still set by all N layers' ~256 experts host-coexisting at load. DEFER the routed-expert host copies (`LoadQwen3_5Moe` loads each layer WITHOUT experts + installs a per-layer `load_layer_experts` streaming closure that owns the mmap'd shards) and materialize ONE layer's experts inside `PrepareMarlinResident` immediately before that layer's device Marlin build + host free — so at most one layer's experts coexist on the host (peak ~ one layer, not all N). Device residents byte-identical (same source bytes, same per-layer build order). Non-CUDA/`VT_NVFP4_MARLIN=0`/no-Marlin build falls back to bulk host materialization (their forward reads the host bytes). 27B is a different loader (`LoadQwen3_5Dense`, true-W4A4) → unaffected; GGUF/synthetic/borrowed pass no shards owner → eager. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the per-layer interleave gate is now CONSUMED from `GetPlatform(queue.device.type).residency_policy()` via `vllm::platforms::ShouldInterleaveLoadStream(policy, MarlinMoeEnabled())` — reproduces the old `queue.device.type != kCUDA` OR `!MarlinMoeEnabled()` gate EXACTLY (unified/CPU retain-host ⇒ policy false ⇒ materialize-all fallback); the ~4 GiB load-peak win is preserved.** | T0 | streamed target-device construction `vllm/model_executor/model_loader/base_loader.py:43-82`; in-place Marlin repack, no host mirror `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434`; residency capability `vllm/platforms/interface.py:134-229` | deferred field `include/vllm/model_executor/models/qwen3_5_weights.h:1163` (`Qwen3_5MoeWeights::load_layer_experts`); loader defer + closure `src/vllm/model_executor/models/qwen3_5_weights.cpp:331,399` (`LoadMoeExpertsInto`/`LoadQwen3_5Moe`); shared shards owner `include/vllm/model_executor/models/model_registry.h:60` + `src/vllm/model_executor/models/model_registry.cpp:219` (`ModelSource::FromSafetensorsOwned`) + `src/vllm/entrypoints/model_loader.cpp:2668` (`LoadedEngine::FromModelDir`); per-layer interleave + `MaterializeAllDeferredExperts` `src/vllm/model_executor/models/qwen3_5.cpp:4498,4508` (`PrepareMarlinResident`) | CPU coexistence-bound contract `tests/vllm/test_qwen36_weights.cpp:324` ("deferred routed-expert load: move-safe closure + bounded coexistence", peak==1 across the per-layer materialize→free loop, move-safe closure); clean `-Werror` CPU build 0 warn, full ctest (3 HTTP/engine-proc parallel-port flakes pass isolated), tools 164/164. **DGX PROVEN** (`~/work/vllm.cpp-mem35-loadstream` new vs `-parent` 7a1a6d6 eager, production flags CUTLASS sm120a+Marlin+FA2 sm_121a, one flock): 35B load-to-ready **peak RSS (VmHWM) 21.43 GiB → 4.19 GiB (−17.24 GiB / −80%, below vLLM 13.3 GiB)**; token BYTE-IDENTICAL both binaries — 35B `test_qwen36_paged_engine` 315/315 + 27B `test_qwen27_paged_engine` 235/235; **27B UNAFFECTED** (peak RSS 24.8 GiB, matches its baseline — dense loader, no deferral); `compute-sanitizer memcheck` on the deferred load path **0 errors / 315 assertions** (no use-after-free of the freed host bytes); weights unit 127 assertions (CPU coexistence peak==1 + DGX residency). `benchmark_binding=false` — the orchestrator re-grids the binding `peak_pss`/`peak_rss` axes to confirm the FAIL→PASS flip | [moe-expert-load-stream.md](specs/moe-expert-load-stream.md) | `ANCHOR-BACKFILL` | CLAIM-MEM35-LOADSTREAM | +| `ENG-MOE-HOSTFREE` | MoE Marlin resident host-weight release: after `BuildMoeMarlinResident` uploads+repacks the routed experts to the device Marlin resident, free the per-expert fp4 HOST mirror (`OwnedTensor` packed+scale bytes) and `madvise(MADV_DONTNEED)` the pages back to the OS — returns the ~16.9 GiB steady 35B host double-store (`LoadNvfp4Raw` `MakeOwned` copies kept resident forever). Guarded to the committed Marlin path (`MarlinMoeEnabled()`; retained for the `VT_NVFP4_MARLIN=0` wmma fallback that re-reads them); `VT_MOE_HOST_FREE=0` A/B rollback. Realizes `release_host_weights_after_upload` for the dominant host consumer. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the host-free decision is now CONSUMED from `GetPlatform(d.q.device.type).residency_policy()` via `vllm::platforms::ShouldReleaseHostWeights(policy, MarlinMoeEnabled()/*kernel-path*/, VT_MOE_HOST_FREE/*env*/)` — `CudaPlatform` flag flipped false→true (reproduces today EXACTLY); `MarlinMoeEnabled()` stays the orthogonal KERNEL-PATH safety gate.** | T0 | streamed target-device weight construction `vllm/model_executor/model_loader/base_loader.py:43-82`; residency capability `vllm/platforms/interface.py:134-229`; Marlin MoE in-place repack (no host mirror) `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434` | free region `src/vllm/model_executor/models/qwen3_5.cpp:3743-3781`; `OwnedTensor::ReleaseHost` decl `include/vllm/model_executor/models/qwen3_5_weights.h:65` + impl (madvise+swap) `src/vllm/model_executor/models/qwen3_5_weights.cpp:24`; public hook `Qwen3_5Model::PrepareMarlinResident` `src/vllm/model_executor/models/qwen3_5.cpp:9140` | `tests/vllm/test_qwen36_weights.cpp:283` (`ReleaseHost` frees buffer+capacity) + `:314` (`PrepareMarlinResident` release under Marlin / retention under `VT_NVFP4_MARLIN=0`, DGX release 27/27 + retention 15/15); DGX A/B (`VT_MOE_HOST_FREE`) 35B STEADY serving PSS **20.17→3.53 GiB** (root `dgx:~/work/mem35-hostfree`); token-neutral 315/315 + 235/235; c2 smoke clean; memcheck clean. Whole-window load-phase PEAK bounded by the `ENG-MOE-LOADSTREAM` follow-up. Ledger [parity-ledger.md#L521](parity-ledger.md#L521) | [moe-marlin-host-free.md](specs/moe-marlin-host-free.md) | `DONE` | `ac77bec` | +| `ENG-MOE-LOADSTREAM` | 35B load-phase PEAK-PSS interleave (follow-up to `ENG-MOE-HOSTFREE`): the steady free returns the routed-expert host mirror only AFTER the whole model loads, so whole-window `peak_pss`/`peak_rss` (~19.8 GiB) is still set by all N layers' ~256 experts host-coexisting at load. DEFER the routed-expert host copies (`LoadQwen3_5Moe` loads each layer WITHOUT experts + installs a per-layer `load_layer_experts` streaming closure that owns the mmap'd shards) and materialize ONE layer's experts inside `PrepareMarlinResident` immediately before that layer's device Marlin build + host free — so at most one layer's experts coexist on the host (peak ~ one layer, not all N). Device residents byte-identical (same source bytes, same per-layer build order). Non-CUDA/`VT_NVFP4_MARLIN=0`/no-Marlin build falls back to bulk host materialization (their forward reads the host bytes). 27B is a different loader (`LoadQwen3_5Dense`, true-W4A4) → unaffected; GGUF/synthetic/borrowed pass no shards owner → eager. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the per-layer interleave gate is now CONSUMED from `GetPlatform(queue.device.type).residency_policy()` via `vllm::platforms::ShouldInterleaveLoadStream(policy, MarlinMoeEnabled())` — reproduces the old `queue.device.type != kCUDA` OR `!MarlinMoeEnabled()` gate EXACTLY (unified/CPU retain-host ⇒ policy false ⇒ materialize-all fallback); the ~4 GiB load-peak win is preserved.** | T0 | streamed target-device construction `vllm/model_executor/model_loader/base_loader.py:43-82`; in-place Marlin repack, no host mirror `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434`; residency capability `vllm/platforms/interface.py:134-229` | deferred field `include/vllm/model_executor/models/qwen3_5_weights.h:1163` (`Qwen3_5MoeWeights::load_layer_experts`); loader defer + closure `src/vllm/model_executor/models/qwen3_5_weights.cpp:331,399` (`LoadMoeExpertsInto`/`LoadQwen3_5Moe`); shared shards owner `include/vllm/model_executor/models/model_registry.h:60` + `src/vllm/model_executor/models/model_registry.cpp:219` (`ModelSource::FromSafetensorsOwned`) + `src/vllm/entrypoints/model_loader.cpp:2580` (`LoadedEngine::FromModelDir`); per-layer interleave + `MaterializeAllDeferredExperts` `src/vllm/model_executor/models/qwen3_5.cpp:4498,4508` (`PrepareMarlinResident`) | CPU coexistence-bound contract `tests/vllm/test_qwen36_weights.cpp:324` ("deferred routed-expert load: move-safe closure + bounded coexistence", peak==1 across the per-layer materialize→free loop, move-safe closure); clean `-Werror` CPU build 0 warn, full ctest (3 HTTP/engine-proc parallel-port flakes pass isolated), tools 164/164. **DGX PROVEN** (`~/work/vllm.cpp-mem35-loadstream` new vs `-parent` 7a1a6d6 eager, production flags CUTLASS sm120a+Marlin+FA2 sm_121a, one flock): 35B load-to-ready **peak RSS (VmHWM) 21.43 GiB → 4.19 GiB (−17.24 GiB / −80%, below vLLM 13.3 GiB)**; token BYTE-IDENTICAL both binaries — 35B `test_qwen36_paged_engine` 315/315 + 27B `test_qwen27_paged_engine` 235/235; **27B UNAFFECTED** (peak RSS 24.8 GiB, matches its baseline — dense loader, no deferral); `compute-sanitizer memcheck` on the deferred load path **0 errors / 315 assertions** (no use-after-free of the freed host bytes); weights unit 127 assertions (CPU coexistence peak==1 + DGX residency). `benchmark_binding=false` — the orchestrator re-grids the binding `peak_pss`/`peak_rss` axes to confirm the FAIL→PASS flip | [moe-expert-load-stream.md](specs/moe-expert-load-stream.md) | `ANCHOR-BACKFILL` | CLAIM-MEM35-LOADSTREAM | | `LOAD-GGUF` | GGUF reader, dequantization, Qwen name transforms, embedded vocabulary | T0 | Pinned vLLM has no GGUF loader: `vllm/model_executor/model_loader/__init__.py:31-65`; compatibility reference is llama.cpp | `src/vllm/model_executor/model_loader/gguf_reader.cpp:302`; `src/vllm/model_executor/model_loader/gguf_dequant.cpp:223`; `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:432`; `src/vllm/entrypoints/model_loader.cpp:240` | `tests/vllm/test_gguf.cpp:53`; `tests/vllm/test_gguf_dequant.cpp:25`; `tests/vllm/test_gguf_qwen36_loader.cpp:153`; real 35B `tests/parity/test_qwen36_gguf_engine.cpp:145` | `planned: specs/gguf-loader.md` | `PARTIAL` | - | | `LOAD-GGUF-MMPROJ` | A SECOND, `clip`-architecture GGUF projector file beside the language file, and the Qwen3-VL vision tower loaded out of it. **W1 LANDED (#821):** `EngineParams::mmproj_path` / `vllm_model_params.mmproj_path` (C ABI v22) / the server `--mmproj` flag name the file, `clip_mmproj_gguf.h` reads its `clip.*` metadata and `v.*` / `mm.*` tensors into the SHARED `multimodal::Qwen3VLVisionWeights`, and `LoadedEngine::vision_tower()` holds the result. The two-tensor temporal patch embedding (`v.patch_embd.weight` + `v.patch_embd.weight.1`) is INTERLEAVED per channel into the `[out, C*T*p*p]` conv3d operand the tower reads, and a file carrying only the first half is refused by name — the MuseGlimmer condition enforced rather than assumed. MuseGlimmer's own `MuseGlimmerRefuseMmproj` now has a PRODUCTION caller (routed on `clip.projector_type == "muse-glimmer"`), which is a change to MuseGlimmer's behaviour and is stated as one. **NOT supported:** no forward consumes the loaded tower yet — there is no multimodal request path on the C ABI and no GGUF image/video driver — and the COMMITTED 334-name manifest with its CI accounting is owed by `QUANT-QWEN38-27B-GGUF-ARM`, because the live confirmation below is env-gated on a NAS file and CI reads only the synthetic fixture. Auto-discovery of a sibling `mmproj*.gguf` is deliberately out of scope: a directory holding two unrelated models must not silently fuse them. First consumer is `Qwen3.8-27B` ([#821](https://github.com/mudler/vllm.cpp/issues/821)), whose `mmproj-BF16.gguf` (334 tensors, `clip.projector_type = qwen3vl_merger`, header-verified 2026-08-18: data end == file size 931,146,432) ships BOTH halves; MuseGlimmer's lacks the second | T0 | Pinned vLLM has no GGUF loader at all (`555967922`, `model_loader/__init__.py:33-49`), so the compatibility reference is llama.cpp `b10451` = `10bf611e5` (`PROJECTOR_TYPE_QWEN3VL`; the previously recorded `tools/mtmd/clip-impl.h:330` was read at the SUPERSEDED local fork `237ad9b96` and is owed re-anchoring, [#1003](https://github.com/mudler/vllm.cpp/issues/1003)) | the flag `EngineParams::mmproj_path` ([model_loader.h:1](../include/vllm/entrypoints/model_loader.h#L1)), the reader [clip_mmproj_gguf.cpp:1](../src/vllm/model_executor/models/clip_mmproj_gguf.cpp#L1), the open + refuse + read site `src/vllm/entrypoints/model_loader.cpp::LoadedEngine::FromModelDir` (the `.gguf` branch, after the device-fit refusal and BEFORE the tokenizer), the reader `src/vllm/model_executor/models/clip_mmproj_gguf.cpp::LoadQwen3VLVisionFromClipMmproj` + `::ClipMmprojVisionConfig` + `::RefuseUnsupportedClipMmproj`, the holder `include/vllm/entrypoints/model_loader.h::vision_tower` on `LoadedEngine`, the C face `include/vllm.h` `vllm_model_params.mmproj_path` (ABI v22) wired in `src/capi/vllm_c.cpp`, the server flag `src/vllm/entrypoints/openai/server_main.cpp` `--mmproj`, and the now-reached refusal `src/vllm/model_executor/models/muse_glimmer_gguf_weights.cpp::MuseGlimmerRefuseMmproj` | [test_clip_mmproj_gguf.cpp:1](../tests/vllm/models/test_clip_mmproj_gguf.cpp#L1) (9 cases / 272 assertions hermetic: the `clip.*` config mapping, the DeepStack discovery, the per-position patch-embedding interleave, every block/merger slot, and four refusals; the ninth is the LIVE confirmation, which skips loudly unless `VLLM_CPP_QWEN38_27B_MMPROJ` names the real `mmproj-BF16.gguf` and adds 43 assertions when it does — 334 consumed names == 334 shipped with nothing unread, the `clip.*` geometry, and the join checked at all 1,769,472 positions against F32 bytes read straight from the mmap. Renaming a tensor in the reader AND the fixture together leaves the hermetic gate green at 9/9 and reds only the live case, which is what the live case buys) and [test_gguf_mmproj_reach.cpp:1](../tests/vllm/entrypoints/test_gguf_mmproj_reach.cpp#L1) (6 cases / 19 assertions hermetic, all through `LoadedEngine::FromModelDir`; the sixth is the LIVE confirmation that the ENGINE holds the tower, and it skips loudly unless BOTH `VLLM_CPP_QWEN38_27B_GGUF` and `VLLM_CPP_QWEN38_27B_MMPROJ` name the real files, so the 19 assertions belong to the five hermetic cases). The two are separate targets on purpose: deleting the `LoadQwen3VLVisionFromClipMmproj` call site in `model_loader.cpp` reds the SECOND and leaves the FIRST fully green, which is the measured difference between gating a class and gating a capability. The port target for the vision config mapping is `src/vllm/model_executor/models/minimax_h3_vision_gguf.cpp::MiniMaxH3EncoderVisionConfig`, which builds the same `Qwen3VLVisionConfig` from `visual.*` | [quantized arms of Qwen3.8-27B](specs/qwen38-27b-quant-arms.md) | `PARTIAL` | - | | `LOAD-HF-BPE` | HF tokenizer.json byte-level BPE and incremental detokenization | T0 | `vllm/tokenizers/registry.py:176`; `vllm/tokenizers/hf.py:163`; `tests/tokenizers_/test_hf.py:18`; `tests/tokenizers_/test_detokenize.py:148` | `src/vllm/tokenizer/tokenizer.cpp:250,494,529`; `src/vllm/v1/engine/detokenizer.cpp:409` | `tests/vllm/test_bpe.cpp:226`; `tests/vllm/test_tokenizer_parity.cpp:66,74,82,90`; `tests/vllm/test_pretokenizer.cpp:130` | `planned: specs/hf-tokenizer.md` | `ANCHOR-BACKFILL` | - | -| `LOAD-SENTENCEPIECE` | SentencePiece (Metaspace + byte-fallback) BPE tokenizer family — the gate to Mistral/Gemma/SentencePiece `tokenizer.json`. `Tokenizer::FromHfJson` now dispatches on the pre_tokenizer FAMILY: a bare `Metaspace` node selects the SP path (space→▁ U+2581; `prepend_scheme` first/always/never with the starts-with-▁ guard; `split=false`; out-of-vocab char → `<0xNN>` byte-fallback tokens; merge-ranked BPE over the raw-UTF-8 string), else the BYTE-IDENTICAL byte-level path (`DetectPattern` still fails loudly on Metaspace, so families never overlap). Decode + the incremental detokenizer mirror HF's Sequence decoder (Replace ▁→space, ByteFallback, Fuse, Strip 1 leading space). **UNBLOCKS the Mistral (`MODEL-TEXT-mistral-mistral-for-causal-lm`) paged-engine SACRED gate.** `split=true` fails loudly (no golden in scope). Mirrors HF `tokenizers` 0.22 | T1 | `vllm/tokenizers/hf.py:163`; `vllm/tokenizers/mistral.py:235,467`; HF `tokenizers` 0.22 `pre_tokenizers/metaspace.rs`, `models/bpe/model.rs::merge_word`, `decoders/{replace,byte_fallback,fuse,strip}.rs` | dispatch `src/vllm/tokenizer/tokenizer.cpp:340` (`DetectMetaspace`), `src/vllm/tokenizer/tokenizer.cpp:1223` (`EncodePlainSp`), `src/vllm/tokenizer/tokenizer.cpp:1541` (`SpDecodeTokens`), `src/vllm/tokenizer/tokenizer.cpp:1616` (`Decode` SP branch); merge-loop factor `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`); family/params/accessors `include/vllm/tokenizer/tokenizer.h:147` (`GetFamily`); incremental dispatch `src/vllm/v1/engine/detokenizer.cpp:359`; generator `tools/parity/dump_tokenizer_mistral.py` | `tests/vllm/test_tokenizer_parity_mistral.cpp:78` **6/6, 421 assertions byte-exact** vs HF `tokenizers` 0.22.2 (= vLLM 0.25.0 backend) over a 45-entry Metaspace/byte-fallback/special-token corpus (goldens `tests/parity/goldens/tokenizer_mistral/{tokenizer.json,encodings.json}`); SACRED cross-check vLLM `AutoTokenizer` (transformers 5.13.1) 0/45 mismatch (±BOS); byte-level suites byte-identical `tests/vllm/test_bpe.cpp` 852, `tests/vllm/test_detokenizer.cpp` 221, `tests/vllm/test_tokenizer_parity.cpp` 1175, `tests/vllm/test_tokenizer_parity_deepseek.cpp` 2461 | [specs/sentencepiece.md](specs/sentencepiece.md) | `ANCHOR-BACKFILL` | `CLAIM-LOAD-SENTENCEPIECE` | -| `SPEC-BPE-QUADRATIC-MERGE` | **The BPE merge loop is O(n^2) in pretoken length, on the request path, before the length check.** `src/vllm/tokenizer/bpe.cpp::BpeMerge` rescans every adjacent pair per merge and built one `std::string` key per probe through a `MergeKey` helper that this row deletes, on the premise its own comment states: "pretokens are tiny". FIVE of the seven pretokenizer rules return an unbounded run (`src/vllm/tokenizer/pretokenizer.cpp::MatchLetterRun` rule 2, `src/vllm/tokenizer/pretokenizer.cpp::MatchPunctRun` rule 4, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNewlines` rule 5, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNotBeforeNonSpace` rule 6, `src/vllm/tokenizer/pretokenizer.cpp::MatchWs` rule 7); only rule 3 `MatchNumbers` is capped and only rule 1 `MatchContraction` is bounded by its own alternation, and on the SentencePiece family `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp` merges the WHOLE prompt as one word because Mistral and Gemma declare `split: false`. MEASURED at `31f93787c`, min-of-k on a CONTENDED 20-core box, so these are contended minima and not idle-host constants, and EACH figure carries its own load: 65,535 bytes of one repeated character costs 24.4-45.8 s of one core at load average 25-90; 64 KB of ordinary English prose through the committed Mistral golden costs 25.3 s AT LOAD AVERAGE 4-12 against HF `tokenizers` 0.22.2's 10.1 ms on the same file for byte-identical identifiers, growing n^2.0. A confirmation run at load 23-57 read 37.6 s where the 65,535-byte figure reads 24.4 s, and a fourth reading through the committed harness `tools/bench/bpe_encode_cost.cpp` moved the 8 KB English figure about 1.7x at load 194, so the SHAPE is the result and the constants move with the box. `src/vllm/v1/engine/input_processor.cpp::ValidatePromptLen` runs FIVE LINES AFTER the encode, so `max_model_len` bounds none of it, and `/tokenize` reaches the same path with no engine. This is a remote denial of service, not a latency curiosity. Fix mirrors HF `tokenizers` 0.22.2 `Word::merge_all` (heap over candidate merges, identifier-keyed merge table); a prototype is bit-identical to today's identifiers on 20 comparisons across BOTH committed goldens, all 20 of which also match HF `tokenizers` 0.22.2 reading the same files, and 8,192 newlines fall from 580.44 ms to 2.60 ms. A pretoken cap is REFUSED: it changes the token identifiers. A GROWTH-RATIO gate is refused too, by operator ruling recorded in the spec's `## Tests to port` item 3: at load 176-268 the defective code's own 4x ratios spread 4.654 to 17.896 and OVERLAP the correct algorithm's, because the two halves of a ratio are independently preemptible. The absolute cost bound of item 2 carries the timing gate alone, on about three orders of magnitude of headroom. The string key is not a separable win either, on the DESIGN: upstream's staleness test compares `new_id` (`word.rs:197-205`) and its table is keyed on an identifier pair, so a step that rebuilds a `std::string` to name a pair cannot express the test; and removing a constant from a quadratic leaves a quadratic. How much the key alone is worth is NOT measured on an idle host and this row claims nothing about it | T0 | HF `tokenizers` 0.22.2 `tokenizers/src/models/bpe/word.rs:162-250` (`Word::merge_all`), `:28-35` (`Ord for Merge`), `tokenizers/src/models/bpe/mod.rs:9` + `model.rs:19,174-192` (identifier-keyed merge table and its load-time refusal) | `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`, the heap mirroring `Word::merge_all`), `src/vllm/tokenizer/bpe.cpp:113` (`MergeRanks::Insert`) and `include/vllm/tokenizer/bpe.h:66` (the identifier-keyed table mirroring `MergeMap`), `src/vllm/tokenizer/tokenizer.cpp:108` (`InsertMerge`, the load-time vocabulary refusal, reached from `src/vllm/tokenizer/tokenizer.cpp::FromHfJson` AND `src/vllm/tokenizer/tokenizer.cpp::FromGguf`), `src/vllm/tokenizer/tokenizer.cpp:654` (`FinalizeTables`, the reserved unk-sentinel identifier); callers unchanged, `src/vllm/tokenizer/tokenizer.cpp:1199` (`EncodePlain`) and `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp`; request path `src/vllm/v1/engine/input_processor.cpp:266` (`process_inputs`), whose encode at line 260 runs five lines before its own length check at line 265 | `tests/vllm/test_bpe_equivalence.cpp:129` (80 entries x 2 goldens x 2 special-token modes = **320 id vectors, all matching HF `tokenizers` 0.22.2**, longest entry 8,034 bytes in ONE pretoken), `tests/vllm/test_bpe_equivalence.cpp:166` (the ONLY timing assertion: two 65,536-byte one-word inputs under an absolute 2,000 ms bound, landed RED at 23,918.5 ms and 23,077.3 ms against the shipped code); `tests/vllm/test_bpe.cpp:228` (leftmost tie on a long list), `:249` (stale entry, `new_id` not the pair), `:287` (no right neighbour), `:317,351` (the table), `:685` (the load-time refusal on BOTH surfaces, plus every committed golden still loading); goldens `tests/parity/goldens/bpe_equivalence/encodings.json`, generator `tools/parity/dump_bpe_equivalence.py`; `test_bpe` 24/24 971, `test_bpe_equivalence` 2/2 334, `test_tokenizer_metaspace_split` 7/7 28, `test_detokenizer` 12/12 221, `test_tokenizer_parity` 4/4 1175, `test_tokenizer_parity_mistral` 6/6 421, `test_tokenizer_parity_deepseek` 6/6 2461, `test_tokenizer_parity_gpt4o` 5/5 1000, `test_input_processor` 17/17 79; closing gate rerun and promotion [parity-ledger.md#L945](parity-ledger.md#L945) | [specs/bpe-quadratic-merge.md](specs/bpe-quadratic-merge.md) | `DONE` | `67823aee2` | +| `LOAD-SENTENCEPIECE` | SentencePiece (Metaspace + byte-fallback) BPE tokenizer family — the gate to Mistral/Gemma/SentencePiece `tokenizer.json`. `Tokenizer::FromHfJson` now dispatches on the pre_tokenizer FAMILY: a bare `Metaspace` node selects the SP path (space→▁ U+2581; `prepend_scheme` first/always/never with the starts-with-▁ guard; `split=false`; out-of-vocab char → `<0xNN>` byte-fallback tokens; merge-ranked BPE over the raw-UTF-8 string), else the BYTE-IDENTICAL byte-level path (`DetectPattern` still fails loudly on Metaspace, so families never overlap). Decode + the incremental detokenizer mirror HF's Sequence decoder (Replace ▁→space, ByteFallback, Fuse, Strip 1 leading space). **UNBLOCKS the Mistral (`MODEL-TEXT-mistral-mistral-for-causal-lm`) paged-engine SACRED gate.** `split=true` fails loudly (no golden in scope). Mirrors HF `tokenizers` 0.22 | T1 | `vllm/tokenizers/hf.py:163`; `vllm/tokenizers/mistral.py:235,467`; HF `tokenizers` 0.22 `pre_tokenizers/metaspace.rs`, `models/bpe/model.rs::merge_word`, `decoders/{replace,byte_fallback,fuse,strip}.rs` | dispatch `src/vllm/tokenizer/tokenizer.cpp:340` (`DetectMetaspace`), `src/vllm/tokenizer/tokenizer.cpp:1199` (`EncodePlainSp`), `src/vllm/tokenizer/tokenizer.cpp:1517` (`SpDecodeTokens`), `src/vllm/tokenizer/tokenizer.cpp:1002` (`Decode` SP branch); merge-loop factor `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`); family/params/accessors `include/vllm/tokenizer/tokenizer.h:147` (`GetFamily`); incremental dispatch `src/vllm/v1/engine/detokenizer.cpp:359`; generator `tools/parity/dump_tokenizer_mistral.py` | `tests/vllm/test_tokenizer_parity_mistral.cpp:78` **6/6, 421 assertions byte-exact** vs HF `tokenizers` 0.22.2 (= vLLM 0.25.0 backend) over a 45-entry Metaspace/byte-fallback/special-token corpus (goldens `tests/parity/goldens/tokenizer_mistral/{tokenizer.json,encodings.json}`); SACRED cross-check vLLM `AutoTokenizer` (transformers 5.13.1) 0/45 mismatch (±BOS); byte-level suites byte-identical `tests/vllm/test_bpe.cpp` 852, `tests/vllm/test_detokenizer.cpp` 221, `tests/vllm/test_tokenizer_parity.cpp` 1175, `tests/vllm/test_tokenizer_parity_deepseek.cpp` 2461 | [specs/sentencepiece.md](specs/sentencepiece.md) | `ANCHOR-BACKFILL` | `CLAIM-LOAD-SENTENCEPIECE` | +| `SPEC-BPE-QUADRATIC-MERGE` | **The BPE merge loop is O(n^2) in pretoken length, on the request path, before the length check.** `src/vllm/tokenizer/bpe.cpp::BpeMerge` rescans every adjacent pair per merge and built one `std::string` key per probe through a `MergeKey` helper that this row deletes, on the premise its own comment states: "pretokens are tiny". FIVE of the seven pretokenizer rules return an unbounded run (`src/vllm/tokenizer/pretokenizer.cpp::MatchLetterRun` rule 2, `src/vllm/tokenizer/pretokenizer.cpp::MatchPunctRun` rule 4, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNewlines` rule 5, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNotBeforeNonSpace` rule 6, `src/vllm/tokenizer/pretokenizer.cpp::MatchWs` rule 7); only rule 3 `MatchNumbers` is capped and only rule 1 `MatchContraction` is bounded by its own alternation, and on the SentencePiece family `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp` merges the WHOLE prompt as one word because Mistral and Gemma declare `split: false`. MEASURED at `31f93787c`, min-of-k on a CONTENDED 20-core box, so these are contended minima and not idle-host constants, and EACH figure carries its own load: 65,535 bytes of one repeated character costs 24.4-45.8 s of one core at load average 25-90; 64 KB of ordinary English prose through the committed Mistral golden costs 25.3 s AT LOAD AVERAGE 4-12 against HF `tokenizers` 0.22.2's 10.1 ms on the same file for byte-identical identifiers, growing n^2.0. A confirmation run at load 23-57 read 37.6 s where the 65,535-byte figure reads 24.4 s, and a fourth reading through the committed harness `tools/bench/bpe_encode_cost.cpp` moved the 8 KB English figure about 1.7x at load 194, so the SHAPE is the result and the constants move with the box. `src/vllm/v1/engine/input_processor.cpp::ValidatePromptLen` runs FIVE LINES AFTER the encode, so `max_model_len` bounds none of it, and `/tokenize` reaches the same path with no engine. This is a remote denial of service, not a latency curiosity. Fix mirrors HF `tokenizers` 0.22.2 `Word::merge_all` (heap over candidate merges, identifier-keyed merge table); a prototype is bit-identical to today's identifiers on 20 comparisons across BOTH committed goldens, all 20 of which also match HF `tokenizers` 0.22.2 reading the same files, and 8,192 newlines fall from 580.44 ms to 2.60 ms. A pretoken cap is REFUSED: it changes the token identifiers. A GROWTH-RATIO gate is refused too, by operator ruling recorded in the spec's `## Tests to port` item 3: at load 176-268 the defective code's own 4x ratios spread 4.654 to 17.896 and OVERLAP the correct algorithm's, because the two halves of a ratio are independently preemptible. The absolute cost bound of item 2 carries the timing gate alone, on about three orders of magnitude of headroom. The string key is not a separable win either, on the DESIGN: upstream's staleness test compares `new_id` (`word.rs:197-205`) and its table is keyed on an identifier pair, so a step that rebuilds a `std::string` to name a pair cannot express the test; and removing a constant from a quadratic leaves a quadratic. How much the key alone is worth is NOT measured on an idle host and this row claims nothing about it | T0 | HF `tokenizers` 0.22.2 `tokenizers/src/models/bpe/word.rs:162-250` (`Word::merge_all`), `:28-35` (`Ord for Merge`), `tokenizers/src/models/bpe/mod.rs:9` + `model.rs:19,174-192` (identifier-keyed merge table and its load-time refusal) | `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`, the heap mirroring `Word::merge_all`), `src/vllm/tokenizer/bpe.cpp:113` (`MergeRanks::Insert`) and `include/vllm/tokenizer/bpe.h:66` (the identifier-keyed table mirroring `MergeMap`), `src/vllm/tokenizer/tokenizer.cpp:108` (`InsertMerge`, the load-time vocabulary refusal, reached from `src/vllm/tokenizer/tokenizer.cpp::FromHfJson` AND `src/vllm/tokenizer/tokenizer.cpp::FromGguf`), `src/vllm/tokenizer/tokenizer.cpp:654` (`FinalizeTables`, the reserved unk-sentinel identifier); callers unchanged, `src/vllm/tokenizer/tokenizer.cpp:1175` (`EncodePlain`) and `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp`; request path `src/vllm/v1/engine/input_processor.cpp:266` (`process_inputs`), whose encode at line 260 runs five lines before its own length check at line 265 | `tests/vllm/test_bpe_equivalence.cpp:129` (80 entries x 2 goldens x 2 special-token modes = **320 id vectors, all matching HF `tokenizers` 0.22.2**, longest entry 8,034 bytes in ONE pretoken), `tests/vllm/test_bpe_equivalence.cpp:166` (the ONLY timing assertion: two 65,536-byte one-word inputs under an absolute 2,000 ms bound, landed RED at 23,918.5 ms and 23,077.3 ms against the shipped code); `tests/vllm/test_bpe.cpp:228` (leftmost tie on a long list), `:249` (stale entry, `new_id` not the pair), `:287` (no right neighbour), `:317,351` (the table), `:685` (the load-time refusal on BOTH surfaces, plus every committed golden still loading); goldens `tests/parity/goldens/bpe_equivalence/encodings.json`, generator `tools/parity/dump_bpe_equivalence.py`; `test_bpe` 24/24 971, `test_bpe_equivalence` 2/2 334, `test_tokenizer_metaspace_split` 7/7 28, `test_detokenizer` 12/12 221, `test_tokenizer_parity` 4/4 1175, `test_tokenizer_parity_mistral` 6/6 421, `test_tokenizer_parity_deepseek` 6/6 2461, `test_tokenizer_parity_gpt4o` 5/5 1000, `test_input_processor` 17/17 79; closing gate rerun and promotion [parity-ledger.md#L945](parity-ledger.md#L945) | [specs/bpe-quadratic-merge.md](specs/bpe-quadratic-merge.md) | `DONE` | `67823aee2` | | `LOAD-CONFIG-SURFACE` | Dataclass-for-dataclass config and serve-compatible flags. **Internal scheduler config versus serve surface:** local `SchedulerConfig` implements `max_num_batched_tokens`, `max_num_scheduled_tokens`, `max_num_seqs`, `long_prefill_token_threshold`, `enable_chunked_prefill`, `policy`, `scheduler_reserve_full_isl`, `watermark`, and `async_scheduling`; only upstream-named `--max-num-batched-tokens`, `--max-num-seqs`, and `--scheduling-policy` are public. The current upstream scheduler flag set also has `--max-num-scheduled-tokens`, `--long-prefill-token-threshold`, `--enable-chunked-prefill`, `--disable-chunked-mm-input`, `--scheduler-cls`, `--scheduler-reserve-full-isl`, `--watermark`, `--prefill-schedule-interval`, `--disable-hybrid-kv-cache-manager`, `--async-scheduling`, and `--stream-interval`; none has that public local spelling. Local config has no fields for upstream `runner_type`, `is_multimodal_model`, `disable_chunked_mm_input`, custom `scheduler_cls`, `disable_hybrid_kv_cache_manager`, `prefill_schedule_interval`, or engine-level `stream_interval`. **Cache config versus serve surface:** exact public spellings exist for `--block-size`, `--gpu-memory-utilization`, `--kv-cache-dtype`, and `--enable-prefix-caching`; equivalent behavior uses local `--kv-cache-memory` instead of upstream `--kv-cache-memory-bytes`, and local `--num-blocks` instead of upstream `--num-gpu-blocks-override`. Local block size defaults to 32 and refuses values that are not positive multiples of 16; upstream `CacheConfig` defaults to 16 and accepts any positive value at that layer. `--gpu-memory-utilization` is accepted but inert: it warns and falls back to 256 blocks because no profile run converts the fraction into capacity. Supported KV dtype values are `auto`, `bfloat16`, `fp8`, and `fp8_e4m3`; `float16` and `fp8_e5m2` parse but are refused by the store/read path, and `fp8_inc`, `fp8_ds_mla`, `turboquant_k8v4`, `turboquant_4bit_nc`, `turboquant_k3v4_nc`, `turboquant_3bit_nc`, `int4_per_token_head`, `int8_per_token_head`, `fp8_per_token_head`, and `nvfp4` are refused by name. The remaining upstream CacheConfig serve flags are absent: `--prefix-caching-hash-algo`, `--calculate-kv-scales`, `--kv-cache-dtype-skip-layers`, `--kv-sharing-fast-prefill`, `--mamba-cache-dtype`, `--mamba-ssm-cache-dtype`, `--mamba-block-size`, `--prefix-match-unit`, `--mamba-cache-mode`, `--replayssm-buffer-len`, `--use-replayssm`, `--kv-offloading-size`, and `--kv-offloading-backend`. Corresponding CacheConfig-only fields, plus derived `mamba_page_size_padded` and `skip_page_size_padded`, have no local public dataclass surface. No `CompilationConfig` dataclass or serve flags expose its modes, backends, custom ops, passes, Inductor settings, or CUDA-graph settings; internal CUDA-graph controls are separate behavior, not that upstream config surface | T0/T1 | `vllm/config/scheduler.py:26`; `vllm/config/cache.py:25`; `vllm/config/compilation.py:378` | `include/vllm/config/scheduler.h:67`; `src/vllm/config/scheduler.cpp:11`; `src/vllm/transformers_utils/hf_config.cpp:83`; limited flags incl. `max_num_seqs`/`max_num_batched_tokens` `examples/server/main.cpp:63,116,170` | `tests/vllm/test_scheduler_config.cpp:10`; `tests/vllm/test_hf_config.cpp:131,224,265`; `examples/CMakeLists.txt:34` | `planned: specs/config-surface.md` | `PARTIAL` | - | | `ENG-HF-MODEL-DOWNLOAD` | Fetch a checkpoint from HuggingFace so `--model` accepts a repository identifier and not a local path only. Two forms behind one flag, with the local path probed first: `org/repo` mirrors vLLM's full-snapshot download, and `org/repo:Q4_K_M` fetches one GGUF file, a form vLLM does not implement and which llama.cpp supplies as the secondary oracle. Mirrors vLLM's two-phase fetch (config JSON first, so a bad repository fails after 200 KB and not 60 GB) and its index-driven file selection, which reads `model.safetensors.index.json` and fetches the exact names in `weight_map` instead of every match for `*.safetensors`. Reference is resolved to a commit before any byte is fetched, so a moving `main` cannot change what a second run loads. Cache layout is HuggingFace's documented local cache, so a host holding a Python `huggingface_hub` cache gets a hit and `model_loader.cpp:279-303` reads it unchanged. Transport is the already-vendored cpp-httplib with OpenSSL, matching llama.cpp, which retired libcurl at `CMakeLists.txt:195` at stock tag `b10451`. NOT a verbatim port on one point: llama.cpp's `is_valid_oid` accepts any 40- or 64-character hexadecimal string, and on 17 August 2026 this project measured the tree API answering an unauthenticated caller on gated `Lightricks/LTX-2.5` with an `lfs.oid` of one character repeated 64 times, identical for all 14 large-file-storage files, so this row treats an untokenized `lfs.oid` as absent and proves completeness structurally instead | T1 | `vllm/model_executor/model_loader/weight_utils.py:345,349-357,459,472-490,493-496,506`; `vllm/model_executor/model_loader/default_loader.py:167-184`; `vllm/engine/arg_utils.py:839`; `vllm/config/model.py:183` at pin `5559679229`. Secondary oracle llama.cpp for the `:QUANT` form only, stock tag `b10451`, anchors re-verified by W1 at commit `10bf611e533d81f739128304991c5e133c6aebd8` | W1 and W2 only: `src/vllm/transformers_utils/hf_hub.cpp:1`, `src/vllm/transformers_utils/hf_cache.cpp:1`, reached from `src/vllm/entrypoints/model_loader.cpp:280`. No downloader, no `--model` grammar, no TLS option | `tests/vllm/transformers_utils/test_hf_cache.cpp:1`, `tests/vllm/transformers_utils/test_hf_hub.cpp:1` (in-process fake hub), `tests/vllm/entrypoints/test_dflash_draft_hf_cache.cpp:1` (the loader reach, red when the call site is deleted) | [hf-model-download.md](specs/hf-model-download.md) | `READY` | - | | `LOAD-LONGTAIL` | Sharded-state, tensorizer, RunAI, BitsAndBytes loaders | T3 | `vllm/model_executor/model_loader/__init__.py:33-65` | - | - | `planned: specs/loader-longtail.md` | `INVENTORIED` | - | diff --git a/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md b/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md new file mode 100644 index 000000000..1004b34a9 --- /dev/null +++ b/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md @@ -0,0 +1,186 @@ +# ENG-CHUNKED-PREFILL process record + +Status: BLOCKED — NEEDS_DECISION (reconciliation gate, spec §R1 / stop conditions) + +## 2026-11-29T05:02:07Z — reconciliation gate: source rule does not reproduce 1,2,6,4 + +- Verified llama.cpp pin: `abca6920035ed77c1d80eaf23d066e9d3a7c5b23` (matches + `oracle-revision.txt`). Upstream master of /home/lu_zero/Sources/llama.cpp is + `e300919cc`, so the rule was read from `git show abca69200:src/llama-batch.cpp` + (1629 lines extracted). +- Pinned rule, single-request prefill for a hybrid/recurrent model: + - `src/llama-context.cpp:351` — `cparams.n_ubatch = min(n_batch, n_ubatch or n_batch)` + → 16 with `-b 16 -ub 16`. + - `src/llama-memory-hybrid.cpp:70-100` (and recurrent twin + `src/llama-memory-recurrent.cpp:480-505`) — `init_batch` chooses + `split_seq(n_ubatch)` when all tokens are outputs, else + `split_equal(n_ubatch, sequential, n_keep_tail = n_rs_seq + 1)` + (`llama-memory-hybrid.cpp:81-92`). + - `src/llama-batch.cpp:665-834` (`split_equal`), `:836-876` (`split_seq`), + `:631-663` (`split_simple`), `:913` (`ubatch_add`). All three fill each + ubatch greedily up to `n_ubatch`; for one sequence and n_tokens(10) < + n_ubatch(16), every one of them yields exactly ONE ubatch of 10 tokens. + - Tap-build working tree diff (`/tmp/llamacpp-inkling-tap`, HEAD = abca69200) + touches only tap capture (`ggml-cpu`, `llama-graph.cpp` taps, + `llama-context.cpp:3131` post-compute dump). No split-path change. +- Both readings: + 1. Source rule: a 10-token prompt at `-b 16 -ub 16` forms ONE prefill + ubatch/graph of 10 tokens. No function in `llama-batch.cpp` at abca69200 + can emit the non-greedy sequence 1,2,6,4. + 2. Observed record (`focused.log` 2026-11-26): graphs of 1,2,6,4 tokens. + Note the sum is 13, not 10, and the record itself is internally tense + ("last graph holds positions 6..9" = 4 tokens, "6-token graph for 2..5" = + 4 positions), so the raw evidence for the sequence is a prose note, not + captured server output; no raw server log in the evidence directory shows + per-ubatch sizes. +- The live oracle (tap build, port 8100) was held by another agent's capture + (`/tmp/opencode/kdump2` flow) during this window, so it was not disturbed and + not probed. A decisive reproduction would be: fresh `llama-server` from the + tap build, `-b 16 -ub 16 --no-warmup`, the exact 10-token prompt, + `cache_prompt=false`, counting graph computes and their `n_tokens` with tap + logging of ubatch size. +- Per spec stop conditions ("The pinned llama.cpp split rule contradicts the + observed 1,2,6,4 sequence and no source-level explanation exists → stop, + report NEEDS_DECISION — never encode a fitted rule"), no split function was + implemented and no tests were written past the gate. T1–T4 remain RED-by- + absence; tree is unchanged from spec commit `462c25a16`. + +## 2026-11-29T09:40:00Z — decisive observation (coordinator-authorized experiment): multi-ubatch IS formed; mechanism is the SERVER checkpoint rule, not split_equal — returning NEEDS_DECISION + +Coordinator authorized one experiment on this host under `/tmp/bigmodel.lock` +(port 8177; the 8100 oracle of the other lane was untouched). One-line +`fprintf(stderr, "UBATCH_DBG n_tokens=...")` added at the ubatch consumption +point (`/tmp/llamacpp-inkling-tap/src/llama-context.cpp:2355`, `decode()` `do` +loop); later passes added capture-only fprintf in +`src/llama-memory-hybrid-iswa.cpp`, `src/llama-batch.cpp` (`split_equal`), and +`tools/server/server-context.cpp` (`FILL_DBG`/`DECODE_DBG`). Rebuilt +`/tmp/llamacpp-inkling-tap-build` CPU-only (`cmake --build -j16 --target +llama-server`). MemAvailable 190 GB before load. + +- Model: `/tmp/inkling-ref/Inkling-2-Mini-UD-Q4_K_M.mainline.gguf` (sha256 + matches the W1 golden record). Prompt: the EXACT raw golden + "Write a Python function that reverses a string." = the 10 prompt tokens + `[3711,149878,152743,150131,149890,156815,82,149878,150379,13]` from + `/tmp/inkling2-w1/tests/parity/goldens/inkling2_loop_gguf_q4km/llamacpp-abca69200.json`. +- Command (both passes identical): + `llama-server -m --host 127.0.0.1 --port 8177 --threads 1 --no-warmup + --ctx-size 256 --batch-size 16 --ubatch-size 16 --parallel 1 --no-webui` + then one POST `/completion` `{"prompt":..., "n_predict":1, + "temperature":0, "cache_prompt":false}`; server killed by PID after. +- **Observed ubatch sequence — IDENTICAL both passes: 2, 6, 4** + (`/tmp/ubatch-exp-pass1.log`, `/tmp/ubatch-exp-pass2.log`; passes 5-7 with + deeper instrumentation reproduce 6,4 for the request). `tokens_evaluated=10`; + server progress log: "prompt processing, n_tokens = 6, progress = 0.60". +- **Mechanism, pinned at abca69200 (NOT the batch splitter):** + 1. `tools/server/server-context.cpp` `pre_decode()` prompt-fill loop: with + checkpoints enabled (`do_checkpoint`; `n_ctx_checkpoints` default ON, + COMPLETION tasks) the loop breaks early via + `const int checkpoint_offsets[] = {4 + n_ubatch, 4};` when + `task->n_tokens() == prompt_n + min(n_batch, offset)` (ref upstream PR + #20288) — the server intentionally stops the batch 4 tokens before the + end so a checkpoint can be created. 10-token prompt at -b 16 -ub 16 → + first batch of 6 (10 = 6 + 4), second batch of 4. This is the 6,4. + 2. The 2-token graph happens BEFORE server init (log line 681 vs line 730 + "srv load_model: initializing"): a load-time probe compute in model load, + not a request graph. `--no-warmup` does not cover it. + 3. The old record's 1-token graph is the same class: a warmup/probe artifact + of the 2026-11-26 capture, not a prefill chunk. The "sums to 13, not 10" + tension is resolved — 1 and 2 were never prompt tokens. + 4. llama-side, `llama_memory_hybrid_iswa::init_batch` + (src/llama-memory-hybrid-iswa.cpp:92) selects + `split_equal(n_ubatch=16, !unified, n_keep_tail = n_rs_seq > 0 ? + n_rs_seq+1 : 0)` with **n_rs_seq = 0** for this model → n_keep_tail = 0 → + `split_equal` (src/llama-batch.cpp:665-833) fills greedily and NEVER splits + a 6- or 4-token batch: each server batch becomes exactly ONE ubatch + (instrumented: "SE_DBG break: exhausted"). +- **Why I stopped (dispatch branch rule):** reproducing the oracle's graph + boundaries requires encoding the SERVER checkpoint-offset rule + ({4+n_ubatch, 4}, gated on n_ctx_checkpoints and task type), while the + committed spec (`.agents/specs/chunked-prefill.md` Upstream anchors / + Design §3) pins the split rule to `llama-batch.cpp` and treats 1,2,6,4 as + prefill graph boundaries with warmup "excluded by --no-warmup" — which this + experiment falsifies (2 survives --no-warmup; 1 and 2 are probes). T1's + target sequence would encode probe artifacts + server segmentation policy, + semantics the spec does not authorize. Per the dispatch's contradiction + branch: STOP, NEEDS_DECISION. No T1-T4, no implementation, no commit. + Tree unchanged from spec commit 462c25a16 apart from this append. +- Tap tree state: capture-only fprintf at the sites named above; nothing + changed under the repo beyond this file. Experiment servers killed by PID; + bigmodel lock released. Logs: /tmp/ubatch-exp-pass1.log, pass2, pass5, + pass6, pass7. + +## 2026-11-29T07:20:00Z — implementation per the AMENDED spec (server checkpoint rule) + +Spec read WHOLE first (3a27457bf, the amended pin). The pinned rule is +UNAMBIGUOUS in source — no NEEDS_DECISION. Transcribed from +`git show abca69200:tools/server/server-context.cpp` `pre_decode()`: + +- **Design item 3 Outcome pin (file:line):** + `tools/server/server-context.cpp:4350-4360` — the `do_checkpoint` gate chain + (`n_ctx_checkpoints > 0` AND `task->type == SERVER_TASK_TYPE_COMPLETION` AND + the memory-shape condition `seq_rm_type FULL/RS || n_swa > 0`); + `tools/server/server-context.cpp:4479-4495` — the fill-loop early break: + `static const int checkpoint_offsets[] = {4 + n_ubatch, 4};` with + `const int n_last = std::min(n_batch, offset);` and the break when + `slot.task->n_tokens() == slot.prompt.n_tokens() + n_last` (upstream PR + #20288). `llama-batch.cpp` does NOT split here (n_rs_seq = 0 → greedy fill; + `src/llama-memory-hybrid-iswa.cpp:92`). +- **Mapping** (encoded in `include/vllm/v1/worker/gpu/prefill_chunks.h`): the + server batch (fill cap `n_batch`) is the scheduler step's scheduled range, so + `n_batch` maps to `max_num_batched_tokens` (the per-step budget); + `n_ubatch` maps to the new `EngineParams::prefill_ubatch` knob; the + `do_checkpoint` gate maps to `knob > 0` (0 = default = inert). +- T1 RED (verbatim, header absent): + `test_prefill_chunks.cpp:20:10: fatal error: vllm/v1/worker/gpu/prefill_chunks.h: + No such file or directory` — compilation terminated, ninja build stopped. +- T1–T4 GREEN: `test_prefill_chunks` 5 cases / 1274 assertions, 0 failed + (doctest Status: SUCCESS!), build Debug at /tmp/engcp-build. + - T1 table: (10,16,16)->{6,4}; (5,16,16)->{1,4}; (4)->{4}; (16,16,16)->{12,4}; + (20,16,16)->{4,12,4}; (40,16,16)->{16,8,12,4}; checkpoints off -> no split + (greedy n_batch caps only); 20x4x4 totals sweep summing exactly, no empty + chunk. One expected-vector slip ({12,12,6} for T=30) was corrected against + the RULE (break at 14 via offset 4+ub=20, then 12 via offset 4): {14,12,4}. + Never fitted to the observation; {6,4} falls out of the rule. + - T2: PlanPrefillChunks gates (knob/multi-req/decode/spec/mm/full-logits/ + live device ids) + SliceCommonAttentionMetadata row slices (query_start_loc, + num_computed = context before the chunk, seq_lens = context through it, + slot_mapping rows). + - T3: per-chunk GDN rebuild keeps the SAME compact state slot and flips + has_initial_state from context>0 — chunk k+1 addresses exactly the state + chunk k wrote (bit-exact by address identity; the GdnStateCache buffers are + persistent and written in place). + - T4: knob 0 -> empty plan -> exactly ONE forward per step. +- Production wiring (reachability): `EngineParams::prefill_ubatch` + (model_loader.h) -> `LoadedEngine` ctor body `runner_.set_prefill_ubatch` + (model_loader.cpp) -> `GPUModelRunner::prefill_ubatch_` (runner.h) -> + the forward site in `execute_model` (runner.cpp, the line that was + `ForwardLogits logits = ModelRegistry::Forward(*model_, forward_input);`): + plan computed BEFORE forward input; `chunk_plan.size() <= 1` takes the + existing single forward unchanged; otherwise one `ModelRegistry::Forward` + per chunk, in order, final chunk carrying the gathered last-prompt-token row. +- Focused gate: ctest + `^(test_prefill_chunks|test_runner|test_prepare_inputs|test_input_batch|test_engine_core|test_llm_engine|test_engine_types)$` + — 7/7 passed. +- Scope honesty (spec `## Owed`): the split is per the single-request prefill + population; multi-sequence mixed steps take the whole-step path (the range is + one stream to the rule — asserted in T1 so the boundary is pinned, not + accidental). Full-engine (synthetic-model) execution of T2/T3 was NOT run: + no synthetic-model engine fixture exists in-tree on CPU (the paged-engine + suites SKIP without real checkpoints), so T2/T3 are asserted at the + runner-slice/metadata level the production loop composes. Flagged for the + reviewer; the consuming model row's token gate remains the row's judge + (spec §Gates). +- Preflight `--staged` started in background after this entry. + +## 2026-11-29T07:55:00Z — preflight + commit + +- Preflight `--staged` run 1: FAIL check-agent-record — the 4-line loader + insertion shifted the ENG-MOE-LOADSTREAM record anchor + (`src/vllm/entrypoints/model_loader.cpp:2576` -> `:2580`, + `LoadedEngine::FromModelDir`). Repaired the anchor in + `.agents/engine-matrix.md` (record-staleness repair, checker untouched); + `check-agent-record --report` -> rot 0. +- Preflight `--staged` run 2: exit 0 ("ok 9 files changed, 680 insertions(+), + 3 deletions(-)"). +- Committed as `1f4069521` on `row/ENG-CHUNKED-PREFILL` (base spec commit + `3a27457bf`). No push. diff --git a/include/vllm/entrypoints/model_loader.h b/include/vllm/entrypoints/model_loader.h index 68a7945b3..ad1f3e034 100644 --- a/include/vllm/entrypoints/model_loader.h +++ b/include/vllm/entrypoints/model_loader.h @@ -189,6 +189,20 @@ struct EngineParams { // product let an 8x1024 (8192-token) prefill run in ONE step, blowing the GDN // prefill activation. int max_num_batched_tokens = 0; + // ENG-CHUNKED-PREFILL: the prefill ubatch (llama.cpp's `-ub` analog), the + // model-facing chunk size this row adds beside the scheduler token budget + // above. 0 = the DEFAULT and it is INERT: the whole scheduled range is one + // forward, byte-identical to before the field existed. >0 turns on the + // pinned llama.cpp server prompt-fill checkpoint split + // (`tools/server/server-context.cpp` `pre_decode()`, + // `checkpoint_offsets[] = {4 + n_ubatch, 4}` @ abca69200, upstream PR + // #20288): an eligible single-request prefill step runs one forward per + // checkpoint chunk, in order, so a gate pinning the oracle's serving batch + // shape (`-b budget -ub knob`) also matches its graph formation. See + // include/vllm/v1/worker/gpu/prefill_chunks.h for the transcribed rule and + // its gates. No CLI flag yet — the consuming model row sets it through the + // params struct. + int prefill_ubatch = 0; // Mirrors vLLM's tri-state --[no-]enable-prefix-caching resolution. Hybrid // and attention-free generation models default OFF at the parity pin; // decoder-only models default ON. An explicit value overrides the model diff --git a/include/vllm/v1/worker/gpu/prefill_chunks.h b/include/vllm/v1/worker/gpu/prefill_chunks.h new file mode 100644 index 000000000..631d6a205 --- /dev/null +++ b/include/vllm/v1/worker/gpu/prefill_chunks.h @@ -0,0 +1,148 @@ +// ENG-CHUNKED-PREFILL: the engine-level prefill chunking seam. +// +// Spec: `.agents/specs/chunked-prefill.md` (amended 2026-11-29). The pinned +// mechanism is llama.cpp `abca6920035ed77c1d80eaf23d066e9d3a7c5b23`'s SERVER +// prompt-fill checkpoint policy — `tools/server/server-context.cpp` +// `pre_decode()`, the `checkpoint_offsets[] = {4 + n_ubatch, 4}` early break +// of the fill loop (upstream PR #20288), NOT `llama-batch.cpp` splitting +// (with `n_rs_seq == 0` the fill is greedy; one ubatch per server batch). +// +// The rule, transcribed from the pinned source (server-context.cpp:4479-4495 +// @ abca69200): while filling a server batch up to `n_batch` tokens, AFTER +// each pushed token break early when +// +// task->n_tokens() == slot.prompt.n_tokens() + min(n_batch, offset) +// +// for any offset in `{4 + n_ubatch, 4}` — the server intentionally stops the +// batch 4 (or 4 + n_ubatch) tokens before the prompt end so a context +// checkpoint can be created. `do_checkpoint` gates the whole block: +// `n_ctx_checkpoints > 0` AND the task is a COMPLETION AND the memory shape +// admits checkpoints AND no mtmd chunk intervened. In this seam the knob is +// the gate: `prefill_ubatch == 0` (the default) leaves `do_checkpoint == false` +// and the whole scheduled range is ONE chunk — byte-identical to today. +// +// Mapping to our engine: the server batch (fill cap `n_batch`) is the +// SCHEDULER step's scheduled token range, so `n_batch` maps to the per-step +// token budget (`--max-num-batched-tokens`), which caps the range exactly as +// the server's fill cap does; `n_ubatch` maps to `EngineParams::prefill_ubatch` +// (the knob this row adds). A whole-prompt single-request prefill step with +// `T` scheduled tokens therefore splits exactly as a server task of `T` +// prompt tokens does at `-b budget -ub knob`. +#ifndef VLLM_V1_WORKER_GPU_PREFILL_CHUNKS_H_ +#define VLLM_V1_WORKER_GPU_PREFILL_CHUNKS_H_ + +#include +#include +#include + +#include "vllm/v1/attention/backend.h" // CommonAttentionMetadata + +namespace vllm::v1 { + +// THE SPLIT RULE, transcribed (see the file comment for the pinned source). +// Simulates the server's prompt-fill loop over one scheduled token range of +// `total_tokens` rows: fill greedily up to `n_batch`, break early at the +// checkpoint offsets when `checkpoints_enabled`. Each element is one chunk's +// token count; the chunks concatenate to `total_tokens` in order. Every chunk +// is >= 1 (the break is only evaluated after a token is pushed), so the +// simulation always terminates. +// +// With `checkpoints_enabled == false` the answer is exactly one chunk — the +// `n_ctx_checkpoints`-off gate of the pinned rule. +inline std::vector PrefillCheckpointChunks(int total_tokens, + int n_batch, int n_ubatch, + bool checkpoints_enabled) { + std::vector chunks; + int filled = 0; // slot.prompt.n_tokens() so far, range-local. + while (filled < total_tokens) { + const int cap = std::min(n_batch, total_tokens - filled); + int n = 0; // tokens pushed into THIS server batch. + while (n < cap) { + ++n; // the loop pushes a token, THEN evaluates the breaks. + if (!checkpoints_enabled) continue; + // server-context.cpp:4480 `static const int checkpoint_offsets[] = + // {4 + n_ubatch, 4};` — parameterized here because OUR n_ubatch is the + // knob, not a context constant. + const int checkpoint_offsets[2] = {4 + n_ubatch, 4}; + bool should_break = false; + for (const int offset : checkpoint_offsets) { + const int n_last = std::min(n_batch, offset); + if (total_tokens == filled + n + n_last) { + should_break = true; + break; + } + } + if (should_break) break; + } + chunks.push_back(n); + filled += n; + } + return chunks; +} + +// THE RUNNER'S PER-STEP DECISION (spec Design 2): whether this step's +// scheduled range splits into checkpoint chunks, and into which. Empty vector +// == no split == ONE forward over the whole range — the T4 inertness +// contract. The gate mirrors the pinned `do_checkpoint` chain plus this +// runner's OWN applicability limits (spec `## Owed` defers everything but the +// single-request prefill): +// - knob == 0 -> no split (default inert). +// - multi-request / pure-decode / speculative / multimodal steps -> no +// split (the split rule is pinned per server task = per request; mixed +// steps are owed). +// - gathered-logits steps only: the chunk loop hands the sampler the FINAL +// chunk's lm_head rows (the last prompt token's row). A step that owes +// prompt logits takes the full-logits route, whose [T, vocab] output the +// seam cannot concat per chunk — those steps do not split. +// - stale host ids (async combine) or a LIVE device-id buffer -> no split; +// the device-id channel is a whole-step invariant the chunk loop does not +// maintain. +inline std::vector PlanPrefillChunks( + int prefill_ubatch, int n_batch, int num_reqs, int num_actual_tokens, + bool spec, bool multimodal, bool gathered_logits, bool device_ids_live) { + if (prefill_ubatch <= 0) return {}; + if (num_reqs != 1) return {}; + if (num_actual_tokens <= num_reqs) return {}; // pure decode (or empty). + if (spec || multimodal || !gathered_logits || device_ids_live) return {}; + return PrefillCheckpointChunks(num_actual_tokens, n_batch, prefill_ubatch, + /*checkpoints_enabled=*/true); +} + +// ONE CHUNK'S CommonAttentionMetadata, sliced from the whole-step one. The +// chunk covers token rows [begin, end) of the single request's packed stream. +// Field semantics preserved (see the struct's comments): +// - seq_lens: context THROUGH the chunk's last token +// (num_computed + end), not the whole step's. +// - num_computed_tokens_cpu: context BEFORE the chunk's first token +// (num_computed + begin) — the continuation marker that makes chunk k+1 +// read the state chunk k wrote. +// - query_start_loc: rebuilt {0, end-begin}; num_actual_tokens/max_query_len +// the chunk's own width; slot_mapping sliced to the chunk's rows. +// - the block table is request-level and rides through unchanged. +inline CommonAttentionMetadata SliceCommonAttentionMetadata( + const CommonAttentionMetadata& cam, int begin, int end) { + CommonAttentionMetadata chunk; + chunk.query_start_loc = {0, end - begin}; + chunk.query_start_loc_cpu = chunk.query_start_loc; + const int computed0 = cam.num_computed_tokens_cpu.empty() + ? 0 + : cam.num_computed_tokens_cpu[0]; + chunk.seq_lens = {computed0 + end}; + chunk.seq_lens_cpu = chunk.seq_lens; + chunk.num_computed_tokens_cpu = {computed0 + begin}; + chunk.num_reqs = 1; + chunk.num_actual_tokens = end - begin; + chunk.max_query_len = end - begin; + chunk.max_seq_len = cam.max_seq_len; + chunk.block_table_tensor = cam.block_table_tensor; + chunk.block_table_num_cols = cam.block_table_num_cols; + chunk.slot_mapping.assign(cam.slot_mapping.begin() + begin, + cam.slot_mapping.begin() + end); + chunk.causal = cam.causal; + chunk.uniform_spec_query_len = 0; + return chunk; +} + +} // namespace vllm::v1 + +#endif // VLLM_V1_WORKER_GPU_PREFILL_CHUNKS_H_ diff --git a/include/vllm/v1/worker/gpu/runner.h b/include/vllm/v1/worker/gpu/runner.h index 4eb4182e4..98b85a90c 100644 --- a/include/vllm/v1/worker/gpu/runner.h +++ b/include/vllm/v1/worker/gpu/runner.h @@ -561,6 +561,12 @@ class GPUModelRunner final : public ModelRunnerBase { void set_kv_connector(kv_offload::KVConnector* connector) { kv_connector_ = connector; } + + // ENG-CHUNKED-PREFILL: wire the prefill-ubatch knob (the -ub analog). + // 0 (the default) leaves every step ONE forward — byte-identical. Called by + // the loader from EngineParams::prefill_ubatch. + void set_prefill_ubatch(int n_ubatch) { prefill_ubatch_ = n_ubatch; } + int prefill_ubatch() const { return prefill_ubatch_; } kv_offload::KVConnector* kv_connector() const { return kv_connector_; } // SPEC-DFLASH D5 (DF-ENGINE-INTEGRATION): wire the separately-loaded z-lab @@ -880,6 +886,11 @@ class GPUModelRunner final : public ModelRunnerBase { int max_num_reqs_ = 0; // Flattened-token bound for one step; sizes the W4 device input_ids mirror. int max_num_batched_tokens_ = 0; + // ENG-CHUNKED-PREFILL: the prefill-ubatch knob (EngineParams::prefill_ubatch, + // the -ub analog). 0 = default = no split: every step is ONE forward, + // byte-identical. >0 = the n_ubatch of the pinned llama.cpp server + // checkpoint rule (include/vllm/v1/worker/gpu/prefill_chunks.h). + int prefill_ubatch_ = 0; int64_t gdn_state_slots_ = 0; // Compact GDN state-slot allocator: request identity (req_id) -> slot in // [0, gdn_state_slots_); free list of unused slots. Keyed on the sequence, not diff --git a/src/vllm/entrypoints/model_loader.cpp b/src/vllm/entrypoints/model_loader.cpp index ae4f8476c..e73e34f61 100644 --- a/src/vllm/entrypoints/model_loader.cpp +++ b/src/vllm/entrypoints/model_loader.cpp @@ -2557,6 +2557,10 @@ LoadedEngine::LoadedEngine(HfConfig config, dflash_draft_->k); } } + // ENG-CHUNKED-PREFILL: wire the prefill-ubatch knob onto the runner. 0 (the + // default) leaves the runner untouched — every step is ONE forward, + // byte-identical. + runner_.set_prefill_ubatch(params.prefill_ubatch); // KV-EXTERNAL-CACHE (LMCache): build + wire the external KV connector when the // caller selected one via EngineParams::kv_transfer_config. Default (unset) // leaves kv_connector_ null and BOTH the scheduler and the runner unchanged — diff --git a/src/vllm/v1/worker/gpu/runner.cpp b/src/vllm/v1/worker/gpu/runner.cpp index cda9270e1..61f778f3c 100644 --- a/src/vllm/v1/worker/gpu/runner.cpp +++ b/src/vllm/v1/worker/gpu/runner.cpp @@ -36,7 +36,8 @@ #include "vllm/v1/kv_cache_dtype.h" // ResolveKvCacheDType (VT_KV_CACHE_F32 A/B) #include "vllm/v1/kv_offload/lmcache/lmcache_connector.h" // KV-EXTERNAL-CACHE worker store/load #include "vllm/v1/sample/ops/bad_words.h" // apply_allowed_token_ids (-inf mask) -#include "vllm/v1/worker/gpu/async_runner_flag.h" // VT_ASYNC_RUNNER predicate +#include "vllm/v1/worker/gpu/async_runner_flag.h" +#include "vllm/v1/worker/gpu/prefill_chunks.h" // ENG-CHUNKED-PREFILL the split rule // VT_ASYNC_RUNNER predicate #include "vllm/v1/worker/gpu/cudagraph_dispatch.h" // W6 (#1374) the graph-eligibility predicate #include "vllm/v1/spec_decode/rejection_sampler.h" // SPEC-REJECTION I3 verify half #include "vllm/v1/worker/gpu/spec_decode/mtp/speculator.h" // SPEC-MTP I5d MtpProposePrefill @@ -2949,6 +2950,12 @@ std::optional GPUModelRunner::execute_model( // group (gdn_group_id_ >= 0), so this block runs exactly as before — // behavior-preserving / byte-identical for the hybrid path. GDNAttentionMetadata gdn_meta; + // ENG-CHUNKED-PREFILL: the base the chunk loop rebuilds per-chunk GDN + // metadata from (the same remapped state-slot table). Set only on the + // non-spec hybrid path, which is exactly the population the chunk gate + // admits (PlanPrefillChunks refuses spec steps). + CommonAttentionMetadata gdn_chunk_cam; + bool gdn_chunkable = false; if (gdn_group_id_ >= 0) { int gdn_cols = 0; std::vector gdn_bt = @@ -3008,6 +3015,8 @@ std::optional GPUModelRunner::execute_model( } else { GDNAttentionMetadataBuilder gdn_builder; gdn_meta = gdn_builder.build(/*common_prefix_len=*/0, gdn_cam); + gdn_chunk_cam = gdn_cam; + gdn_chunkable = true; } } @@ -3324,9 +3333,6 @@ std::optional GPUModelRunner::execute_model( ConnectorLoadExternalKv(); } - // TT-NONROUTED-ATTRIBUTION (VT_FLINT_PHASE_TIMING): bracket the forward and - // measure the inter-step wall from the previous execute_model entry - the - // gap is engine orchestration the forward's own phase line cannot cover. const auto step_entry = std::chrono::steady_clock::now(); double step_wall_ms = 0.0; if (step_phase_on) { @@ -3336,7 +3342,78 @@ std::optional GPUModelRunner::execute_model( have_prev_step_entry = true; } const auto fwd_t0 = std::chrono::steady_clock::now(); - ForwardLogits logits = ModelRegistry::Forward(*model_, forward_input); + // THE FORWARD. DEFAULT (gather ON): the *Device entry points keep the + // [num_reqs,vocab] logits ON DEVICE and hand them to the sampler with no + // full-logits D2H. VT_LOGITS_GATHER=0: the host Forward returns full + // [T,vocab] logits and sample_tokens re-gathers on host (unchanged path). + // ENG-CHUNKED-PREFILL: when the prefill-ubatch knob is set and the step is + // an eligible single-request prefill, PlanPrefillChunks applies the pinned + // llama.cpp server checkpoint rule (tools/server/server-context.cpp + // pre_decode(), checkpoint_offsets {4 + n_ubatch, 4} @ abca69200 — see + // include/vllm/v1/worker/gpu/prefill_chunks.h) BEFORE forward input is + // built, and the range runs as one ModelRegistry::Forward PER CHUNK, in + // order. Chunk k+1's recurrent state input is the state chunk k wrote: the + // GdnStateCache buffers are persistent and written in place, and each + // chunk's rebuilt GDN metadata addresses the SAME state slot with + // has_initial_state set from the chunk's own context, so the hand-off is + // bit-exact by address identity. Full attention is paged per token row + // (slot_mapping sliced per chunk), so the KV chain continues across the + // boundary the same way. The sampler sees the FINAL chunk's gathered rows + // (the last prompt token's row), which is the only row the whole-step path + // produced too. Default (knob 0): plan empty -> exactly ONE forward, + // byte-identical. + const std::vector chunk_plan = + v1::PlanPrefillChunks(prefill_ubatch_, max_num_batched_tokens_, num_reqs, + attn_meta.num_actual_tokens, spec_on(), + mm_buffers.has_value(), gather, + device_input_ids != nullptr); + ForwardLogits logits; + if (chunk_plan.size() <= 1) { + logits = ModelRegistry::Forward(*model_, forward_input); + } else { + const int total = static_cast(token_ids.size()); + GDNAttentionMetadataBuilder chunk_gdn_builder; + int begin = 0; + for (const int len : chunk_plan) { + const int end = begin + len; + const std::vector chunk_tokens(token_ids.begin() + begin, + token_ids.begin() + end); + const std::vector chunk_positions(positions.begin() + begin, + positions.begin() + end); + const CommonAttentionMetadata chunk_cam = + v1::SliceCommonAttentionMetadata(attn_meta, begin, end); + // Only the FINAL chunk owes an lm_head row (the last prompt token), at + // its own local index. + const std::vector chunk_logits_indices = + (gather && end == total) ? std::vector{len - 1} + : std::vector{}; + const GDNAttentionMetadata chunk_gdn = + gdn_chunkable ? chunk_gdn_builder.build( + /*common_prefix_len=*/0, + v1::SliceCommonAttentionMetadata(gdn_chunk_cam, + begin, end)) + : gdn_meta; + ModelForwardInput chunk_input{ + .token_ids = chunk_tokens, + .positions = chunk_positions, + .attn_meta = chunk_cam, + .gdn_meta = chunk_gdn, + .attn_kv = attn_kv_, + .gdn_state = gdn_state_, + .config = config_, + .queue = queue_, + .logits_indices = chunk_logits_indices, + .num_reqs = 1, + .gdn_state_slots = gdn_state_slots_, + .gather_logits = gather, + }; + if (multi_cache_topology_) chunk_input.multi_kv = &multi_kv_index_; + // The seam runs one forward per chunk, in order; the sampler consumes + // the FINAL chunk's logits (the only row the whole-step path owed). + logits = ModelRegistry::Forward(*model_, chunk_input); + begin = end; + } + } if (step_phase_on) std::fprintf(stderr, "[FLINT-STEP] batch=%lld fwd_ms=%.3f step_wall_ms=%.3f\n", diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 25d401d78..461e812e5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2528,6 +2528,9 @@ vllm_cpp_add_test(test_host_buffer_staging vllm/v1/sample/test_host_buffer_stagi vllm_cpp_add_test(test_logits_processor_host_addressable vllm/v1/sample/test_logits_processor_host_addressable.cpp) vllm_cpp_add_test(test_prepare_inputs vllm/v1/worker/test_prepare_inputs.cpp) +# ENG-CHUNKED-PREFILL: the server-checkpoint split rule (T1) and the chunk +# slicing / planning / state-hand-off gates (T2-T4). +vllm_cpp_add_test(test_prefill_chunks vllm/v1/worker/test_prefill_chunks.cpp) vllm_cpp_add_test(test_combine_tokens vllm/v1/worker/test_combine_tokens.cpp) vllm_cpp_add_test(test_combine_row_predicate vllm/v1/worker/test_combine_row_predicate.cpp) # SPEC-DFLASH2 A2-2 (#2802): the spec-decode VERIFY route predicate, and the diff --git a/tests/vllm/v1/worker/test_prefill_chunks.cpp b/tests/vllm/v1/worker/test_prefill_chunks.cpp new file mode 100644 index 000000000..68801f9d7 --- /dev/null +++ b/tests/vllm/v1/worker/test_prefill_chunks.cpp @@ -0,0 +1,244 @@ +// ENG-CHUNKED-PREFILL: the split-rule and chunk-seam tests (spec §Tests T1–T4). +// +// ORACLE. llama.cpp `abca6920035ed77c1d80eaf23d066e9d3a7c5b23`, +// `tools/server/server-context.cpp` `pre_decode()` prompt-fill checkpoint +// policy (upstream PR #20288): the fill loop breaks early at +// `checkpoint_offsets[] = {4 + n_ubatch, 4}` when +// `task->n_tokens() == slot.prompt.n_tokens() + min(n_batch, offset)`, +// gated on `do_checkpoint` (n_ctx_checkpoints ON for COMPLETION tasks). The +// decisive instrumented experiment (2026-11-29, two clean passes) measured a +// 10-token prompt at `-b 16 -ub 16` splitting into server batches of 6 then 4 +// — this suite pins that rule, not a fitted {6, 4}. +// +// CPU-only, no model: every case is a pure function of the rule. +#include + +#include +#include + +#include "vllm/v1/attention/backends/gdn_attn.h" +#include "vllm/v1/worker/gpu/prefill_chunks.h" + +namespace { + +using vllm::v1::CommonAttentionMetadata; +using vllm::v1::GDNAttentionMetadata; +using vllm::v1::GDNAttentionMetadataBuilder; +using vllm::v1::PlanPrefillChunks; +using vllm::v1::PrefillCheckpointChunks; + +int Total(const std::vector& chunks) { + int t = 0; + for (const int c : chunks) t += c; + return t; +} + +// ONE whole-step CommonAttentionMetadata for a single request whose prefill +// runs positions [computed0, computed0 + T), mirroring what +// MakeCommonAttentionMetadata builds for a prefill-only step. +CommonAttentionMetadata OneReqCam(int computed0, int t, int block_table_cols) { + CommonAttentionMetadata cam; + cam.query_start_loc = {0, t}; + cam.query_start_loc_cpu = cam.query_start_loc; + cam.seq_lens = {computed0 + t}; + cam.seq_lens_cpu = cam.seq_lens; + cam.num_computed_tokens_cpu = {computed0}; + cam.num_reqs = 1; + cam.num_actual_tokens = t; + cam.max_query_len = t; + cam.max_seq_len = computed0 + t; + cam.block_table_tensor.assign(static_cast(block_table_cols), 7); + cam.block_table_num_cols = block_table_cols; + for (int i = 0; i < t; ++i) cam.slot_mapping.push_back(computed0 + i); + cam.causal = true; + return cam; +} + +} // namespace + +// ── T1: the split rule, table-driven ───────────────────────────────────────── +TEST_CASE("T1: PrefillCheckpointChunks transcribes the pinned server rule") { + SUBCASE("the concrete oracle case: 10 tokens, -b 16 -ub 16 -> (6, 4)") { + // The observed prefill sequence (2026-11-29 experiment, two passes): + // first batch stops at 6 because 10 == 6 + min(16, 4), i.e. 4 before the + // prompt end, so the checkpoint can be created; the second batch fills + // the remaining 4. + CHECK(PrefillCheckpointChunks(10, 16, 16, true) == + std::vector{6, 4}); + } + + SUBCASE("prompt shorter than ub still splits 4-before-the-end") { + // offset 4 fires at prompt_n == 1: 5 == 1 + min(16, 4). + CHECK(PrefillCheckpointChunks(5, 16, 16, true) == + std::vector{1, 4}); + // Prompts at or under 4 tokens never reach an offset boundary. + CHECK(PrefillCheckpointChunks(4, 16, 16, true) == std::vector{4}); + CHECK(PrefillCheckpointChunks(1, 16, 16, true) == std::vector{1}); + } + + SUBCASE("prompt == ub (16 at -b 16 -ub 16)") { + // The greedy cap never binds; the offset-4 break fires at 12. + CHECK(PrefillCheckpointChunks(16, 16, 16, true) == + std::vector{12, 4}); + } + + SUBCASE("prompt > ub with remainder: cap + offsets interleave") { + // T=20, B=16, ub=16: offset 4+ub=20 fires (min(16,20)=16) at n=4 -> (4); + // then offset 4 fires at 16 -> (12); remainder 4. 4 + 12 + 4 = 20. + CHECK(PrefillCheckpointChunks(20, 16, 16, true) == + std::vector{4, 12, 4}); + // T=40: the n_batch cap binds first at 16, then offsets take over: + // (16, 8, 12, 4). + CHECK(PrefillCheckpointChunks(40, 16, 16, true) == + std::vector{16, 8, 12, 4}); + } + + SUBCASE("checkpoints disabled -> no split (n_ctx_checkpoints off)") { + CHECK(PrefillCheckpointChunks(10, 16, 16, false) == + std::vector{10}); + CHECK(PrefillCheckpointChunks(40, 16, 16, false) == + std::vector{16, 16, 8}); + } + + SUBCASE("a multi-sequence range is one range to the rule (spec ## Owed)") { + // The seam currently mirrors ONE server task per step; a multi-request + // step's scheduled range is therefore applied to the rule as a single + // stream — the documented Owed boundary, asserted here so the behavior is + // pinned rather than accidental. + // T=30: offset 4+ub=20 fires (min(16,20)=16) at n=14; then offset 4 at + // 26; remainder 4. 14 + 12 + 4 = 30. + CHECK(PrefillCheckpointChunks(30, 16, 16, true) == + std::vector{14, 12, 4}); + } + + SUBCASE("every chunking sums to the total and has no empty chunk") { + for (const int t : {1, 2, 3, 4, 5, 6, 7, 10, 12, 16, 17, 20, 23, 40, 64}) { + for (const int b : {4, 8, 16, 32}) { + for (const int u : {1, 4, 8, 16}) { + const auto chunks = PrefillCheckpointChunks(t, b, u, true); + REQUIRE(!chunks.empty()); + CHECK(Total(chunks) == t); + for (const int c : chunks) CHECK(c >= 1); + } + } + } + } +} + +// ── T1b/T2 planning gate: the runner's per-step decision ──────────────────── +TEST_CASE("T1b: PlanPrefillChunks gates the split on the runner's limits") { + SUBCASE("knob unset (0) -> no split, ever (T4 inertness)") { + CHECK(PlanPrefillChunks(0, 2048, 1, 10, false, false, true, false).empty()); + CHECK(PlanPrefillChunks(0, 16, 1, 40, false, false, true, false).empty()); + } + SUBCASE("multi-request, pure-decode, spec, mm, full-logits, live device ids") { + CHECK(PlanPrefillChunks(16, 16, 2, 10, false, false, true, false).empty()); + CHECK(PlanPrefillChunks(16, 16, 1, 1, false, false, true, false).empty()); + CHECK(PlanPrefillChunks(16, 16, 1, 10, true, false, true, false).empty()); + CHECK(PlanPrefillChunks(16, 16, 1, 10, false, true, true, false).empty()); + CHECK(PlanPrefillChunks(16, 16, 1, 10, false, false, false, false).empty()); + CHECK(PlanPrefillChunks(16, 16, 1, 10, false, false, true, true).empty()); + } + SUBCASE("an eligible single-request prefill splits per the rule") { + CHECK(PlanPrefillChunks(16, 16, 1, 10, false, false, true, false) == + std::vector{6, 4}); + } +} + +// ── T2: the chunk slices the step's token rows exactly ────────────────────── +TEST_CASE("T2: SliceCommonAttentionMetadata yields the chunk's token rows") { + const CommonAttentionMetadata cam = OneReqCam(/*computed0=*/100, /*t=*/10, + /*block_table_cols=*/4); + const auto plan = PlanPrefillChunks(16, 16, 1, 10, false, false, true, false); + REQUIRE(plan == std::vector{6, 4}); + + int begin = 0; + for (const int len : plan) { + const int end = begin + len; + const CommonAttentionMetadata chunk = + vllm::v1::SliceCommonAttentionMetadata(cam, begin, end); + CHECK(chunk.num_reqs == 1); + CHECK(chunk.num_actual_tokens == len); + CHECK(chunk.max_query_len == len); + CHECK(chunk.query_start_loc == std::vector{0, len}); + // Context before the chunk = computed0 + begin; through it = computed0 + end. + CHECK(chunk.num_computed_tokens_cpu == + std::vector{100 + begin}); + CHECK(chunk.seq_lens == std::vector{100 + end}); + // The chunk's KV slot ids are the step's rows [begin, end). + REQUIRE(chunk.slot_mapping.size() == static_cast(len)); + for (int i = 0; i < len; ++i) { + CHECK(chunk.slot_mapping[static_cast(i)] == 100 + begin + i); + } + // The block table is request-level and rides through. + CHECK(chunk.block_table_tensor == cam.block_table_tensor); + CHECK(chunk.block_table_num_cols == cam.block_table_num_cols); + begin = end; + } + CHECK(begin == 10); +} + +// ── T3: the state hand-off across a chunk boundary ────────────────────────── +TEST_CASE("T3: chunk k+1 reads the state slot chunk k wrote") { + CommonAttentionMetadata cam = OneReqCam(0, 10, 4); + const auto plan = PlanPrefillChunks(16, 16, 1, 10, false, false, true, false); + REQUIRE(plan == std::vector{6, 4}); + + // Per chunk, the runner rebuilds the GDN metadata from the chunk's cam with + // the SAME remapped state-slot table (one compact slot per sequence; the + // GdnStateCache buffers are persistent and written in place). + std::vector gdn_state_slots = {42}; // req 0 -> slot 42. + // The remapped state-slot table rides the block table's column 0. + cam.block_table_tensor[0] = gdn_state_slots[0]; + vllm::v1::GDNAttentionMetadataBuilder builder; + int begin = 0; + int prev_slot = -1; + int prev_has_initial = -1; + for (const int len : plan) { + const int end = begin + len; + const CommonAttentionMetadata chunk = + vllm::v1::SliceCommonAttentionMetadata(cam, begin, end); + const vllm::v1::GDNAttentionMetadata gdn = builder.build(/*common_prefix_len=*/0, + chunk); + // The chunk's recurrent input state is the slot table's entry, unchanged + // across chunks: chunk k+1 addresses exactly what chunk k wrote. + REQUIRE(gdn.prefill_state_indices.has_value()); + REQUIRE(gdn.prefill_state_indices->size() == 1); + const int slot = (*gdn.prefill_state_indices)[0]; + CHECK(slot == gdn_state_slots[0]); + // has_initial_state == "context before this chunk > 0": chunk 0 starts + // fresh; every later chunk CONTINUES the previous chunk's written state. + REQUIRE(gdn.has_initial_state.has_value()); + REQUIRE(gdn.has_initial_state->size() == 1); + const int has_initial = (*gdn.has_initial_state)[0]; + CHECK(has_initial == (begin > 0 ? 1 : 0)); + if (begin > 0) { + // THE HAND-OFF: the entering state (slot + continuation) is the state + // the previous chunk addressed — no reallocation, no remap, no fresh + // slot. The cache buffer itself is runner-persistent (written in place + // by the GDN kernels), so bit-exactness holds by address identity. + CHECK(slot == prev_slot); + CHECK(has_initial == 1); + } + prev_slot = slot; + prev_has_initial = has_initial; + begin = end; + } + CHECK(prev_has_initial == 1); +} + +// ── T4: default inertness ──────────────────────────────────────────────────── +TEST_CASE("T4: knob unset plans exactly ONE forward per step") { + // The runner consults PlanPrefillChunks BEFORE building forward input; an + // empty plan takes the existing single-forward branch byte-identically. + for (const int t : {1, 10, 2048}) { + CHECK(PlanPrefillChunks(/*prefill_ubatch=*/0, 2048, 1, t, false, false, + true, false) + .empty()); + } + // And a knob whose rule yields one chunk also stays on the single-forward + // branch (plan.size() <= 1). + const auto plan = PlanPrefillChunks(16, 2048, 1, 3, false, false, true, false); + REQUIRE(plan.size() == 1); + CHECK(plan[0] == 3); +} From 225f4acdefada8f16a88e378f434a39cb2389444 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 29 Nov 2026 08:41:03 +0100 Subject: [PATCH 4/9] test(ENG-CHUNKED-PREFILL): reach the production chunk-forward loop and pin the 4+ub offset order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer repairs for row ENG-CHUNKED-PREFILL (issue ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J). F1 (reachability): every prior ENG-CHUNKED-PREFILL case gated the pure rule and the seam helpers, so a mutation that neuters the PlanPrefillChunks call at runner.cpp:3302 (plan forced empty) left all of them green — the gate could not see the feature stop existing. The new case "ENG-CHUNKED-PREFILL: execute_model runs ONE forward PER CHUNK" enters through the PRODUCTION entry point `GPUModelRunner::execute_model` on CPU over a counting synthetic model (a LoadedModel + ModelFactory whose forward records each call's token-row width, following the test_device_token_ids_refusal.cpp fixture pattern): knob 0 → exactly ONE forward over the whole 10-token range; knob 16 → exactly TWO forwards with sizes (6, 4) in order. RED-first evidence: with the call site neutered the knob arm fails `CHECK( g_chunk_forward_calls == 2 ) ... values: CHECK( 1 == 2 )` and the size REQUIRE (1 == 2); restored, the case is green. This also upgrades the earlier PROCESS.md caveat that T2/T3 were never exercised through full runner execution. F2 (T1 blind spot): the asserted table never exercised n_batch > n_ubatch + 4, where the 4 + n_ubatch offset fires BEFORE the 4 offset. Two new subcases pin it: (T=12, b=16, ub=4) -> {4, 4, 4} and (T=13, b=16, ub=8) -> {1, 8, 4} — both assert the CORRECT pinned-rule values, and under the reviewer's {n_ubatch, 4} mutation they give {8, 4} / {5, 4, 4} and RED (test_prefill_chunks.cpp:101, :105 in the mutated run). A third subcase (T=17, b=16, ub=32) -> {1, 12, 4} pins the min(n_batch, 4+n_ubatch) half, which the mutation cannot reach. Note: the review finding's example value {8, 4} for (12, 16, 4) was wrong under the pinned rule — offsets are iterated in {4 + n_ubatch, 4} order and the first match breaks (server-context.cpp:4480-4490 @ abca69200), so {4, 4, 4} is correct and equally distinctive against the mutation. No production code changed; no checker touched; CPU-only tests. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [task] --- tests/vllm/v1/worker/test_prefill_chunks.cpp | 22 +++++ tests/vllm/v1/worker/test_runner.cpp | 89 ++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/tests/vllm/v1/worker/test_prefill_chunks.cpp b/tests/vllm/v1/worker/test_prefill_chunks.cpp index 68801f9d7..945a4583f 100644 --- a/tests/vllm/v1/worker/test_prefill_chunks.cpp +++ b/tests/vllm/v1/worker/test_prefill_chunks.cpp @@ -93,6 +93,28 @@ TEST_CASE("T1: PrefillCheckpointChunks transcribes the pinned server rule") { std::vector{16, 8, 12, 4}); } + SUBCASE("F2: n_batch >= n_ubatch + 4 — the 4 + n_ubatch offset fires FIRST") { + // offsets are iterated in `{4 + n_ubatch, 4}` order and the FIRST match + // breaks (server-context.cpp:4480-4490 @ abca69200). With ub=4 the 8 + // offset fires before the 4 offset can, so T=12 splits into three 4s — + // NOT {8, 4}, which is what swapping the array to {n_ubatch, 4} yields. + CHECK(PrefillCheckpointChunks(12, 16, 4, true) == + std::vector{4, 4, 4}); + // Same ordering at ub=8: the 12 offset breaks at 1, then the 4 offset at + // 9. The {n_ubatch, 4} reading gives {5, 4, 4} here instead. + CHECK(PrefillCheckpointChunks(13, 16, 8, true) == + std::vector{1, 8, 4}); + } + + SUBCASE("F2: 4 + n_ubatch exceeds n_batch — the min() half pins the cap") { + // With ub=32, b=16 the first offset is 36 and min(n_batch, 36) == 16: the + // break fires at n == T - 16 == 1, so the FIRST chunk is 1 and the rest + // follows the 4 offset. Without the min() this offset could never fire + // inside one batch. + CHECK(PrefillCheckpointChunks(17, 16, 32, true) == + std::vector{1, 12, 4}); + } + SUBCASE("checkpoints disabled -> no split (n_ctx_checkpoints off)") { CHECK(PrefillCheckpointChunks(10, 16, 16, false) == std::vector{10}); diff --git a/tests/vllm/v1/worker/test_runner.cpp b/tests/vllm/v1/worker/test_runner.cpp index d5d7b7c18..690f50196 100644 --- a/tests/vllm/v1/worker/test_runner.cpp +++ b/tests/vllm/v1/worker/test_runner.cpp @@ -3609,3 +3609,92 @@ TEST_CASE("A2-2: the verify download staging is page-locked and a grow RETAINS t staging.Get(backend, 256); CHECK(staging.live_blocks() == 3); } + +// ─── ENG-CHUNKED-PREFILL F1 (reachability): the PRODUCTION chunk loop ──────── +// The other ENG-CHUNKED-PREFILL cases gate the pure rule and the seam helpers; +// none of them could see the runner's own chunk-forward loop at +// runner.cpp (the PlanPrefillChunks consult + the per-chunk Forward). A +// reviewer mutation that forces the plan EMPTY left every one of those green. +// This case enters through `execute_model` — the production entry point — with +// a counting forward, and asserts the NUMBER of ModelRegistry::Forward calls: +// one per chunk, with the chunk sizes in order, when the knob is set; exactly +// one when it is 0. +namespace { + +// A registration whose forward COUNTS that it ran and records each call's +// token-row width. The runner sees only LoadedModel + the factory table, so a +// fake with a counting forward is the whole fixture. +int g_chunk_forward_calls = 0; +std::vector g_chunk_forward_token_counts; + +vllm::ForwardLogits ChunkCountingForward(vllm::LoadedModel& model, + const vllm::ModelForwardInput& input) { + (void)model; + ++g_chunk_forward_calls; + g_chunk_forward_token_counts.push_back( + static_cast(input.token_ids.size())); + return {}; +} + +// The runner's constructor routes through ModelRegistry::Prepare, which +// dispatches on the registration's table — a no-op for this probe. +void ChunkCountingPrepare(vllm::LoadedModel& model, const HfConfig& config, + vt::Queue& queue) { + (void)model; + (void)config; + (void)queue; +} + +class ChunkCountingModel : public vllm::LoadedModel { + public: + explicit ChunkCountingModel(const vllm::ModelRegistration& reg) + : vllm::LoadedModel(reg) {} +}; + +} // namespace + +TEST_CASE("ENG-CHUNKED-PREFILL: execute_model runs ONE forward PER CHUNK") { + vllm::ModelFactory factory; + factory.prepare = &ChunkCountingPrepare; + factory.forward = &ChunkCountingForward; + constexpr std::string_view kCountingArch = "ChunkCountProbeModel"; + const vllm::ModelRegistration reg{kCountingArch, &factory, vllm::ModelInfo{}}; + + const HfConfig c = MakeConfig(); + const int kNumBatched = 16; + // A single fresh 10-token prefill: the row shape the oracle split (6, 4). + const auto MakeStep = [] { + NewRequestData p = MakeNewReq("P", {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {}, + /*num_computed=*/0, /*fa_blocks=*/{2, 3}, + /*gdn_block=*/1, Greedy()); + return NewStep({p}, {{"P", 10}}); + }; + + // THE DEFAULT (knob 0): exactly ONE forward over the whole range. + { + ChunkCountingModel model(reg); + GPUModelRunner runner(c, model, MakeKvConfig(c), Q(), + /*max_num_reqs=*/8, kMaxModelLen, kNumBatched); + g_chunk_forward_calls = 0; + g_chunk_forward_token_counts.clear(); + CHECK_FALSE(runner.execute_model(MakeStep()).has_value()); + CHECK(g_chunk_forward_calls == 1); + REQUIRE(g_chunk_forward_token_counts.size() == 1); + CHECK(g_chunk_forward_token_counts[0] == 10); + } + + // THE KNOB (prefill_ubatch 16): ONE forward PER CHUNK, (6, 4) in order. + { + ChunkCountingModel model(reg); + GPUModelRunner runner(c, model, MakeKvConfig(c), Q(), + /*max_num_reqs=*/8, kMaxModelLen, kNumBatched); + runner.set_prefill_ubatch(16); + g_chunk_forward_calls = 0; + g_chunk_forward_token_counts.clear(); + CHECK_FALSE(runner.execute_model(MakeStep()).has_value()); + CHECK(g_chunk_forward_calls == 2); + REQUIRE(g_chunk_forward_token_counts.size() == 2); + CHECK(g_chunk_forward_token_counts[0] == 6); + CHECK(g_chunk_forward_token_counts[1] == 4); + } +} From 18ddf6fbe8ab35b75e82e990eb9c362773a64c56 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 29 Nov 2026 08:41:14 +0100 Subject: [PATCH 5/9] docs(ENG-CHUNKED-PREFILL): record the F1/F2 repair round mutation-RED evidence Append the timestamped repair-round entry to the row's PROCESS.md: the reachability test name and its verbatim RED under the neutered call site, the F2 table cases and their RED under the offset mutation, the focused green set, the exit-0 preflight, and the repair commit. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [task] --- .../eng-chunked-prefill-20261128/PROCESS.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md b/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md index 1004b34a9..2b974c177 100644 --- a/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md +++ b/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md @@ -184,3 +184,47 @@ UNAMBIGUOUS in source — no NEEDS_DECISION. Transcribed from 3 deletions(-)"). - Committed as `1f4069521` on `row/ENG-CHUNKED-PREFILL` (base spec commit `3a27457bf`). No push. + +## 2026-11-29 (repair round) — F1 + F2 review findings repaired, commit 77472837c + +- F1 (reachability, critical): added + `TEST_CASE("ENG-CHUNKED-PREFILL: execute_model runs ONE forward PER CHUNK")` + in `tests/vllm/v1/worker/test_runner.cpp` (tail). It enters through the + PRODUCTION entry point `GPUModelRunner::execute_model` on CPU with a + counting synthetic model (`ChunkCountingModel` + `ModelFactory` whose + forward records call count and each call's token-row width; fixture + pattern from `test_device_token_ids_refusal.cpp`; the runner ctor routes + through `ModelRegistry::Prepare`, so the fixture also registers a no-op + prepare). 10-token single-request prefill, `max_num_batched_tokens=16`: + knob 0 → exactly 1 forward of 10 rows; `set_prefill_ubatch(16)` → exactly + 2 forwards, (6, 4) in order. This supersedes the earlier caveat that T2/T3 + were never exercised through full runner execution — the forward loop now + is. +- F1 mutation-RED (verbatim): with the PlanPrefillChunks call site neutered + at `src/vllm/v1/worker/gpu/runner.cpp:3302` (plan forced empty, exactly the + reviewer's mutation), the focused case REDs: + `ERROR: CHECK( g_chunk_forward_calls == 2 ) is NOT correct! values: CHECK( 1 == 2 )` + and `FATAL ERROR: REQUIRE( g_chunk_forward_token_counts.size() == 2 ) ... (1 == 2)` + (doctest, `Status: FAILURE!`, 1 failed / 1). After restoring runner.cpp the + case is GREEN (9/9 assertions, `Status: SUCCESS!`). +- F2 (T1 blind spot): two new subcases in + `tests/vllm/v1/worker/test_prefill_chunks.cpp` with n_batch >= n_ubatch + 4: + (T=12, b=16, ub=4) → {4, 4, 4} and (T=13, b=16, ub=8) → {1, 8, 4}; plus + (T=17, b=16, ub=32) → {1, 12, 4} pinning the min(n_batch, 4+n_ubatch) half. + NOTE: the finding's example value {8, 4} for (12,16,4) is wrong under the + pinned rule — offsets are iterated in {4 + n_ubatch, 4} order, first match + breaks (server-context.cpp:4480-4490 @ abca69200), so {4, 4, 4} is correct + and equally distinctive against the reviewer's {n_ubatch, 4} mutation. +- F2 mutation-RED: applying the reviewer's offset mutation + (`{n_ubatch, 4}` in `include/vllm/v1/worker/gpu/prefill_chunks.h:66`), + the new cases RED (`PrefillCheckpointChunks(12, 16, 4, true)` != {4, 4, 4} + and `(13, 16, 8, true)` != {1, 8, 4} — 1 failed / 5 cases); the min() case + stays green under that mutation by design (it pins the min() half, not the + order). Header restored byte-for-byte; GREEN (5/5 cases, 1277/1277). +- Focused set green after restore: test_prefill_chunks, test_runner (full + binary, 42 cases 1927 assertions), test_prepare_inputs — all + `Status: SUCCESS!`. +- Preflight `--staged` (PATH=/usr/share/pwsh-7.6): exit 0 after 1582 s. +- Committed as `77472837c` on `row/ENG-CHUNKED-PREFILL` + (`test(ENG-CHUNKED-PREFILL): reach the production chunk-forward loop and + pin the 4+ub offset order`). No push. From ce128190e4de2130f4bc0ffb93d5a449b7dd4ecb Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 29 Nov 2026 09:11:54 +0100 Subject: [PATCH 6/9] fix(ENG-CHUNKED-PREFILL): repair the record anchors the rebase surfaced Taking main's engine-matrix wholesale during the rebase left the ENG-MOE-LOADSTREAM anchor at main's pre-insertion line (2668); our four loader lines move FromModelDir to 2672. Eight further stale anchors were the branch's stale matrix hunk, removed by resetting the file to main's version; this row adds no matrix row of its own. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [maki] --- .agents/engine-matrix.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.agents/engine-matrix.md b/.agents/engine-matrix.md index 84e38b51f..88e809fa1 100644 --- a/.agents/engine-matrix.md +++ b/.agents/engine-matrix.md @@ -172,8 +172,8 @@ lifecycle are unchanged. |---|---|---|---|---|---|---|---|---| | `SPEC-MTP` | Qwen3.6 MTP heads, k=1 first. **M-mtp-0 CLOSED 2026-07-24: the standalone draft head is oracle-parity-proven on BOTH checkpoints** (27B dense + 35B MoE, k=1, vLLM 0.25.0 executable @ pin `e24d1b24`) - argmax exact on 26/26 unambiguous rows each; the one remaining row per checkpoint is an EXACT oracle top1==top2 tie where vLLM's own `argmax` and `topk` disagree and our pick is a tied maximum; logits within the whole-model bound (atol 0.05 + rtol 0.05), 0/216 out-of-tol on both; shared lm_head isolated is bit-exact on the 35B NVFP4 head. **I2 scheduler-half LANDED (2026-07-24)**: host-side spec plumbing + the FROZEN spec-metadata ABI (spec §2.7) - `SpeculativeConfig`, `DraftTokenIds`, `Request::spec_token_ids`/`NumTokensWithSpec`, populated `scheduled_spec_decode_tokens`, `Scheduler::update_draft_token_ids`, `take_draft_token_ids` seam, `EngineCore::post_step`, `InputBatch::num_accepted_tokens`/`update_req_spec_token_ids`; DEFAULT-OFF and INERT (no `SpeculativeConfig` => `num_lookahead_tokens == 0`). **I3 verify-half LANDED (2026-07-24)**: greedy rejection sampler + per-request logits expansion (see `SPEC-REJECTION`, now `ACTIVE`). **I4 GDN-half LANDED (2026-07-24)**: the GDN speculative slot path + bit-exact state rollback, the piece BOTH GDN-hybrid gate checkpoints need (see `SPEC-GDN-SEGMENTS`, now `ACTIVE`). **I5a GDN LAYER ROUTING + runner spec-metadata upload LANDED (2026-07-24, `CLAIM-SPEC-MTP-I5A`)**: `GdnBlockPaged` now routes a pure-spec batch through `vt::GdnSpecDecode`/`vt::CausalConv1dSpecUpdate` and the runner uploads I4's six spec device tensors — first sub-increment of the scoped M-mtp-1 (I5a GDN wiring → I5b prepare_prefill → I5c MTP paged propose → I5d config+runner-loop+the 27B token gate, spec §5). DEFAULT-OFF INERT, bit-exact vs the I4 ops, no e2e loop yet. **I5b `prepare_prefill_inputs` LANDED (2026-07-24, `CLAIM-SPEC-MTP-I5B`, recorded under `SPEC-REJECTION`)**: the drafter prefill input-prep host routine (shift-splice + `query_len -= num_rejected` + last-token index / metadata) — second scoped M-mtp-1 sub-increment, DEFAULT-OFF INERT, unit-gated RED-first, additive. **I5d CONFIG + RUNNER LOOP LANDED, PARTIAL (2026-07-25, `CLAIM-SPEC-MTP-I5D`)**: `--speculative-config` JSON parse -> `EngineParams::speculative_config`; `LoadedEngine` resolution (`ResolveSpecConfig`/`ResolveMtp`, widened KV `MakeQwen3_5KVCacheSpec(num_spec>0)`, `BuildMtpDraft`, forced sync scheduling, `MakeScheduler(spec)`, `EngineCore(check_for_draft=true)`); the full runner verify/propose loop (draft splice, hidden-tap capture, GDN builder spec-overload feed, k+1 GDN state-slot remap + widened conv cache + draft-KV alloc, `MtpProposePrefill` post-sampling, `take_draft_token_ids`, acceptance telemetry). CUDA `-Werror` 0 warnings, cutlass-ON banner. SPEC-OFF BYTE-IDENTICAL (all gated on `spec_on()`): SACRED 27B 235/235, 35B 315/315, Coder 138/138 + unit test_runner 257 / test_mtp_speculator 169 / test_gdn_metadata_builder 483 / test_ops_gdn 3630 ALL PASS. **The three-way 27B token gate is NOT yet passing** (`tests/parity/test_qwen27_spec_decode.cpp` RUNS the loop + MEASURES the blocker): the spec-ON engine throws on the FIRST prefill step at `gdn_state_gather: working/cache row shapes must match` (`src/vt/ops.cpp:1773`) — I4's spec conv rollback needs the conv row widened to `(K-1)+num_spec` but the non-spec GDN conv ops assume `(K-1)`. Closing needs widened-cache-aware non-spec GDN conv ops + the MIXED `GdnBlockPaged` split/merge. Row LEFT `GATING` at I5e. **I5e LANDED 2026-07-25 (`CLAIM-SPEC-MTP-I5E`) — `SPEC-MTP` LEAVES `GATING`.** Made the non-spec GDN conv ops widened-cache-aware (mirror vLLM `state_len=KERNEL_WIDTH-1` + physical `stride_conv_state_tok`; leading `(K-1)` sub-window; byte-identical at `num_spec==0`, contiguous fast path kept) AND RCA'd the resulting 0-acceptance dead-drafter to the async input-combine overwriting the verify batch's draft position with the committed token (forced off under spec, nullopt-guarded). **THREE-WAY 27B GATE PASSES** (single-request greedy): our-ON == vLLM `--speculative-config mtp` greedy == our-OFF token-for-token; **acceptance 16/16 drafts accepted**, ~16 target steps saved. Spec-OFF SACRED byte-identical (27B 235/235, 35B 315/315, Coder 138/138), `test_ops_gdn` 3678, compute-sanitizer 0 on the spec step. NOT `DONE`: MIXED `GdnBlockPaged` split/merge (concurrency) + throughput A/B are I6. **I6 LANDED 2026-07-25 (`CLAIM-SPEC-MTP-I6`), `benchmark_binding=true` — the §5 c1 THROUGHPUT GATE, first spec-decode speed number:** OURS spec-ON (`examples/vllm-bench` + an additive `--speculative-config` flag, production config) vs pinned vLLM 0.25.0 spec-ON (graphed `vllm serve --speculative-config mtp` + `vllm bench serve`, `enforce_eager=False`/`FULL_AND_PIECEWISE`/inductor; MTP confirmed `Resolved architecture: Qwen3_5MTP`), SAME `{"method":"mtp","num_speculative_tokens":1}`, 27B `~/bench/q36-27b-nvfp4-vllm`, c1, greedy, 8 real prompts x 256 out, prose + code, idle box one-engine-at-a-time under one `flock`, 3 reps (cold TTFT discarded), token-identity re-confirmed FIRST (`test_qwen27_spec_decode` PASS 16/16). RESULT — **ours AT/ABOVE vLLM on EVERY measured axis** (prose / code): TPOT 66.2/62.95 vs 69.1/65.3 ms (ours ~1.04x faster), output tput 15.10/15.72 vs 14.43/15.13 tok/s (+4.6%/+3.9%), ITL 121.6/121.1 vs 123.2 ms, TTFT(warm) 131/131 vs 151.5/181 ms, acceptance ours 0.85/0.92 vs vLLM 0.838 overall (within noise, live drafter both), peak RSS 28.4 GB ON / 24.8 GB OFF (both inside the 119 GiB pool). Spec helps both (ours 1.52x/1.59x, vLLM 1.51x/1.60x TPOT); ours already ~4% faster spec-OFF. STAYS `ACTIVE`: the c>1 mixed spec+non-spec `GdnBlockPaged` split/merge is still refused (needs a row `IndexSelect`/`IndexCopy` vt op) + owes a c>1 A/B, and no user-facing supported `--speculative-config` on the OpenAI server yet (bench flag example-only/additive). Raw logs dgx `~/work/mtp-bench-i6/{results,vresults}`. **I7 LANDED 2026-07-25 (`CLAIM-SPEC-MTP-I7`, `benchmark_binding=true`) — the MIXED spec+non-spec GDN batch (concurrency), the server/CLI `--speculative-config`, and the c>1 A/B — implementation COMPLETE + at vLLM parity; STAYS `ACTIVE` for one honest reason (below), NOT a lag.** New row op `vt::IndexSelect`/`vt::IndexCopy` (CUDA==CPU bit-exact at GDN widths, RED-first); `GdnBlockPagedMixedSpec` split/merge (mirror `qwen_gdn_linear_attn.py:1329-1576`) proven MODEL-INDEPENDENTLY bit-exact (mixed == pure spec + pure prefill, 27B/35B, `test_qwen3_5_gdn_spec_routing`, RED-first by a broken merge); compute-sanitizer 0 on the mixed step + op; server (I5d) + CLI (ABI v6) `--speculative-config`. **c>1 A/B (both spec-ON, same config):** ours ON-PAR-OR-ABOVE vLLM at c2/c4/c8 (output tput within ~+/-2%, ours +1.6%/+2.5% c2, +0.9%/+1.7% c4, +0.9%/-1.1% c8 within noise, prose/code; both ~1.5x spec speedup — does NOT go neutral; acceptance 0.84-0.92 vs vLLM 0.835). **Why STAYS `ACTIVE` (honest, not a lag):** the DONE criterion's strict `token-exact at c>1` clause is a proven MODEL impossibility — the 27B greedy is bf16-batch-nondeterministic (spec-OFF max_seqs 4-vs-1 differs 2/3 short prompts, NO spec involved), affecting vLLM identically, so exact c>1 token identity cannot be met by any correct implementation; c>1 correctness is instead established by the model-independent bit-exact split/merge proof + acceptance parity (near-tie-distributional-gate), with token-exact strict at c1 (I6). No missing work, no lever — the DONE final call is deferred to the user given this criterion ambiguity. SACRED spec-OFF byte-identical 27B 235/235, 35B 315/315, Coder 138/138; CUDA `-Werror` 0 warnings. Raw logs dgx `~/work/mixed-batch/{cN_results,cN_vresults}`. **I8 — `SPEC-MTP` → `DONE` 2026-07-26 (`CLAIM-SPEC-MTP-DONE`, records-only, ZERO code):** the user RATIFIED the deferred c>1 criterion — at concurrency > 1 the DONE bar is the near-tie-distributional form (ours ∈ vLLM's batch-nondeterministic set) + the SPEED delta, NOT strict token-exact (a proven bf16-batch-nondeterminism MODEL impossibility that affects vLLM identically). Both I6-owed DONE items are therefore CLOSED: (1) the MIXED spec+non-spec `GdnBlockPaged` split/merge (I7, model-independently bit-exact + compute-sanitizer 0) with the c2-c8 A/B on-par-or-above vLLM, and (2) the server + CLI + C-ABI(v6) `--speculative-config` flag (I5d/I7, `examples/server/main.cpp`+`examples/cli/main.cpp`+`src/capi/vllm_c.cpp`). MTP k=1 spec-decode is COMPLETE and gated: 27B three-way token-exact at c1 (I5e), c1 above vLLM on every axis (I6), c2-c8 on-par-or-above (I7), spec-OFF byte-identical SACRED (27B 235/235, 35B 315/315, Coder 138/138). This transition is byte-identical BY CONSTRUCTION (`git diff --stat` = records only; ZERO `src/`/`include/`/`examples/` touched, so the I5d/I6/I7 GPU gates stand on this exact code). Tracked follow-ons: the 35B `Qwen3_5MoeMTP` full e2e token gate (M-mtp-2) is now **CLOSED — `DONE` 2026-07-26 (`CLAIM-SPEC-MTP-M-MTP-2`)**: three-way token-exact 16/16 vs the live vLLM 0.25.0 oracle (spec-ON AND spec-OFF), acceptance 16/16 both sides, c1 spec-ON 1.19x TPOT / +16.3% output-tput vs spec-OFF (0.908) — `MODEL-SPEC-qwen3-5-mtp-qwen3-5-moe-mtp` `GATING`→`DONE`, so MTP is `DONE` on BOTH gate models. Remaining spec-decode follow-on: `SPEC-DFLASH` (oracle-BLOCKED, vllm#40898) | T1 | `vllm/v1/worker/gpu/spec_decode/mtp/speculator.py:12`; `vllm/model_executor/models/qwen3_5_mtp.py:63,129-165,192-301`; **I5d** `vllm/engine/arg_utils.py` (`--speculative-config`); `vllm/v1/worker/gpu/model_runner.py:1455-1489` | `include/vllm/config/speculative.h`; `include/vllm/v1/core/sched/scheduler.h`; `src/vllm/v1/core/sched/scheduler.cpp`; `include/vllm/v1/worker/gpu/input_batch.h`; `include/vllm/model_executor/models/qwen3_5_mtp.h:23,58`; `src/vllm/model_executor/models/qwen3_5_mtp.cpp:271`; `src/vllm/model_executor/models/qwen3_5.cpp:3336,3359`; **I5d** `src/vllm/config/speculative.cpp`; `src/vllm/entrypoints/model_loader.cpp` (`ResolveSpecConfig`/`MakeKVCacheMaybeSpec`/ctor wiring); `src/vllm/v1/worker/gpu/runner.cpp` (splice/tap/GDN spec feed/`propose_drafts`/`take_draft_token_ids`/spec-slot remap/draft-KV alloc); `examples/server/main.cpp` | `tests/vllm/v1/test_scheduler.cpp:1135,1238,1272,1316`; `tests/vllm/v1/worker/test_input_batch.cpp`; `tests/vllm/v1/spec_decode/test_mtp_speculator.cpp:201,225,263,299,331` (7/7 cases, 141 assertions); oracle runner `tests/parity/test_op_parity.cpp:1373` + focused case `:1914` (20/20 assertions, both checkpoints, `VLLM_MTP_REQUIRE_CHECKPOINTS=1`); goldens `tests/parity/goldens/qwen3_5_mtp_head_{27b,35b}/`; dump `tools/parity/dump_qwen3_5_mtp.py:144`; **I5d** `tests/parity/test_qwen27_spec_decode.cpp` (three-way gate, RUNS + measures the RCA blocker); **I6** `examples/bench/{main.cpp,bench_core.h}` (additive `--speculative-config` bench flag + acceptance telemetry); **I7** `tests/vllm/models/test_qwen3_5_gdn_spec_routing.cpp` (mixed == pure spec + prefill bit-exact), `tests/parity/test_qwen27_spec_decode_concurrent.cpp`, `tests/vt/test_ops_gdn.cpp` (IndexSelect/IndexCopy); DONE closure [ledger](parity-ledger.md#L714) | [mtp-spec-decode.md](specs/mtp-spec-decode.md) | `DONE` | `72f9fb1` | | `SPEC-MTP-K-GT-1` | **MTP speculation DEPTH (`num_speculative_tokens` > 1).** Ports the autoregressive multi-step propose the k=1 early exit sits in front of, so a configured depth is SERVED instead of silently degraded. Before it, `--num-speculative-tokens 3` reserved KV for 3, captured the verify shape at T=4 and stashed ONE draft per request, with no error and no log; a refusal by name landed first and this row removed it in the same flow. `MtpProposeDrafts` runs the prefill, the k=1 early exit, then `prepare_decode_inputs` and the k-1 single-token draft decode steps over the draft's own paged KV, with `update_draft_inputs` recording each step and feeding it forward. Greedy plus accept-if-equal makes the emitted sequence INDEPENDENT of k, so a token-identity gate cannot see a clamped drafter and every depth assertion needs a positive witness beside the identity. The per-depth counters were the FIRST witness and a fresh review proved them BLIND: they report the LENGTH of the emitted draft list, so a propose that runs one forward and pads all k columns satisfies them, and acceptance is zero at every depth on the CPU model, so no acceptance figure separates the arms either. TWO witnesses survive, because one does not cover both failures. `spec_mtp_draft_decode_forwards() == spec_mtp_propose_calls() * (k - 1)`, counted after each draft decode forward RETURNS and guarded by a non-zero call count, catches a propose that SHORT-CIRCUITS or CLAMPS. A third fresh review then proved it does NOT catch PADDING, since a loop that runs every forward and then discards what it sampled increments it honestly. `spec_mtp_proposals_with_varied_drafts()`, read at the CONSUMER on the array the propose delivered, catches exactly that. NEITHER shows per-column provenance, and neither does a non-zero acceptance count AT DEPTH, which a padded row earns whenever the target repeats a token. The owed DGX gate closes it with a per-depth acceptance RATE against a PADDED CONTROL. The CPU tier therefore proves k drafts are PROPOSED and VERIFIED, never ACCEPTED at depth. DEFAULT unchanged at k=1 (both checkpoints' `n_predict`). **NO speed number at any k>1**: the GPU was held by another session for the whole flow, so the DGX three-way at k=2..4 on the 27B and 35B and the matched-k throughput A/B are OWED, as is the bf16 GDN-state arm (the CPU gate runs the f32 arm because `vt::CausalConv1dSpecUpdate` rejects bf16 off CUDA). Also owed and filed: [#1020](https://github.com/mudler/vllm.cpp/issues/1020), a step whose ACTUAL draft count differs from the configured k leaves the captured verify graph silently. | T1 | `vllm/v1/worker/gpu/spec_decode/autoregressive/speculator.py:129-274,335-371,374-419,426-471,597-671,674-771` @ `555967922`; `vllm/config/speculative.py:967-991` | [`src/vllm/v1/worker/gpu/spec_decode/mtp/speculator.cpp`](../src/vllm/v1/worker/gpu/spec_decode/mtp/speculator.cpp) (`MtpProposeDrafts`); [`prepare_decode_inputs.cpp`](../src/vllm/v1/worker/gpu/spec_decode/autoregressive/prepare_decode_inputs.cpp); `Qwen3_5MTPModel::GatherHiddenRows` ([qwen3_5.cpp](../src/vllm/model_executor/models/qwen3_5.cpp)); `GPUModelRunner::propose_drafts` + the per-depth counters ([runner.cpp](../src/vllm/v1/worker/gpu/runner.cpp), [runner.h](../include/vllm/v1/worker/gpu/runner.h)); the in-memory `mtp_weights` seam ([model_loader.h](../include/vllm/entrypoints/model_loader.h)) | [`test_mtp_depth`](../tests/vllm/v1/spec_decode/test_mtp_depth.cpp) 5/5, 63 assertions (k=1,2,3,4 through `LoadedEngine`, greedy tokens identical to spec-OFF, each arm witnessed BOTH by the draft decode forwards the propose RAN and by whether the DELIVERED draft row varied with depth; neither witness shows per-column provenance, which is owed to the DGX gate); [`test_prepare_decode_inputs`](../tests/vllm/v1/spec_decode/test_prepare_decode_inputs.cpp) 8/8, 33 (both kernel ports + both `max_model_len` clamps, 5 mutations caught); [`test_speculative_mtp_depth`](../tests/vllm/config/test_speculative_mtp_depth.cpp) 4/4, 20; full CPU suite ctest 493 passed / 0 failed / 2 skipped of 495 (the two skips checkpoint-gated and unrelated) | [mtp-k-gt-1.md](specs/mtp-k-gt-1.md) | `ACTIVE` | `CLAIM-SPEC-MTP-K-GT-1` ([#81](https://github.com/mudler/vllm.cpp/issues/81)) | -| `SPEC-MTP-GGUF` | MTP speculative decoding from a GGUF TARGET. Today `FromModelDir` refuses `mtp`+GGUF outright (`src/vllm/entrypoints/model_loader.cpp:717-723`) on the original spike's assumption that GGUF exports carry no `mtp.*` ([mtp-spec-decode.md](specs/mtp-spec-decode.md):979-980, "until we re-export GGUFs with the head"). That is stale: llama.cpp's Qwen3.5 converter DOES emit the head, under layer-indexed `nextn` naming, and our own `HfConfigFromGguf` ALREADY reads `nextn_predict_layers` (it just discards the value into the trunk layer count). Gap is a `TensorResolver` over `GgufFile` mapping `mtp.*` onto `blk.{L+i}.nextn.*` with dequant-to-bf16, one config field, and narrowing the rejection to `dflash`. `ngram`+GGUF already works and is untouched. Qwen3.5/3.6 only (the widened spec KV path serves no other arch). NO ABI change | T2 | llama.cpp (the producer contract; vLLM has no GGUF MTP path) `conversion/qwen.py:535-604` `_Qwen35MtpMixin` (the authoritative `mtp.*`->`nextn` remapper + `add_nextn_predict_layers`); `gguf-py/gguf/constants.py:129,910-917,1494-1501`; `gguf-py/gguf/tensor_mapping.py` `NEXTN_*` | **G1-G3 LANDED 2026-07-28.** `HfConfigFromGguf` republishes the head depth `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:598` (`c.raw["mtp_num_hidden_layers"] = nextn`, previously read then discarded); the head loader `LoadQwen3_5MTPFromGguf` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1569` (+ decl `include/vllm/model_executor/models/qwen3_5_gguf_weights.h:143`) reusing the TRUNK helpers `OwnNormMinus1`/`OwnMatmulWeight`/`OwnBf16`/`LoadAttnGguf`/`LoadMoeGguf` so the head inherits the GGUF (w+1) norm storage, quantization/residency routing and torch [N,K] shapes; `NumMtpLayers`/`UsesDedicatedEmbeddings` exported out of the anon namespace `include/vllm/model_executor/models/qwen3_5_mtp.h`; rejection narrowed to dflash + a head-less-GGUF check `src/vllm/entrypoints/model_loader.cpp` and the head attached in the GGUF branch; **G4 GREEN + `CPU-SPEC-DIVERGENCE` FIXED 2026-07-28**: root cause `src/vllm/model_executor/models/qwen3_5.cpp:3616` sized the GDN state gather/scatter row by `(Kw-1)` while the speculative persistent row is `(Kw-1)+num_spec`, so `GatherRows`/`ScatterRows` mis-strode the slot AND every channel past the first, corrupting post-prefill recurrent state. Fix = `CopyStateRowsStrided` (same TU) used by `GatherStateF32`/`ScatterStateF32` when `cache.shape[2] != work.shape[2]`; the contiguous helpers are kept when the widths agree, so every non-spec path is byte-identical by construction. CPU-only in effect (the fp16/bf16 arm routes through the `GdnStateGather`/`Scatter` ops, so CUDA was never exposed; no GPU result affected) | `tests/vllm/models/test_qwen3_5_gguf_mtp.cpp:109,146,156,184` **4 cases, and the split is the 2026-08-21 repair** ([#1454](https://github.com/mudler/vllm.cpp/issues/1454)): the file used to be the env-gated pair ALONE, each opening on a bare `return`, so with `VLLM_MTP_GGUF_MODEL` unset it reported `test cases: 2 \| 2 passed`, **`assertions: 0`**, `Status: SUCCESS!`, exit 0 - which is every CI run of this repository, the variable being set nowhere in `.github/workflows/`. The `18 assertions` this cell used to record was the LIVE count and was never once reached in CI. Now `:109` and `:146` are **HERMETIC** (KV-only synthetic GGUFs, no weight bytes, 18 assertions on any machine) and pin the arithmetic the old file only NAMED in a comment above `CHECK(c.num_hidden_layers > 0)`: `num_hidden_layers + mtp_num_hidden_layers == block_count` over 65/1, 25/1 and 28/3 - the third arm separating `- nextn` from `- 1` - plus the head-less arm, where the key is NOT published and `NumMtpLayers` answering 1 for an absent key is exactly why the invariant cannot be written with that helper alone. `:156` and `:184` stay env-gated on `VLLM_MTP_GGUF_MODEL` (so CI stays asset-free) and now SKIP LOUDLY with a `MESSAGE` naming the variable, as `tests/vllm/entrypoints/test_gguf_mmproj_reach.cpp` does; `:156` re-derives the same invariant from the file's OWN `block_count` kv. Unset: **4 cases / 18 assertions / `Status: SUCCESS!` / rc 0**. Live on `Qwen3.8-27B-Q4_K_M.gguf` (`block_count` 65, `nextn_predict_layers` 1): **4 cases / 38 assertions / `Status: SUCCESS!` / rc 0**. Mutation-proved on the production line `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:889`, both compiling clean and both restored against a pre-taken sha256: `= block_count` (drop the subtraction) 3/4 cases, 9/18 red, exit 1; `= block_count - 1` (the wrong constant) 2/4 cases, 5/18 red, exit 1. The SAME mutations left the PREVIOUS file at 2/2 cases, 0 assertions, `SUCCESS!`, exit 0. Correctness of the production line is unchanged and was never in question (`1a4db5c3c`, `493327b4e`); this was a test defect. Live-arm content unchanged: depth reaches config.raw; fc is [H,2H] verbatim; 3 norms [H]; head block is full-attention. **RED-first BEHAVIOURAL** (reverting only the G1 line fails both cases 2/2). Trunk inertness: `test_gguf` 103, `test_gguf_qwen36_loader` 99, `test_gguf_keep_quant` 5958, `test_gguf_dequant` 215, `test_capi` 33/232 all unchanged; `tests/parity/test_qwen35_gguf_spec_decode.cpp:74,139` - spec-ON == spec-OFF token-exact with 13 proposed/11 accepted, plus an `ngram` regression guard (widens the cache, never runs the spec conv update) that was token-exact throughout and pinned the widening as innocent. Regression sweep all unchanged: ops_gdn 1825, gdn_metadata_builder 483, gdn_prefill_conv 28, gdn_spec_routing 12, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, gguf_dequant 215, llm_engine 196, input_batch 163, runner 257, capi 232 **GPU CLOSE-OUT + DEVICE-DELTA ATTRIBUTION 2026-07-28 (`G5`-`G7`), ledger [parity-ledger.md#L800](parity-ledger.md#L800).** The GPU end-to-end gate re-run on a from-scratch RELEASE-TARGET build (`-DVLLM_CPP_CUDA_ARCHITECTURES=121a`, build dir DELETED first; arch VERIFIED by `build-cuda/CMakeFiles/vllm.dir/flags.make` `--generate-code=arch=compute_121a,code=[compute_121a,sm_121a]` and by `cuobjdump -lelf` 20 cubins ALL `sm_121a` zero sm_75, NOT by `CMakeCache.txt`, whose `CMAKE_CUDA_ARCHITECTURES:STRING=75` is the `enable_language(CUDA)` compiler-probe default shadowed by the normal variable at `CMakeLists.txt:186` - the prior wrong-arch conclusion was that decoy): dgx.casa GB10 under `flock $HOME/gpu.lock`, 35B A3B NVFP4 GGUF, **2/2 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, 13 proposed / 11 accepted, 90.2 GiB peak RSS, 8m01s; re-run on the EXACT committed source **3/3 cases, 10/10 assertions, exit 0**, 7m25s, the new probe case SKIPping and adding zero assertions. **The CPU-vs-GPU token delta is a MEASURED near-tie, not a defect** (it was never this row's bar - spec-ON == spec-OFF WITHIN a device is): NEW double-gated spec-OFF-only probe `tests/parity/test_qwen35_gguf_spec_decode.cpp:217` (asset + `VLLM_MTP_GGUF_PROBE=1`, 20 alternatives per position, 484/484 assertions per arm, GPU then `CUDA_VISIBLE_DEVICES=` in one `flock` series) shows both arms picking `11751` at position 0 and forking at position 1 on a BIT-IDENTICAL prefix: GPU rank1 `13` -0.773180 over rank2 `11` -0.847055 (margin 0.0739 nats), CPU rank1 `11` -0.765499 over rank2 `13` -0.830374 (margin 0.0649 nats). Each device's pick is the other's rank 2, both ~7x inside the ratified 0.5-nat band, and the cross-device disagreement on the SAME token (0.057 and 0.082 nats) EXCEEDS the margin being decided, so rounding settles it; the 24 texts look unrelated only because positions 2+ cascade off that one coin flip. Margin sweep over all 24 positions: **GGUF GPU and GGUF CPU carry ZERO exact ties**, minimum margins 0.0482 and 0.0649 nats, and both arms reproduced their sequence across every run. **Gate 4 MET on the safetensors sibling of the same quantization run** (`FromModelDir` takes it unchanged): acceptance 12 proposed / 11 accepted vs the GGUF's 13 / 11. That arm, however, FAILS spec-ON == spec-OFF at concurrency 1 and does not reproduce its own spec-OFF sequence run to run, and the probe attributes both to THREE EXACT ties (positions 7, 10, 16, bit-identical logprobs) produced by its 1/16-grid quantized-GEMM logits - which EXONERATES the GGUF arm and opens a recorded, not-root-caused `SPEC-MTP` item on the safetensors NVFP4 path, not on this row. Gate 3 is NOT APPLICABLE twice over: no F16/F32 head-carrying export exists, and the only same-weights sibling is not token-stable against itself. **EVIDENCE RE-ANCHORED 2026-07-29 to a PRODUCTION-CONFIGURED build, because every GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`** (the defect `CLAIM-27B-GATE-RCA` proved, which runs the emulation fp4 GEMM + hand GDN kernels). Re-run from a clean `git archive` tree of `main` `3f34534d`, build proven correct three ways (configure log has ZERO `CUTLASS not found` and prints `CUTLASS found ... sm120a NVFP4 cutlass GEMM` + `FlashAttention-2 ... ENABLED for arch(es) [121a]` + the vendored `sm_121a` Triton-AOT lines with `MANIFEST hashes OK`; `cuobjdump -lelf` 40 cubins ALL `sm_121a`, zero `sm_75`; SACRED `test_qwen27_paged_engine` **235/235 exit 0**, and the build precondition proven to FIRE by recompiling only that TU without the two defines against the same `libvllm.a`, which throws and exits 1 with 0 assertions). **The row PASSES UNCHANGED:** `tests/parity/test_qwen35_gguf_spec_decode` **3/3 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, **13 proposed / 11 accepted (identical to the recorded number)**, 90.26 GiB, 7m13.59s; loader gate 19 assertions on the Qwen3.5-2B and 18 on the 35B A3B, unchanged. **ONE recorded finding is RETRACTED by the re-measurement: the CPU-vs-GPU token delta was a BUILD artifact, not a device near-tie cascade.** On the production build both devices emit the SAME 24 tokens; the probe shows GPU rank1 `11` -0.763897 over rank2 `13` -0.824083 where the defective build had rank1 `13` -0.773180 over rank2 `11` -0.847055, while the CPU arm is bit-identical to the earlier measurement (CUTLASS and Triton are CUDA-only). Zero exact ties in either arm, min margins 0.060186 GPU / 0.064875 CPU, 484/484 assertions per arm. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md) | [specs/gguf-mtp-spec-decode.md](specs/gguf-mtp-spec-decode.md) | `DONE` | `edf91449` | -| `SPEC-DFLASH-GGUF` | DFlash speculative decoding from GGUF, two axes: (A) GGUF DRAFT + safetensors target, (B) GGUF target too. llama.cpp master carries a full `dflash` GGUF contract (arch string `dflash`, tensors `fc`/`enc.output_norm`/`output_norm`/`blk.N.*`, KVs `dflash.target_layers` + `dflash.target_hidden_size`); the arch is ABSENT from checkouts older than ~2026-07, so a stale tree reads as "no contract exists". The GGUF tensor set omits `token_embd`/`output` because the draft SHARES the target's embed+lm_head, which is exactly what `LoadDflashDraft` already does. Blockers are in the loader, not the model: `MakeDflashDraftConfig` reads `draft_dir/config.json` (a GGUF has none), `ResolveDflashDraftDir` probes for `config.json` so it cannot see a `.gguf`, and `LoadDflashDraft` is typed on `std::vector` for the shared bf16 head (the axis-B blocker). Axis A independently shippable. NO ABI change | T2 | llama.cpp `origin/master` @ 2026-07-28 (tag era `b10158`): `gguf-py/gguf/constants.py:547,1151,4350`; `gguf-py/gguf/tensor_mapping.py:1297-1305` (`ENC_OUTPUT_NORM`<-`model.hidden_norm`, `FC`<-`model.fc`); `conversion/qwen.py:351` (mask token via the standard tokenizer KV); `convert_hf_to_gguf.py --target-model-dir` | **GD1-GD7 LANDED 2026-07-28 (BOTH AXES COMPLETE and PROVEN end to end on GB10)**: `MakeDflashGgufConfig` + `LoadQwen3DFlashFromGguf` `src/vllm/model_executor/models/qwen3_dflash_gguf.cpp:88,227` (+ header), `IsDflashGgufDraft` + the `.gguf` branch in `ResolveDflashDraftDir`/`LoadDflashDraft` `src/vllm/entrypoints/model_loader.cpp:121,222`. Goes through the `TensorResolver` seam (unlike `SPEC-MTP-GGUF`) because dflash norms are RAW, so the existing `LoadQwen3DFlash` qkv/gate_up concatenation is reused unchanged. **`GD4` defect FIXED** (`model_loader.cpp:238-249`): the GGUF branch left `config.vocab_size` 0 - correct for `MakeDflashGgufConfig` (the DFLASH arch has no vocab KV and no `token_embd`) but fatal for the forward, which sizes the shared embedding view as `{config.vocab_size, H}`, so the first propose threw `cuda embedding: empty table (vocab 0)`. Now back-filled from the target's `embed_tokens` rows (the condition is on the VALUE, not the draft source, so it generalizes to a GGUF target). Load-level green had hidden it; only GENERATING found it. **GD5-GD7 = axis B**: `SharedHeadSource` `src/vllm/entrypoints/model_loader.cpp` re-expresses the shared bf16 `embed_tokens`+`lm_head` seam as a SOURCE and re-types `LoadDflashDraft`'s second parameter - THAT TYPE was the whole axis-B blocker - with the GGUF arm `LoadGgufSharedEmbedAndHeadBf16` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1067` reusing the trunk loader's tied-embedding rule and sidecar-aware dequant instead of restating them; the shared-head load moved into ONE common tail so all four (draft format x target container) combinations run identical code; the `dflash` half of the GGUF-branch rejection `model_loader.cpp` is deleted (the `mtp` half untouched) and the draft load is wired into the GGUF branch | `tests/vllm/models/test_qwen3_dflash_gguf.cpp:36,84` 2 cases / 47 assertions against the REAL published Qwen3.6-27B DFlash draft (env-gated `VLLM_DFLASH_GGUF_MODEL`, CI asset-free): the +1 target-layer offset undone against the KV read back from the same file, block_size/mask_token present, vocab_size left 0, layer_types cover every block, fc `[H, H*num_taps]` with `nk` SET, qkv/gate_up row-concat shapes, embed/lm_head left EMPTY for the target. **RED-first BEHAVIOURAL** (dropping the `-1` fails the offset checks). **`GD4` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp:343` (second case, draft source env-driven via `VLLM_DFLASH_DRAFT`/`_B`; asset-gated, CI-inert): on dgx GB10 sm_121a against the Qwen3.6-27B NVFP4 safetensors target, the Q4_K_M GGUF draft and the bf16 z-lab safetensors draft produce **token-for-token IDENTICAL** DFlash-ON continuations with **IDENTICAL** accepted/proposed (20/80 on a 24-token prompt, 42/96 on a 48-token prompt), spec-OFF self-reproducible 3/3 and 0 exact ties (min margin 0.197/0.400 nats). Regression: gguf_mtp 19, qwen35_gguf_spec_decode 10, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, ops_gdn 1825, llm_engine 196, capi 232, runner 257 all unchanged. **`GD5` unit gate** `tests/vllm/test_gguf_qwen36_loader.cpp` 3 new synthetic-GGUF cases (6 cases / 286 assertions total, CPU and the dgx CUDA build): the untied head really comes from `output.weight` and not the embedding (distinct fill values), the tied fallback aliases it onto `token_embd`, the `nk` flags separate the gather table from the MatmulBT weight, a file with no `token_embd` is refused. 3-mutant battery, 3 caught (`nk` flipped, head forced to the embedding, tied forced false). **`GD7` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp` third case (targets env-driven via `VLLM_DFLASH_TARGET_B`; asset-gated, CI-inert): on dgx GB10 sm_121a the Qwen3.6-27B NVFP4 **GGUF** target + `Q4_K_M` GGUF draft loads, takes the shared head from the GGUF, generates, and its DFlash-ON continuation is **token-for-token IDENTICAL to that same target's spec-OFF** (24/24, the STRICT form) with acceptance ALIVE at 14/160; 1 case / 15 assertions, exit 0. **The spike's highest risk is EMPTY on this asset, proven not assumed**: the 27B NVFP4 GGUF stores `token_embd`/`output` as ggml BF16, byte-identical to the safetensors sibling (2,542,796,800 bytes each, ZERO differing), so B1's shared-head read is verbatim, not a dequant. Acceptance IS lower than the safetensors-target arm and is NOT chargeable to the head: the two containers diverge at index 4 with NO speculation, because `QUANT-GGUF-NVFP4` is dequant-only so the GGUF target computes in bf16 while the safetensors target runs the true W4A4 kernels. **RE-MEASURED 2026-07-29 on a PRODUCTION-CONFIGURED build (`CLAIM-GGUF-SPEC-REVERIFY`), because every GD4/GD7 GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`.** Build proven correct three ways (see the `SPEC-MTP-GGUF` row; SACRED 27B **235/235**, `cuobjdump` 40 cubins all `sm_121a`). **AXIS B HOLDS EXACTLY**: `test_qwen27_dflash_spec_decode -tc="dflash axis-B*"` **15/15 assertions, exit 0**, GGUF-target DFlash-ON token-identical to that target's own spec-OFF 24/24, acceptance **14/160 unchanged**, cross-target spec-OFF divergence still at index 4, 81.01 GiB peak RSS, 6m53.08s. **AXIS A WAS RED ON THE 48-TOKEN PROMPT (reproducibly, 3 of 3 runs) AND IS NOW CLOSED.** The RED was real: cross-format TOKEN identity held on both prompts, but the exact accept-count half of bar (a) failed (`arm_a.proposed == arm_b.proposed` / `arm_a.accepted == arm_b.accepted`) because the Q4_K_M draft measured **46/112** against the bf16 z-lab draft's **47/96** (one extra 16-wide propose block, one fewer acceptance, zero token difference), 15/17, exit 1; the 24-token prompt stayed green at 17/17 with both drafts at 15/144. **`GD9` 2026-07-29 root-caused it IN WEIGHT SPACE as ordinary `Q4_K_M` cost, category (a), not a defect in our GGUF draft path - and the bar's own premise ("Same weights, two containers") was false for the asset it was pointed at.** The publishing repo also carries an UNQUANTIZED `BF16` GGUF (3,471,497,440 B) beside `Q8_0`/`Q6_K`/`Q5_K`/`Q4_K_M`, which the spec had recorded as nonexistent; that retired the `NOT APPLICABLE` on gate 2. CPU gate `tests/vllm/models/test_qwen3_dflash_gguf.cpp` third case (asset-gated `VLLM_DFLASH_GGUF_BF16_MODEL` + `VLLM_DFLASH_ST_DIR`): `LoadQwen3DFlashFromGguf(BF16)` is **BYTE-IDENTICAL to `LoadQwen3DFlash(z-lab shards)` on all 58 tensors, 302/302 assertions, exit 0**, and FUNCTIONALLY RED against the `Q4_K_M` file (21/302 red, exactly the 21 quantized matmul tensors), so not a vacuous pass. Supporting: our `DequantGgufRowToBf16` is bit-equal to `gguf-py`'s `gguf.quants.dequantize` on the real `fc.weight` (Q4_K), `blk.0.attn_q.weight` (Q4_K) and `blk.2.ffn_down.weight` (Q6_K), zero differing bf16 values; the ladder's mean relative weight error is monotone and uniform with NO outlier tensor (BF16 0, Q8_0 5.6e-3, Q6_K 1.85e-2, Q5_K 3.85e-2, Q4_K_M 7.6e-2); the only numeric config delta is `rms_norm_eps` at 2.5e-9 relative. Also landed: an off-by-default `VT_SPEC_TRACE=1` per-block propose/accept trace in `GPUModelRunner::sample_tokens_with_rejection` (`src/vllm/v1/worker/gpu/runner.cpp`). **`GD10` 2026-07-29 CONFIRMED IT END TO END ON GB10 and closed gates 3 and 5.** Build proven production-configured three ways (configure log 0 `CUTLASS not found`; `cuobjdump -lelf` 40 cubins ALL `sm_121a` zero `sm_75` on both binaries; SACRED `test_qwen27_paged_engine` **235/235, exit 0**, 31.34s, 23.67 GiB). The **`BF16` GGUF draft reads EXACTLY 47/96**, the safetensors draft's own number, at 48 tokens on the discriminating prompt - reproduced 2 of 2 - plus 27/64 = 27/64 at 24 tokens and 15/144 = 15/144 on the second prompt, tokens IDENTICAL throughout, 17/17 exit 0 each time; the `Q4_K_M` arm reads 46/112 on the SAME binary in the SAME `flock` series. Restoring only the draft's numeric precision restores the count, so quantization is the whole cause and nothing structural survives. Bar (a) is consequently SPLIT rather than relaxed (`tests/parity/test_qwen27_dflash_spec_decode.cpp`): tokens stay EXACT unconditionally; accept counts are EXACT on a cross-FORMAT arm and BANDED (`abs(d_accepted) <= 2`, `abs(d_proposed) <= k*2`) on a cross-QUANTIZATION one, with the arm chosen by `IsQuantizedGgufDraft` reading the draft file's ggml types (`GgmlTraits().block_elems > 1`) rather than by a flag. The band is derived, not picked: measured `d_accepted` is 0, 0, -1, so the bound is that maximum plus one quantum; and `d_proposed = -k * d_accepted` EXACTLY once the token streams match (confirmed at -1 / +16), so the proposed bound follows. **Mutation-proved non-vacuous**: rebuilt at band 0 the `Q4_K_M` arm is 15/17 exit 1 while the `BF16` arm stays 17/17 exit 0 on the exact branch. **AXIS B BROADENED from ONE prompt to THREE**, strict form green on all: "The capital of France is" IDENTICAL 14/160 (15/15), "Write a Python function that reverses a string:" IDENTICAL 24/64 (15/15), "Photosynthesis is the process by which" IDENTICAL 15/128 (9/9), all exit 0, ~6m30-6m52 and ~81 GiB peak RSS each. The second prompt REFINES the recorded acceptance claim: the safetensors-target arm is ALSO 24/64 there with the two containers' DFlash-ON streams IDENTICAL, so the GGUF target's lower acceptance is prompt-dependent (their spec-OFF streams diverge at index 4 on the first prompt, index 16 on the second) and not a standing penalty; the cause remains `QUANT-GGUF-NVFP4` being dequant-only, with the shared head excluded by a byte comparison. Gates 1-5 and 7 MET; gate 6 (speed) `PENDING` BY DESIGN and not owed - a DFlash-ON throughput A/B between the two target containers is not a fair comparison until a native NVFP4 GGUF GEMM exists. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md#L845) | [specs/gguf-dflash-draft.md](specs/gguf-dflash-draft.md) | `DONE` | `c62f2fa3` | +| `SPEC-MTP-GGUF` | MTP speculative decoding from a GGUF TARGET. Today `FromModelDir` refuses `mtp`+GGUF outright (`src/vllm/entrypoints/model_loader.cpp:717-723`) on the original spike's assumption that GGUF exports carry no `mtp.*` ([mtp-spec-decode.md](specs/mtp-spec-decode.md):979-980, "until we re-export GGUFs with the head"). That is stale: llama.cpp's Qwen3.5 converter DOES emit the head, under layer-indexed `nextn` naming, and our own `HfConfigFromGguf` ALREADY reads `nextn_predict_layers` (it just discards the value into the trunk layer count). Gap is a `TensorResolver` over `GgufFile` mapping `mtp.*` onto `blk.{L+i}.nextn.*` with dequant-to-bf16, one config field, and narrowing the rejection to `dflash`. `ngram`+GGUF already works and is untouched. Qwen3.5/3.6 only (the widened spec KV path serves no other arch). NO ABI change | T2 | llama.cpp (the producer contract; vLLM has no GGUF MTP path) `conversion/qwen.py:535-604` `_Qwen35MtpMixin` (the authoritative `mtp.*`->`nextn` remapper + `add_nextn_predict_layers`); `gguf-py/gguf/constants.py:129,910-917,1494-1501`; `gguf-py/gguf/tensor_mapping.py` `NEXTN_*` | **G1-G3 LANDED 2026-07-28.** `HfConfigFromGguf` republishes the head depth `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:598` (`c.raw["mtp_num_hidden_layers"] = nextn`, previously read then discarded); the head loader `LoadQwen3_5MTPFromGguf` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1609` (+ decl `include/vllm/model_executor/models/qwen3_5_gguf_weights.h:143`) reusing the TRUNK helpers `OwnNormMinus1`/`OwnMatmulWeight`/`OwnBf16`/`LoadAttnGguf`/`LoadMoeGguf` so the head inherits the GGUF (w+1) norm storage, quantization/residency routing and torch [N,K] shapes; `NumMtpLayers`/`UsesDedicatedEmbeddings` exported out of the anon namespace `include/vllm/model_executor/models/qwen3_5_mtp.h`; rejection narrowed to dflash + a head-less-GGUF check `src/vllm/entrypoints/model_loader.cpp` and the head attached in the GGUF branch; **G4 GREEN + `CPU-SPEC-DIVERGENCE` FIXED 2026-07-28**: root cause `src/vllm/model_executor/models/qwen3_5.cpp:3616` sized the GDN state gather/scatter row by `(Kw-1)` while the speculative persistent row is `(Kw-1)+num_spec`, so `GatherRows`/`ScatterRows` mis-strode the slot AND every channel past the first, corrupting post-prefill recurrent state. Fix = `CopyStateRowsStrided` (same TU) used by `GatherStateF32`/`ScatterStateF32` when `cache.shape[2] != work.shape[2]`; the contiguous helpers are kept when the widths agree, so every non-spec path is byte-identical by construction. CPU-only in effect (the fp16/bf16 arm routes through the `GdnStateGather`/`Scatter` ops, so CUDA was never exposed; no GPU result affected) | `tests/vllm/models/test_qwen3_5_gguf_mtp.cpp:109,146,156,184` **4 cases, and the split is the 2026-08-21 repair** ([#1454](https://github.com/mudler/vllm.cpp/issues/1454)): the file used to be the env-gated pair ALONE, each opening on a bare `return`, so with `VLLM_MTP_GGUF_MODEL` unset it reported `test cases: 2 \| 2 passed`, **`assertions: 0`**, `Status: SUCCESS!`, exit 0 - which is every CI run of this repository, the variable being set nowhere in `.github/workflows/`. The `18 assertions` this cell used to record was the LIVE count and was never once reached in CI. Now `:109` and `:146` are **HERMETIC** (KV-only synthetic GGUFs, no weight bytes, 18 assertions on any machine) and pin the arithmetic the old file only NAMED in a comment above `CHECK(c.num_hidden_layers > 0)`: `num_hidden_layers + mtp_num_hidden_layers == block_count` over 65/1, 25/1 and 28/3 - the third arm separating `- nextn` from `- 1` - plus the head-less arm, where the key is NOT published and `NumMtpLayers` answering 1 for an absent key is exactly why the invariant cannot be written with that helper alone. `:156` and `:184` stay env-gated on `VLLM_MTP_GGUF_MODEL` (so CI stays asset-free) and now SKIP LOUDLY with a `MESSAGE` naming the variable, as `tests/vllm/entrypoints/test_gguf_mmproj_reach.cpp` does; `:156` re-derives the same invariant from the file's OWN `block_count` kv. Unset: **4 cases / 18 assertions / `Status: SUCCESS!` / rc 0**. Live on `Qwen3.8-27B-Q4_K_M.gguf` (`block_count` 65, `nextn_predict_layers` 1): **4 cases / 38 assertions / `Status: SUCCESS!` / rc 0**. Mutation-proved on the production line `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:889`, both compiling clean and both restored against a pre-taken sha256: `= block_count` (drop the subtraction) 3/4 cases, 9/18 red, exit 1; `= block_count - 1` (the wrong constant) 2/4 cases, 5/18 red, exit 1. The SAME mutations left the PREVIOUS file at 2/2 cases, 0 assertions, `SUCCESS!`, exit 0. Correctness of the production line is unchanged and was never in question (`1a4db5c3c`, `493327b4e`); this was a test defect. Live-arm content unchanged: depth reaches config.raw; fc is [H,2H] verbatim; 3 norms [H]; head block is full-attention. **RED-first BEHAVIOURAL** (reverting only the G1 line fails both cases 2/2). Trunk inertness: `test_gguf` 103, `test_gguf_qwen36_loader` 99, `test_gguf_keep_quant` 5958, `test_gguf_dequant` 215, `test_capi` 33/232 all unchanged; `tests/parity/test_qwen35_gguf_spec_decode.cpp:74,139` - spec-ON == spec-OFF token-exact with 13 proposed/11 accepted, plus an `ngram` regression guard (widens the cache, never runs the spec conv update) that was token-exact throughout and pinned the widening as innocent. Regression sweep all unchanged: ops_gdn 1825, gdn_metadata_builder 483, gdn_prefill_conv 28, gdn_spec_routing 12, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, gguf_dequant 215, llm_engine 196, input_batch 163, runner 257, capi 232 **GPU CLOSE-OUT + DEVICE-DELTA ATTRIBUTION 2026-07-28 (`G5`-`G7`), ledger [parity-ledger.md#L800](parity-ledger.md#L800).** The GPU end-to-end gate re-run on a from-scratch RELEASE-TARGET build (`-DVLLM_CPP_CUDA_ARCHITECTURES=121a`, build dir DELETED first; arch VERIFIED by `build-cuda/CMakeFiles/vllm.dir/flags.make` `--generate-code=arch=compute_121a,code=[compute_121a,sm_121a]` and by `cuobjdump -lelf` 20 cubins ALL `sm_121a` zero sm_75, NOT by `CMakeCache.txt`, whose `CMAKE_CUDA_ARCHITECTURES:STRING=75` is the `enable_language(CUDA)` compiler-probe default shadowed by the normal variable at `CMakeLists.txt:186` - the prior wrong-arch conclusion was that decoy): dgx.casa GB10 under `flock $HOME/gpu.lock`, 35B A3B NVFP4 GGUF, **2/2 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, 13 proposed / 11 accepted, 90.2 GiB peak RSS, 8m01s; re-run on the EXACT committed source **3/3 cases, 10/10 assertions, exit 0**, 7m25s, the new probe case SKIPping and adding zero assertions. **The CPU-vs-GPU token delta is a MEASURED near-tie, not a defect** (it was never this row's bar - spec-ON == spec-OFF WITHIN a device is): NEW double-gated spec-OFF-only probe `tests/parity/test_qwen35_gguf_spec_decode.cpp:217` (asset + `VLLM_MTP_GGUF_PROBE=1`, 20 alternatives per position, 484/484 assertions per arm, GPU then `CUDA_VISIBLE_DEVICES=` in one `flock` series) shows both arms picking `11751` at position 0 and forking at position 1 on a BIT-IDENTICAL prefix: GPU rank1 `13` -0.773180 over rank2 `11` -0.847055 (margin 0.0739 nats), CPU rank1 `11` -0.765499 over rank2 `13` -0.830374 (margin 0.0649 nats). Each device's pick is the other's rank 2, both ~7x inside the ratified 0.5-nat band, and the cross-device disagreement on the SAME token (0.057 and 0.082 nats) EXCEEDS the margin being decided, so rounding settles it; the 24 texts look unrelated only because positions 2+ cascade off that one coin flip. Margin sweep over all 24 positions: **GGUF GPU and GGUF CPU carry ZERO exact ties**, minimum margins 0.0482 and 0.0649 nats, and both arms reproduced their sequence across every run. **Gate 4 MET on the safetensors sibling of the same quantization run** (`FromModelDir` takes it unchanged): acceptance 12 proposed / 11 accepted vs the GGUF's 13 / 11. That arm, however, FAILS spec-ON == spec-OFF at concurrency 1 and does not reproduce its own spec-OFF sequence run to run, and the probe attributes both to THREE EXACT ties (positions 7, 10, 16, bit-identical logprobs) produced by its 1/16-grid quantized-GEMM logits - which EXONERATES the GGUF arm and opens a recorded, not-root-caused `SPEC-MTP` item on the safetensors NVFP4 path, not on this row. Gate 3 is NOT APPLICABLE twice over: no F16/F32 head-carrying export exists, and the only same-weights sibling is not token-stable against itself. **EVIDENCE RE-ANCHORED 2026-07-29 to a PRODUCTION-CONFIGURED build, because every GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`** (the defect `CLAIM-27B-GATE-RCA` proved, which runs the emulation fp4 GEMM + hand GDN kernels). Re-run from a clean `git archive` tree of `main` `3f34534d`, build proven correct three ways (configure log has ZERO `CUTLASS not found` and prints `CUTLASS found ... sm120a NVFP4 cutlass GEMM` + `FlashAttention-2 ... ENABLED for arch(es) [121a]` + the vendored `sm_121a` Triton-AOT lines with `MANIFEST hashes OK`; `cuobjdump -lelf` 40 cubins ALL `sm_121a`, zero `sm_75`; SACRED `test_qwen27_paged_engine` **235/235 exit 0**, and the build precondition proven to FIRE by recompiling only that TU without the two defines against the same `libvllm.a`, which throws and exits 1 with 0 assertions). **The row PASSES UNCHANGED:** `tests/parity/test_qwen35_gguf_spec_decode` **3/3 cases, 10/10 assertions, exit 0**, spec-ON token-identical to spec-OFF, **13 proposed / 11 accepted (identical to the recorded number)**, 90.26 GiB, 7m13.59s; loader gate 19 assertions on the Qwen3.5-2B and 18 on the 35B A3B, unchanged. **ONE recorded finding is RETRACTED by the re-measurement: the CPU-vs-GPU token delta was a BUILD artifact, not a device near-tie cascade.** On the production build both devices emit the SAME 24 tokens; the probe shows GPU rank1 `11` -0.763897 over rank2 `13` -0.824083 where the defective build had rank1 `13` -0.773180 over rank2 `11` -0.847055, while the CPU arm is bit-identical to the earlier measurement (CUTLASS and Triton are CUDA-only). Zero exact ties in either arm, min margins 0.060186 GPU / 0.064875 CPU, 484/484 assertions per arm. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md) | [specs/gguf-mtp-spec-decode.md](specs/gguf-mtp-spec-decode.md) | `DONE` | `edf91449` | +| `SPEC-DFLASH-GGUF` | DFlash speculative decoding from GGUF, two axes: (A) GGUF DRAFT + safetensors target, (B) GGUF target too. llama.cpp master carries a full `dflash` GGUF contract (arch string `dflash`, tensors `fc`/`enc.output_norm`/`output_norm`/`blk.N.*`, KVs `dflash.target_layers` + `dflash.target_hidden_size`); the arch is ABSENT from checkouts older than ~2026-07, so a stale tree reads as "no contract exists". The GGUF tensor set omits `token_embd`/`output` because the draft SHARES the target's embed+lm_head, which is exactly what `LoadDflashDraft` already does. Blockers are in the loader, not the model: `MakeDflashDraftConfig` reads `draft_dir/config.json` (a GGUF has none), `ResolveDflashDraftDir` probes for `config.json` so it cannot see a `.gguf`, and `LoadDflashDraft` is typed on `std::vector` for the shared bf16 head (the axis-B blocker). Axis A independently shippable. NO ABI change | T2 | llama.cpp `origin/master` @ 2026-07-28 (tag era `b10158`): `gguf-py/gguf/constants.py:547,1151,4350`; `gguf-py/gguf/tensor_mapping.py:1297-1305` (`ENC_OUTPUT_NORM`<-`model.hidden_norm`, `FC`<-`model.fc`); `conversion/qwen.py:351` (mask token via the standard tokenizer KV); `convert_hf_to_gguf.py --target-model-dir` | **GD1-GD7 LANDED 2026-07-28 (BOTH AXES COMPLETE and PROVEN end to end on GB10)**: `MakeDflashGgufConfig` + `LoadQwen3DFlashFromGguf` `src/vllm/model_executor/models/qwen3_dflash_gguf.cpp:88,227` (+ header), `IsDflashGgufDraft` + the `.gguf` branch in `ResolveDflashDraftDir`/`LoadDflashDraft` `src/vllm/entrypoints/model_loader.cpp:121,222`. Goes through the `TensorResolver` seam (unlike `SPEC-MTP-GGUF`) because dflash norms are RAW, so the existing `LoadQwen3DFlash` qkv/gate_up concatenation is reused unchanged. **`GD4` defect FIXED** (`model_loader.cpp:238-249`): the GGUF branch left `config.vocab_size` 0 - correct for `MakeDflashGgufConfig` (the DFLASH arch has no vocab KV and no `token_embd`) but fatal for the forward, which sizes the shared embedding view as `{config.vocab_size, H}`, so the first propose threw `cuda embedding: empty table (vocab 0)`. Now back-filled from the target's `embed_tokens` rows (the condition is on the VALUE, not the draft source, so it generalizes to a GGUF target). Load-level green had hidden it; only GENERATING found it. **GD5-GD7 = axis B**: `SharedHeadSource` `src/vllm/entrypoints/model_loader.cpp` re-expresses the shared bf16 `embed_tokens`+`lm_head` seam as a SOURCE and re-types `LoadDflashDraft`'s second parameter - THAT TYPE was the whole axis-B blocker - with the GGUF arm `LoadGgufSharedEmbedAndHeadBf16` `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:1085` reusing the trunk loader's tied-embedding rule and sidecar-aware dequant instead of restating them; the shared-head load moved into ONE common tail so all four (draft format x target container) combinations run identical code; the `dflash` half of the GGUF-branch rejection `model_loader.cpp` is deleted (the `mtp` half untouched) and the draft load is wired into the GGUF branch | `tests/vllm/models/test_qwen3_dflash_gguf.cpp:36,84` 2 cases / 47 assertions against the REAL published Qwen3.6-27B DFlash draft (env-gated `VLLM_DFLASH_GGUF_MODEL`, CI asset-free): the +1 target-layer offset undone against the KV read back from the same file, block_size/mask_token present, vocab_size left 0, layer_types cover every block, fc `[H, H*num_taps]` with `nk` SET, qkv/gate_up row-concat shapes, embed/lm_head left EMPTY for the target. **RED-first BEHAVIOURAL** (dropping the `-1` fails the offset checks). **`GD4` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp:343` (second case, draft source env-driven via `VLLM_DFLASH_DRAFT`/`_B`; asset-gated, CI-inert): on dgx GB10 sm_121a against the Qwen3.6-27B NVFP4 safetensors target, the Q4_K_M GGUF draft and the bf16 z-lab safetensors draft produce **token-for-token IDENTICAL** DFlash-ON continuations with **IDENTICAL** accepted/proposed (20/80 on a 24-token prompt, 42/96 on a 48-token prompt), spec-OFF self-reproducible 3/3 and 0 exact ties (min margin 0.197/0.400 nats). Regression: gguf_mtp 19, qwen35_gguf_spec_decode 10, gguf 103, gguf_qwen36_loader 99, gguf_keep_quant 5958, ops_gdn 1825, llm_engine 196, capi 232, runner 257 all unchanged. **`GD5` unit gate** `tests/vllm/test_gguf_qwen36_loader.cpp` 3 new synthetic-GGUF cases (6 cases / 286 assertions total, CPU and the dgx CUDA build): the untied head really comes from `output.weight` and not the embedding (distinct fill values), the tied fallback aliases it onto `token_embd`, the `nk` flags separate the gather table from the MatmulBT weight, a file with no `token_embd` is refused. 3-mutant battery, 3 caught (`nk` flipped, head forced to the embedding, tied forced false). **`GD7` e2e gate** `tests/parity/test_qwen27_dflash_spec_decode.cpp` third case (targets env-driven via `VLLM_DFLASH_TARGET_B`; asset-gated, CI-inert): on dgx GB10 sm_121a the Qwen3.6-27B NVFP4 **GGUF** target + `Q4_K_M` GGUF draft loads, takes the shared head from the GGUF, generates, and its DFlash-ON continuation is **token-for-token IDENTICAL to that same target's spec-OFF** (24/24, the STRICT form) with acceptance ALIVE at 14/160; 1 case / 15 assertions, exit 0. **The spike's highest risk is EMPTY on this asset, proven not assumed**: the 27B NVFP4 GGUF stores `token_embd`/`output` as ggml BF16, byte-identical to the safetensors sibling (2,542,796,800 bytes each, ZERO differing), so B1's shared-head read is verbatim, not a dequant. Acceptance IS lower than the safetensors-target arm and is NOT chargeable to the head: the two containers diverge at index 4 with NO speculation, because `QUANT-GGUF-NVFP4` is dequant-only so the GGUF target computes in bf16 while the safetensors target runs the true W4A4 kernels. **RE-MEASURED 2026-07-29 on a PRODUCTION-CONFIGURED build (`CLAIM-GGUF-SPEC-REVERIFY`), because every GD4/GD7 GPU number above came from a build configured WITHOUT `-DVLLM_CPP_CUTLASS_DIR` and WITHOUT `-DVLLM_CPP_TRITON=ON`.** Build proven correct three ways (see the `SPEC-MTP-GGUF` row; SACRED 27B **235/235**, `cuobjdump` 40 cubins all `sm_121a`). **AXIS B HOLDS EXACTLY**: `test_qwen27_dflash_spec_decode -tc="dflash axis-B*"` **15/15 assertions, exit 0**, GGUF-target DFlash-ON token-identical to that target's own spec-OFF 24/24, acceptance **14/160 unchanged**, cross-target spec-OFF divergence still at index 4, 81.01 GiB peak RSS, 6m53.08s. **AXIS A WAS RED ON THE 48-TOKEN PROMPT (reproducibly, 3 of 3 runs) AND IS NOW CLOSED.** The RED was real: cross-format TOKEN identity held on both prompts, but the exact accept-count half of bar (a) failed (`arm_a.proposed == arm_b.proposed` / `arm_a.accepted == arm_b.accepted`) because the Q4_K_M draft measured **46/112** against the bf16 z-lab draft's **47/96** (one extra 16-wide propose block, one fewer acceptance, zero token difference), 15/17, exit 1; the 24-token prompt stayed green at 17/17 with both drafts at 15/144. **`GD9` 2026-07-29 root-caused it IN WEIGHT SPACE as ordinary `Q4_K_M` cost, category (a), not a defect in our GGUF draft path - and the bar's own premise ("Same weights, two containers") was false for the asset it was pointed at.** The publishing repo also carries an UNQUANTIZED `BF16` GGUF (3,471,497,440 B) beside `Q8_0`/`Q6_K`/`Q5_K`/`Q4_K_M`, which the spec had recorded as nonexistent; that retired the `NOT APPLICABLE` on gate 2. CPU gate `tests/vllm/models/test_qwen3_dflash_gguf.cpp` third case (asset-gated `VLLM_DFLASH_GGUF_BF16_MODEL` + `VLLM_DFLASH_ST_DIR`): `LoadQwen3DFlashFromGguf(BF16)` is **BYTE-IDENTICAL to `LoadQwen3DFlash(z-lab shards)` on all 58 tensors, 302/302 assertions, exit 0**, and FUNCTIONALLY RED against the `Q4_K_M` file (21/302 red, exactly the 21 quantized matmul tensors), so not a vacuous pass. Supporting: our `DequantGgufRowToBf16` is bit-equal to `gguf-py`'s `gguf.quants.dequantize` on the real `fc.weight` (Q4_K), `blk.0.attn_q.weight` (Q4_K) and `blk.2.ffn_down.weight` (Q6_K), zero differing bf16 values; the ladder's mean relative weight error is monotone and uniform with NO outlier tensor (BF16 0, Q8_0 5.6e-3, Q6_K 1.85e-2, Q5_K 3.85e-2, Q4_K_M 7.6e-2); the only numeric config delta is `rms_norm_eps` at 2.5e-9 relative. Also landed: an off-by-default `VT_SPEC_TRACE=1` per-block propose/accept trace in `GPUModelRunner::sample_tokens_with_rejection` (`src/vllm/v1/worker/gpu/runner.cpp`). **`GD10` 2026-07-29 CONFIRMED IT END TO END ON GB10 and closed gates 3 and 5.** Build proven production-configured three ways (configure log 0 `CUTLASS not found`; `cuobjdump -lelf` 40 cubins ALL `sm_121a` zero `sm_75` on both binaries; SACRED `test_qwen27_paged_engine` **235/235, exit 0**, 31.34s, 23.67 GiB). The **`BF16` GGUF draft reads EXACTLY 47/96**, the safetensors draft's own number, at 48 tokens on the discriminating prompt - reproduced 2 of 2 - plus 27/64 = 27/64 at 24 tokens and 15/144 = 15/144 on the second prompt, tokens IDENTICAL throughout, 17/17 exit 0 each time; the `Q4_K_M` arm reads 46/112 on the SAME binary in the SAME `flock` series. Restoring only the draft's numeric precision restores the count, so quantization is the whole cause and nothing structural survives. Bar (a) is consequently SPLIT rather than relaxed (`tests/parity/test_qwen27_dflash_spec_decode.cpp`): tokens stay EXACT unconditionally; accept counts are EXACT on a cross-FORMAT arm and BANDED (`abs(d_accepted) <= 2`, `abs(d_proposed) <= k*2`) on a cross-QUANTIZATION one, with the arm chosen by `IsQuantizedGgufDraft` reading the draft file's ggml types (`GgmlTraits().block_elems > 1`) rather than by a flag. The band is derived, not picked: measured `d_accepted` is 0, 0, -1, so the bound is that maximum plus one quantum; and `d_proposed = -k * d_accepted` EXACTLY once the token streams match (confirmed at -1 / +16), so the proposed bound follows. **Mutation-proved non-vacuous**: rebuilt at band 0 the `Q4_K_M` arm is 15/17 exit 1 while the `BF16` arm stays 17/17 exit 0 on the exact branch. **AXIS B BROADENED from ONE prompt to THREE**, strict form green on all: "The capital of France is" IDENTICAL 14/160 (15/15), "Write a Python function that reverses a string:" IDENTICAL 24/64 (15/15), "Photosynthesis is the process by which" IDENTICAL 15/128 (9/9), all exit 0, ~6m30-6m52 and ~81 GiB peak RSS each. The second prompt REFINES the recorded acceptance claim: the safetensors-target arm is ALSO 24/64 there with the two containers' DFlash-ON streams IDENTICAL, so the GGUF target's lower acceptance is prompt-dependent (their spec-OFF streams diverge at index 4 on the first prompt, index 16 on the second) and not a standing penalty; the cause remains `QUANT-GGUF-NVFP4` being dequant-only, with the shared head excluded by a byte comparison. Gates 1-5 and 7 MET; gate 6 (speed) `PENDING` BY DESIGN and not owed - a DFlash-ON throughput A/B between the two target containers is not a fair comparison until a native NVFP4 GGUF GEMM exists. Evidence: [docs/BENCHMARKS.md](../docs/BENCHMARKS.md) top section, [parity-ledger.md](parity-ledger.md#L845) | [specs/gguf-dflash-draft.md](specs/gguf-dflash-draft.md) | `DONE` | `c62f2fa3` | | `SPEC-REJECTION` | Rejection sampler. **I3 verify half LANDED (2026-07-24)**: per-request logits EXPANSION to `1 + k_i` rows (`StepInputs::cu_num_logits` / `num_draft_tokens_per_req` / expanded `logits_indices`) plus the GREEDY rejection sampler — accept a draft iff it equals the target argmax at its own position, emit the target argmax on the FIRST mismatch and stop, emit the bonus argmax when all `k_i` accept, `num_sampled = accepted + 1`, `num_rejected = k_i - accepted` (feeds I2's `num_computed_tokens` rollback and `InputBatch::num_accepted_tokens`). One additive vt op (`kGreedyRejectionSample`) with a CPU reference and a CUDA two-phase mirror of upstream's row-argmax + one-thread-per-request accept walk. DEFAULT-OFF and INERT: with no `SpeculativeConfig` no drafts are ever scheduled, `cu_num_logits` is `arange(num_reqs+1)`, `logits_indices` is the pre-change array and the runner never enters the rejection branch. STOCHASTIC/Gumbel, block verification, `apply_sampling_params` over the expanded batch, and the spec grammar bitmask stay DEFERRED (M-mtp-3). **I5b DRAFTER PREFILL INPUT-PREP LANDED (2026-07-24, `CLAIM-SPEC-MTP-I5B`)**: the draft-token input splice this row's I3 note deferred to I5 — `vllm::v1::prepare_prefill_inputs` + its `SpecPrefillInputs` output struct shift each request's `input_ids` left one within its query span, splice the just-sampled next token (`num_sampled>0 ? last_sampled[idx_mapping[r]] : next_prefill_tokens[...]`) into the freed slot, `query_len -= num_rejected`, and emit last-token index / query_start_loc / seq_lens + CG padding (mirror `speculator.py:469-588`, k=1 early-exit :236-238). A HOST routine in a NEW spec_decode-tree TU (no new CUDA kernel; mirrors the DEVICE-NEUTRAL `prepare_inputs`/`combine_sampled_and_draft_tokens` family — the DGX runner leaf ports the loop to the Triton kernel at I5d), unit-gated `test_prepare_prefill_inputs` 7 cases / 27 assertions RED-first, DEFAULT-OFF INERT (nothing calls it until I5d), additive by construction. Row stays `ACTIVE` — the e2e greedy token gate (M-mtp-1) is owed before `DONE` | T1 | `vllm/v1/worker/gpu/spec_decode/rejection_sampler.py:43,101-160`; `rejection_sampler_utils.py:524,564-585,628,828-841,846-849,863-1125`; `vllm/v1/worker/gpu/model_runner.py:866-898,1065-1077`; `vllm/v1/worker/gpu/input_batch.py:303-397,408-453`; **I5b** `vllm/v1/worker/gpu/spec_decode/autoregressive/speculator.py:469-588,236-238` | `include/vllm/v1/spec_decode/rejection_sampler.h`; `src/vllm/v1/spec_decode/rejection_sampler.cpp`; `include/vt/ops.h` (`kGreedyRejectionSample`, `vt::GreedyRejectionSample`); `src/vt/cpu/cpu_sample.cpp` (CPU reference); `src/vt/cuda/cuda_sample.cu` (`RejectionRowArgmaxKernel` + `GreedyRejectAcceptKernel`); `src/vt/ops.cpp`; `include/vllm/v1/worker/gpu/prepare_inputs.h` + `src/vllm/v1/worker/gpu/prepare_inputs.cpp` (the expansion); `include/vllm/v1/worker/gpu/runner.h` + `src/vllm/v1/worker/gpu/runner.cpp` (`step_num_logits`, `sample_tokens_with_rejection`); **I5b** `include/vllm/v1/worker/gpu/spec_decode/autoregressive/prepare_prefill_inputs.h` + `src/vllm/v1/worker/gpu/spec_decode/autoregressive/prepare_prefill_inputs.cpp` — anchor `include/vllm/v1/spec_decode/rejection_sampler.h:96` | `tests/vllm/v1/spec_decode/test_rejection_sampler.cpp`; `tests/vllm/v1/worker/test_prepare_inputs.cpp` (expansion + no-draft byte-identity); `tests/vt/test_cuda_ops.cpp` (CUDA==CPU bit-exact at vocab 248320); **I5b** `tests/vllm/v1/spec_decode/test_prepare_prefill_inputs.cpp` (7 cases / 27 assertions, RED-first) — anchor `tests/vllm/v1/spec_decode/test_rejection_sampler.cpp:128` | [mtp-spec-decode.md §2.4,§5](specs/mtp-spec-decode.md) | `ACTIVE` | `CLAIM-SPEC-REJECTION-I3`, `CLAIM-SPEC-MTP-I5B` | | `SPEC-GDN-SEGMENTS` | GDN speculative metadata and slot-snapshot rollback. **I4 LANDED (2026-07-24):** the spec/non-spec metadata split with decode→prefill reclassification (the #34845 case), the `T>1`/`IS_SPEC` GDN recurrence with per-timestep state snapshots, the conv sliding window advancing by the ACCEPTED count, and the k+1 state-slot allocation. DEFAULT-OFF and INERT (`num_spec==0` ⇒ `num_spec_decodes==0`, no shipped kernel branched — both spec kernels are NEW op ids). ROLLBACK PROVEN bit-exact: for every rejection point j the surviving SSM state and conv window are memcmp-identical to running only the accepted prefix through the shipped `vt::GdnDecode`/`CausalConv1dUpdate`, at the real 27B (Hv=48) and 35B (Hv=32) GDN dims on CPU and CUDA. MEASURED state cost: one f32 SSM slot = Hv·Dv·Dk·4B ⇒ 144 MiB/req (27B, 48 layers) / 60 MiB/req (35B, 30 layers) per extra slot; k=1 doubles the GDN SSM state. **I5a GDN LAYER ROUTING WIRED (2026-07-24, `CLAIM-SPEC-MTP-I5A`):** `GdnBlockPaged`'s `num_spec_decodes>0` branch now routes a PURE-spec batch through `vt::CausalConv1dSpecUpdate` + `vt::GdnSpecDecode` (mirror `qwen_gdn_linear_attn.py:1344-1357,1455-1475`), and the runner per-step upload (`StepDevInputs`/`BuildStepDevInputs` + the two decode-graph `Refresh` copies) now carries I4's six spec device tensors, gated by the extended `ValidateGdnAttentionMetadata` spec contract. DEFAULT-OFF INERT (`num_spec_decodes==0` ⇒ stub uploads + the identical non-spec branch). BIT-EXACT vs the I4 ops applied as a token-sequential decode chain, at the real 27B/35B GDN dims, via `GdnBlockPagedForTest` (`tests/vllm/models/test_qwen3_5_gdn_spec_routing.cpp`, CPU bit-exact + CUDA on-device); RED-first by a reverted stub (spec recurrence zeroed ⇒ 4/8 fail, maxΔ 1.3-1.6). MIXED spec+non-spec batch refused loudly — lands with I5d's runner loop. Row advances to `ACTIVE`: the M-mtp-1 e2e greedy token gate (verify/propose runner wiring) is owed before `DONE`, and `SPEC-MTP` STAYS `GATING` | T1 | `vllm/v1/attention/backends/gdn_attn.py:189-326,413-462`; `fla/ops/fused_sigmoid_gating.py:66-72,103-116,156-166`; `mamba/ops/causal_conv1d.py:818-1067,1181-1184`; `qwen_gdn_linear_attn.py:1329-1576`; `mamba_utils.py:213-234`; `mamba/abstract.py:55-59` | `include/vllm/v1/attention/backends/gdn_attn.h`; `src/vllm/v1/attention/backends/gdn_attn.cpp`; `include/vt/ops.h` (`kGdnSpecDecode`, `kCausalConv1dSpecUpdate`); `src/vt/ops.cpp`; `src/vt/cpu/cpu_ops.cpp`; `src/vt/cuda/cuda_gdn.cu`; `src/vllm/model_executor/models/qwen3_5_common.{h,cpp}` (`MakeQwen3_5KVCacheSpec`); **I5a:** `src/vllm/model_executor/models/qwen3_5.cpp` (`GdnBlockPaged` spec branch, `StepDevInputs`/`BuildStepDevInputs`, `ValidateGdnAttentionMetadata`), `src/vllm/model_executor/models/qwen3_5_internal.h` (`GdnBlockPagedForTest`) | `tests/vllm/v1/attention/test_gdn_metadata_builder.cpp` (20 cases / 483 assertions incl. the full upstream `GDN_BUILD_TEST_CASES` + default-off byte-identity); `tests/vt/test_ops_gdn.cpp` (reject-at-every-j rollback, CPU + CUDA, real dims); `tests/vllm/models/test_model_registry.cpp` (k+1 slot / widened-conv sizing + `num_spec==0` identity); **I5a** `tests/vllm/models/test_qwen3_5_gdn_spec_routing.cpp` (spec-routing bit-exact, RED-first) — anchor `tests/vllm/v1/attention/test_gdn_metadata_builder.cpp:83` | [mtp-spec-decode.md §3,§5](specs/mtp-spec-decode.md) | `ACTIVE` | `CLAIM-SPEC-GDN-I4`, `CLAIM-SPEC-MTP-I5A` | | `SPEC-DFLASH` | Block-diffusion drafter. **READINESS RE-ASSESSED 2026-07-25 (`CLAIM-SPEC-DFLASH-READINESS`, design-only, DONE) against the LANDED MTP machinery (`SPEC-MTP` I1..I7).** Verdict **GREEN, dispatch-ready, NO hardware/oracle/download blocker** (spec [§0](specs/dflash-spec-decode.md)). Refreshed reuse-vs-new map: DFlash gets FREE from landed MTP — the frozen spec-metadata ABI, the greedy rejection sampler (k-general, I3 tested k∈{1,3}), the GDN spec slot path + rollback + mixed spec/non-spec batch (`GdnBlockPagedMixedSpec`/`IndexSelect`/`IndexCopy`, general `num_spec`), the widened-cache-aware conv ops (I5e), the draft-KV layer pattern (`fa_draft`), the I5d/I7 runner verify/propose loop, and **`num_lookahead_tokens=k+1` ALREADY coded** (`speculative.h:91-108` `use_dflash()`); EXTENDS the single I5d-pre `hidden_tap` seam to multi-tap `[T,H×taps]`; builds NEW the `qwen3_dflash` drafter, the project's FIRST non-causal in-block attention primitive, context-KV precompute, `prepare_dflash_inputs`, and the uniform-1+k FULL CG. **k>1 verdict:** the landed rejection + GDN machinery is MECHANICALLY k-general (no `k==1` hardwiring) — DFlash's k=15 blocks need NO mechanism extension, only exercise/validation at scale (D4) + the k+1-slot memory measurement (~2.3 GiB/req 27B GDN state at block-16, the #1 risk, §5). **Checkpoint-fit:** both z-lab drafts EXIST on HF (27B 1.73 GB / 35B 368 MB bf16, DFlashDraftModel) and FIT the 119 GiB pool trivially (drafts NOT yet on dgx — D0 downloads ≤1.73 GB); the active dgx oracle `vllm-oracle-v0.25.0-stage` CONSTRUCTS DFlash (registry `DFlashDraftModel→qwen3_dflash`, speculator dir present) — soft D0 risk = confirm it SERVES DFlash+NVFP4 on sm_121 (non-causal backend; community `AEON-7/vllm-dflash` container proves the combination runs on GB10). W-plan D0-D6 in the spec. **D0+D1 LANDED 2026-07-26 (`CLAIM-DFLASH-D0D1`) on the ADVANCED pin `555967922`/vLLM 0.26.0.dev0 — `SPEC-DFLASH` → `ACTIVE`.** D0 UNBLOCKED (vllm#40898 resolved under `VLLM_USE_V2_MODEL_RUNNER=1`): the mixed-attn z-lab 27B draft CONSTRUCTS + the drafter is ALIVE (acceptance 2.21/8.80/4.75/4.57 > 1, `num_spec=16`, flashinfer-native fp8-KV, goldens committed); gate FORM measured STRICT MODE-MATCHED (vLLM-ON run-deterministic K>=3 but != vLLM-OFF — the k=16 block verify diverges at bf16 near-ties, so NOT the MTP three-way identity). D1 `DF-AUX-TAPS` DONE: `Qwen3_5AuxTaps` + `ModelForwardInput::aux_tap` route to `Qwen3_5{,Dense}Model::ForwardDeviceMultiTap` capturing `(hidden+res)` at `target_layer_ids` into `[T,H×taps]` (eagle3 `_maybe_add_hidden_state`, aux key L+1); config-gated byte-identical off. Unit gate 598 assertions (independent truncated-model reference, RED-first reversed-concat 384 fail); CUDA 697/697 + compute-sanitizer 0; INERTNESS PROVEN — 27B MTP e2e 9/9 + 27B text SACRED 235/235 byte-identical on the new oracle. **D2 `DF-DRAFT-MODEL` CODE LANDED + CPU-GATED 2026-07-26 (`CLAIM-DFLASH-D2`, kernel row `KERNEL-ATTN-DFLASH-BLOCK`):** the `qwen3_dflash` draft model (plain 5-layer Qwen3-dense reusing `dense_attn_block.h` ops), the project's FIRST non-causal / bidirectional attention primitive `vt::DFlashBlockAttention` (a SEPARATE op — causal `kAttention`/`kPagedAttention` byte-identical), the fc aux-combine, mask-embed, per-layer SWA/full resolution, and the z-lab loader. CPU gate GREEN (op 12/12 incl. RED non-causal; model forward 95/95 incl. RED full-layer-causal-flip + block isolation + fc RED); existing causal `test_ops_attention` 9/9 + `test_qwen3_forward` 1028 UNCHANGED. **D2 GPU PROMOTION GREEN on dgx (`CLAIM-DFLASH-D2`):** CUDA `-Werror` clean, CUDA==CPU 198412/198412 + compute-sanitizer 0, draft-forward parity vs the REAL vLLM draft (fc rel-L2 0.46%, hidden ≤1.3%, 11 STRICT + 5 near-tie ids), 27B SACRED 235/235 + MTP 9/9 byte-identical — **D2 DONE.** **D3 `DF-DRAFT-KV-PREP` DONE 2026-07-26 (`CLAIM-DFLASH-D3`):** `PrecomputeContextKV` + `PrepareDflashInputs` + `ForwardBlockLogitsWithContext` (reuse the UNCHANGED D2 kernel via [context;block]); GPU numeric-parity `test_qwen3_dflash_kvprep_parity` 61/61 (prepare INTEGER bit-exact vs vLLM's Triton kernel, context-KV K/V rel-L2 0.31%/0.26%, 13 STRICT + 3 near-tie = 16/16), CPU 114/114 RED-proven, inertness 235/235 + 9/9 + D2 37/37 byte-identical. **D4 `DF-ENGINE-INTEGRATION` propose brick + `dflash` config-select CODE LANDED + CPU-GATED 2026-07-26 (`CLAIM-DFLASH-D4D5`):** `DflashProposeBlock`/`SampleDflashBlockDrafts` (the non-autoregressive whole-block propose composing D3 `ForwardBlockLogitsWithContext` + greedy per-mask argmax, anchor not sampled, `dflash/speculator.py:300-413`) + `ParseSpeculativeConfigJson`/`ResolveDflash` accept `method:"dflash"`. CPU gate `test_dflash_propose` 5/19 GREEN (RED-first anchor-read fails 4/5; brick composes forward+sampler; empty-ctx degenerates to D2; config lookahead k+1). Additive + config-gated ⇒ MTP + non-spec byte-identical BY CONSTRUCTION (`git diff --stat` = new speculator TU + config accept-list + CMake + test, NO runner/model/loader/scheduler edit). **D5 `DF-ENGINE-INTEGRATION` runner-loop LANDED + e2e RUNS on dgx 2026-07-26 (`CLAIM-DFLASH-D5`):** full verify/propose loop wired — loader loads the SEPARATE z-lab draft (`LoadDflashDraft`, host bf16 + target-SHARED bf16 embed/lm_head) via a `--speculative-config` `model` key + `ResolveSpecConfig` dflash branch + `runner.set_dflash_draft`; the verify forward captures the D1 multi-tap (`aux_tap`→`ForwardDeviceMultiTap`) instead of the MTP single tap; `propose_drafts_dflash` ACCUMULATES the per-request combined-feature context (`CombineAuxFeatures(aux_tap)`) across steps and honors the `num_rejected` rollback by appending only the `(T_req−num_rejected)` accepted-prefix features, then runs `DflashProposeBlock` (k=16 GDN-spec exercised first time). **e2e (`test_qwen27_dflash_spec_decode`, 4 prompts×32 tok, our-DFlash-ON vs the committed vLLM-DFlash-ON golden): 2/4 STRICT token-exact (fibonacci, three-laws) + acceptance ~ vLLM on ALL 4 (accepted 19/39/29/25 vs golden 17/39/30/25, deltas +2/0/−1/0 — the MANDATORY dead-drafter-trap condition MET).** The 2 divergences (France tok11 `2972`↔`11751`, 17*23 tok12 `567`↔`488`) are SINGLE bf16 near-tie flips (17*23 RE-CONVERGES after one token = proven near-tie; France cascades from one flip) — the ratified near-tie ROOT the D0 gate-form anticipated, rooted in the D3-documented inline bf16 context-KV recompute envelope (~0.3-1.3% rel-L2), NOT a wiring bug (proven by the 2 exact prompts + near-exact acceptance + a non-trivial shared prefix). Inertness GREEN on this build: SACRED `test_qwen27_paged_engine` 235/235 + MTP `test_qwen27_spec_decode` 9/9 byte-identical; CUDA `-Werror` clean; NO new CUDA kernel (host orchestration reusing D1/D2/D3-sanitized ops). **NOT a clean strict-4/4 pass; STRICT 4/4 token-identity + the speed A/B = D6 (the persistent paged draft-KV bit-matching vLLM's fused context-KV projections + the uniform-1+k FULL CG).** Row STAYS `ACTIVE` (correctness at the ratified near-tie envelope; D6 remains) **D6 2026-07-27 (`CLAIM-DFLASH-D6`) — c1 SPEED A/B DONE + STRICT-irreducibility RCA + CG feasibility (records-only, NO source code):** (1) **c1 speed A/B** (`examples/vllm-bench` at `361189a7`, 8 prose+code prompts×256 tok greedy c1, 2 reps): our DFlash-ON = **2.50x TPOT (40.4 vs 101.2 ms) / 2.48x output-tput (24.4 vs 9.86 tok/s)** over our OFF, acceptance 0.22 (3.56/16), rep-stable <1.5%; `benchmark_binding=true`. vs vLLM-DFlash-ON graphed (same workload): vLLM-DFlash-ON graphed = 28.5 tok/s / 35.1 ms TPOT / acceptance_len 4.30 (same 8 prompts, `VLLM_USE_V2_MODEL_RUNNER=1`, mm-off, gpu_util 0.30), so OURS IS ~14% BELOW vLLM-DFlash-ON on output throughput (24.4 vs 28.5 tok/s) - both ~on-par at spec-OFF (9.86 vs 9.83 tok/s), but vLLM extracts a larger DFlash speedup (2.90x vs our 2.47x) because its draft step is fully device-resident + CUDA-graphed (ours host-orchestrates 13 downloads/step) + slightly higher acceptance (~4.3 vs ~3.6 draft tokens/step). The DONE speed bar (ours >= vLLM) is NOT met; closing it = the device-resident draft rewrite + FULL CG (D6 part 2). (2) **STRICT-4/4 proven bf16-IRREDUCIBLE** — the draft KV cache is bf16 not fp8 (`torch_utils.py:398` `auto`→model dtype; the D0 "fp8-KV" was the backend name, not the KV storage dtype), the D3 golden already compares pre-storage bf16 (residual K 0.31%/V 0.26% = sub-ULP kernel noise), and a fused multi-layer KV GEMM is per-element invariant to our per-layer GEMMs ⇒ bit-exact needs vLLM's exact kernels ⇒ the ratified near-tie gate is the FINAL correctness form (no fused-KV code landed). (3) **FULL CG BLOCKED** on a device-resident draft-path rewrite (the D5 path does 13 device→host downloads/step + host `[context;block]` interleaving) — the remaining throughput-parity increment (the perf form of persistent-paged-KV + the graph). Inertness by construction (the gated binary is the D5 binary; SACRED 235/235 + MTP 9/9 stand). Evidence tool `scripts/spec/vllm_dflash_timing.py`. **D7 2026-07-27 (`CLAIM-DFLASH-D7`) — within-step draft forward made DEVICE-RESIDENT (source-owning): `PrecomputeContextKVDevice` keeps per-layer K/V on device; `ForwardBlockLogitsWithContext` builds [context;block] with `vt::IndexCopy`/`IndexSelect` (removes ~30 D→H `Download`s/step). BIT-IDENTICAL (identity bf16↔f32 round-trips replaced) — e2e `test_qwen27_dflash_spec_decode` 27/27 SAME tokens (2/4 STRICT + 2/4 near-tie, acceptance 19/39/29/25), SACRED 235/235 + MTP 9/9, CUDA `-Werror` clean, compute-sanitizer 0 (198412). But the direct old-vs-new A/B = +2.0% output-tput (IN-NOISE) ⇒ D6's "downloads = the ~14% gap" REFUTED by measurement; ours 19.68 tok/s STILL ~33% BELOW vLLM-DFlash-ON 29.2 tok/s (reconstructed 8-prompt set, more prose-heavy); OFF parity our 9.97 ≥ vLLM 9.66. Residual re-attributed: acceptance (ours 2.49 vs vLLM ~3.13 accepted draft-tok/step, bf16-irreducible) + per-step context-KV RECOMPUTE (O(context²), needs the cross-step persistent paged draft-KV store) + eager-vs-graphed. SPEED BAR NOT met; SPEC-DFLASH stays `ACTIVE`; next = persistent paged draft-KV store → then FULL CG. **D9 2026-07-27 (`CLAIM-DFLASH-D9`) — PERSISTENT PAGED DRAFT-KV LANDED (bit-identical, +22.7% throughput, 0.69×→0.917×); D8 acceptance-ceiling REFUTED; residual = FULL CG ONLY:** `qwen3_dflash.cpp` `AppendContextKVHost` (project ONLY newly-accepted rows → per-layer bf16 K/V, append to `PrecomputedContextKV`) + `ForwardBlockLogitsWithPrecomputedKV` (upload the persistent store, NO re-projection) share the core `ForwardWithCtxKVDev` with the old recompute; `runner.cpp::propose_drafts_dflash` swaps the O(context²) per-step recompute (`dflash_ctx_feats_`) for an append-only per-request `dflash_kv_store_` (rollback=don't-append). NO new CUDA kernel; config-gated. BIT-IDENTICAL: CPU `test_dflash_propose` two new D9 cases = exact float equality vs full recompute; GPU e2e `test_qwen27_dflash_spec_decode` **27/27 SAME tokens** (acceptance 19/39/29/25, same divergences France@11/17×23@12); SACRED 235/235 + MTP 9/9 byte-identical; CUDA `-Werror` clean. **A/B (c1, 8 prose+code×256 tok input-len 512, 2 reps <0.1%, `benchmark_binding=true`):** ours-ON **25.75 tok/s** (was D8 20.99, +22.7%) / 38.40 ms TPOT / acc **3.68/step** vs vLLM-ON graphed **28.09** / 35.60 / acc 3.31 = **0.917×** (~8% below, was 0.69×). **Part 1 same-trajectory:** on the 2 token-identical-trajectory prompts ours per-step acceptance == vLLM's EXACTLY (fibonacci 7.80/7.80, three-laws 3.571/3.571, ratio 1.00) AND on the A/B ours acceptance (3.68) is HIGHER than vLLM's (3.31) ⇒ D8's 0.80–0.85× "bf16 acceptance ceiling" is a trajectory-divergence CONFOUND, REFUTED. Residual (~8%) = eager-vs-graphed ONLY (ours ON/OFF 2.60× vs vLLM 2.91×, OFF at parity, recompute eliminated, acceptance higher) — NOT an irreducible ceiling; the FULL uniform-(1+k) CG (device paged-KV store + paged attn, new-CUDA multi-file) is the SOLE un-landed increment. SPEC-DFLASH stays `ACTIVE` (speed not yet ≥ vLLM; residual isolated to FULL CG). **D12 2026-07-27 (`CLAIM-DFLASH-D12`) — A-wire + Part B LANDED + GPU-gated; Part C (capture) remaining; 0.917×:** A-wire makes the D11 Part-A device store the PRODUCTION path (`runner.{h,cpp}` `dflash_kv_store_`→`shared_ptr`, `MakeDeviceKVStore`/`AppendContextKVDevice`/`ForwardBlockLogitsWithDeviceKV`; GPU-gated e2e `test_qwen27_dflash_spec_decode` 27/27 all-exact acceptance 19/39/29/25 + SACRED 235/235 + MTP 9/9 byte-identical, `-Werror` clean). Part B adds `vt::DFlashPagedBlockAttention` (`OpId::kDFlashPagedBlockAttention`), the capture-safe paged kernel with EVERY metadata input a persistent DEVICE tensor and NO function-local host `cu_seqlens` upload (fixes the `cuda_ops.cu:1277-1280` capture-UAF class), gated CPU==CUDA + cross-check vs materialized `DFlashBlockAttention` `test_ops_dflash_paged_block_attn` 795648/795648 + compute-sanitizer 0. Speed 0.917× (A-wire eager + Part B not yet wired into the forward); `benchmark_binding=false`. Part C (static-shape capture + device mask-scatter + `BeginCapture`/replay + the ≥vLLM c1 A/B) is the SOLE remaining piece; if ours-ON-graphed ≥ vLLM-ON → SPEC-DFLASH DONE. Stays `ACTIVE`. **D13 2026-07-27 (`CLAIM-DFLASH-D13`) — Part C LANDED + GPU-GATED; capture-correctness PROVEN; c1 throughput NEAR-PARITY (ours 0.978x, ~2% below vLLM); gap CLOSED 0.917x→0.978x; STAYS `ACTIVE` (≥vLLM bar not yet met):** single-file additive change (`qwen3_dflash.cpp` +368/-58). (C.1) `DflashDeviceKVStore` → fixed-capacity PAGED cache (per-layer pool `[max_pages,16,Hkv,Dh]` + identity `block_table` + `seq_lens`; append = `vt::IndexCopy` scatter at slot==abs-pos, bit-identical to the D9/D11 store). (C.2) `ForwardPagedBody` runs the (1+k) block through the D12 `vt::DFlashPagedBlockAttention` reading the paged store (no `[context;block]` materialization, no function-local host uploads); runner P==1 propose routes through it, P>1 bit-identical materialized fallback. (C.3) per-request CUDA GRAPH over the paged draft step (warm-in-step repopulates the shared pool free-list right before `BeginCapture` — the fix for a `cudaMalloc`-in-capture `Get` miss from the intervening 27B target forward — then `BeginCapture → ForwardPagedBody → EndCaptureGraph`, replay with growing context entering only via in-place `seq_lens`). **Capture-correctness (MANDATORY): `test_qwen27_dflash_spec_decode` 27/27 with the graph (VT_DFLASH_GRAPH=1) BIT-IDENTICAL to eager (=0)** — same divergence tokens (France@11 got[…2972…], 17×23@12 got[…567…]), same acceptance 19/39/29/25 as D5/D7/D9/D12; graph ENGAGED (5 captures C=2048/5/4/15/6, 32+ replays); the token-diff is the capture-safety proof ([[cudagraph-capture-bakes-stack-addresses]]). **c1 A/B (one flock series, cold rep discarded, 8 prompts×256 tok):** our OFF 10.24 / our ON eager-paged 28.65 (28.69,28.61) / **our ON GRAPHED 28.70 (28.70,28.70), TPOT 34.40** / vLLM-ON graphed steady-state 29.35 (tight 3-rep 29.33/29.37/29.33, TPOT 34.07, acc_len 4.44); D9's 28.09 was a colder cross-session outlier — **NEAR-PARITY: ours 0.978× (~2% below) on the rigorous same-session band** (across sessions ours 28.70 falls inside vLLM's observed 28.09–29.37 range). ON/OFF 2.80× (vLLM ~2.98×), our OFF ≥ vLLM OFF. Per the acceptance rule ("below on any axis = an open gap; near-parity is NOT met"), the ≥vLLM bar is NOT met; STAYS `ACTIVE`. Residual (data-grounded): NOT acceptance (ours realized ~3.68 accepted draft-tok/step > vLLM's 3.44) and NOT launch/graph (both graphed, CG neutral) — per-step COMPUTE (~2% slower target-step); next lever = nsys both draft steps (`--cuda-graph-trace=node`), no premature ceiling. **ATTRIBUTION (supersedes D9):** the CUDA graph is perf-NEUTRAL (+0.3%); the ACTUAL lever was the paged context read (C.1/C.2) removing the D9/D12 per-layer `[context;block]` `IndexCopy` materialization of the whole growing context (25.75 D9 → 28.65 eager-paged, +11%) — the roadmap's "the full CG closes the gap" premise is corrected by measurement. Inertness VERIFIED on the capture binary: SACRED 235/235 + MTP 9/9 byte-identical, CUDA `-Werror` clean, no new kernel (D12 paged kernel already memcheck-0 795648), `check-device-leakage` not increased (paged path REMOVES the materialized-buffer allocs + host uploads). `benchmark_binding=true`. Correctness-complete (ratified near-tie); throughput NEAR-PARITY (0.978×, ~2% residual) ⇒ STAYS `ACTIVE` (the capture-correctness gate is MET; the ≥vLLM speed bar is the sole remaining item, a ~2% per-step-compute residual for an nsys). Anchors: `src/vllm/model_executor/models/qwen3_dflash.cpp` (`DflashDeviceKVStore` paged store, `ForwardPagedBody`, the per-request graph in `ForwardBlockLogitsWithDeviceKV`). **D14 2026-07-27 (`CLAIM-DFLASH-D14`) — SPEED GATE MET → SPEC-DFLASH `DONE`:** an nsys (`--cuda-graph-trace=node`) of the graphed spec-on step attributed the D13 ~2% residual to the from-scratch `DFlashPagedBlockAttentionKernel` draft attention (242.9 ms = 1.8% of GPU time, median ~460 us/call over context C~500-640, vs vLLM's fused flash draft-attn ~0.15%; BOTH engines run identical `cutlass_80_wmma` for the draft bf16 GEMMs, so the GEMMs were NOT the gap). Ported it to a WARP-scoped online-softmax variant `DFlashPagedBlockAttentionWarpKernel` (mirrors the shipped `AttentionWarpKernel`: one warp per (block-query,head), `__shfl_xor` butterfly reduction, register accumulator, NO `__syncthreads` storm; SAME paged/block combined-index read + causal/SWA mask + GQA; default ON, `VT_DFLASH_ATTN_BLOCK=1` keeps the bit-identical D12/D13 block kernel for A/B). Draft attn 242.9 → 77.9 ms (3.1x); our-ON c1 28.60 → 29.32 tok/s (+2.5%). **FINAL same-session 3-rep A/B (8 prompts×256 tok, cold leg discarded): our-ON graphed 29.42/29.27/29.32 (med 29.32) vs vLLM-ON graphed 29.240/29.247/29.233 (med 29.240) — our WORST rep (29.27) > vLLM's BEST (29.247), NON-OVERLAPPING bands, 1.003× ⇒ the ≥vLLM speed gate is MET.** Correctness UNCHANGED (output is exact by spec-decode construction — the target verify is untouched, only which draft proposals are accepted can shift): e2e `test_qwen27_dflash_spec_decode` 27/27 with graph==eager BIT-IDENTICAL, acceptance 19/39/29/25 unchanged (draft accepted 1629 identical warp-vs-block across the whole A/B set), 2/4 STRICT (France@11, 17×23@12 unchanged); CUDA==CPU `test_ops_dflash_paged_block_attn` 795648/795648 (warp within the f32 1e-4 / bf16 3e-2 envelope) + compute-sanitizer 0. Inertness SACRED 235/235 + MTP 9/9 byte-identical; CUDA `-Werror` clean; `check-device-leakage` not increased. `benchmark_binding=true`. Block-diffusion drafting is now correctness-complete (ratified near-tie) AND at/above vLLM throughput — this was the roadmap's FINAL open speed item. Anchors: `src/vt/cuda/cuda_ops.cu` (`DFlashPagedBlockAttentionWarpKernel` + `UseDflashAttnBlockKernel`; the D12 block kernel retained as the `VT_DFLASH_ATTN_BLOCK=1` reference). | T1 | `vllm/v1/worker/gpu/spec_decode/dflash/speculator.py`; `vllm/model_executor/models/qwen3_dflash.py`; `vllm/model_executor/models/interfaces.py:1382` (aux value); `eagle3_utils.py:41-56` (+1 shift) | `include/vllm/model_executor/models/qwen3_5.h` (`Qwen3_5AuxTaps`, `ForwardDeviceMultiTap`); `qwen3_5_dense.h`; `model_registry.h` (`aux_tap`); `src/vllm/model_executor/models/qwen3_5.cpp` (`MaybeCaptureAuxTap`/`ValidateAuxTapLayerIds`/`ForwardDeviceMultiTap`); `qwen3_5_moe.cpp`+`qwen3_5_dense.cpp` (routing); D2/D3 `include/vllm/model_executor/models/qwen3_dflash.h` + `src/vllm/model_executor/models/qwen3_dflash{,_weights}.cpp`; D4 `include/vllm/v1/worker/gpu/spec_decode/dflash/speculator.h` + `src/vllm/v1/worker/gpu/spec_decode/dflash/speculator.cpp` (`DflashProposeBlock`/`SampleDflashBlockDrafts`); D5 `src/vllm/entrypoints/model_loader.cpp` (`LoadDflashDraft`/`DflashDraft`) + `include/vllm/entrypoints/model_loader.h`; D5 `src/vllm/v1/worker/gpu/runner.cpp` (`set_dflash_draft`/`propose_drafts_dflash`/aux-tap capture) + `include/vllm/v1/worker/gpu/runner.h`; `src/vllm/config/speculative.cpp` + `include/vllm/config/speculative.h` (`ResolveDflash` + `dflash`/`model` parse); D14 warp kernel [cuda_ops.cu](../src/vt/cuda/cuda_ops.cu#L1433) | `tests/vllm/models/test_qwen27_paged_forward.cpp` (multi-tap 598); `tests/vt/test_ops_dflash_block_attn.cpp`; `tests/vllm/models/test_qwen3_dflash_forward.cpp`; `tests/vllm/v1/spec_decode/test_dflash_kvprep.cpp`; `tests/parity/test_qwen3_dflash_{draft,kvprep}_parity.cpp`; D4 `tests/vllm/v1/spec_decode/test_dflash_propose.cpp` (5/19, RED-first); D5 `tests/parity/test_qwen27_dflash_spec_decode.cpp` (e2e 27/27, 2/4 strict + acceptance~vLLM); `scripts/spec/d{0,2,3}_dflash_*.py`; `tests/parity/goldens/dflash_27b{,_draft,_kvprep}/`; D6 `scripts/spec/vllm_dflash_timing.py` (vLLM-DFlash c1 timing); D7 device-resident `src/vllm/model_executor/models/qwen3_dflash.cpp` (`PrecomputeContextKVDevice` + `ForwardBlockLogitsWithContext` via `vt::IndexCopy`/`IndexSelect`); D9 persistent paged draft-KV `qwen3_dflash.{h,cpp}` (`AppendContextKVHost`/`ForwardBlockLogitsWithPrecomputedKV`/`ForwardWithCtxKVDev`/`PrecomputedContextKV`) + `runner.{h,cpp}` (`dflash_kv_store_`/`propose_drafts_dflash`) + `tests/vllm/v1/spec_decode/test_dflash_propose.cpp` (2 D9 bit-identity cases); D12 A-wire `runner.{h,cpp}` (device store as production path) + D12 Part B `include/vt/ops.h`/`src/vt/ops.cpp`/`src/vt/cpu/cpu_ops.cpp`/`src/vt/cuda/cuda_ops.cu` (`kDFlashPagedBlockAttention`) + `tests/vt/test_ops_dflash_paged_block_attn.cpp` (CPU==CUDA + cross-check, 795648/795648 + sanitizer-0); D13 `src/vllm/model_executor/models/qwen3_dflash.cpp` (fixed-capacity paged `DflashDeviceKVStore` + `ForwardPagedBody` + the per-request draft-step CUDA graph in `ForwardBlockLogitsWithDeviceKV`); D14 [test_ops_dflash_paged_block_attn](../tests/vt/test_ops_dflash_paged_block_attn.cpp#L79) + [ledger](parity-ledger.md#L738) | [dflash-spec-decode.md](specs/dflash-spec-decode.md) | `DONE` | `489a7544` | @@ -280,13 +280,13 @@ claims it. | `LOAD-SAFETENSORS` | General safetensors loading, stacked parameters, weights mapping. Binding memory scan finds all source mappings live through load plus a persistent CPU mirror of selected tensors; windowed progressive `madvise(DONTNEED)` release now drops each copied-then-dead source range during the copy loop so the mirror build no longer double-resides with the full source mmap | T0 | streamed target-device construction `vllm/model_executor/model_loader/base_loader.py:43-82`; incremental `safe_open` yield `vllm/model_executor/model_loader/weight_utils.py:905-954`; immediate parameter copy `vllm/model_executor/models/utils.py:170-180,252-279` | all mappings opened/retained `src/vllm/entrypoints/model_loader.cpp:47-63,303-312`; `MAP_PRIVATE` reader `src/vllm/model_executor/model_loader/safetensors_reader.cpp:43-70`; windowed release primitive/gate `src/vllm/model_executor/model_loader/safetensors_reader.cpp:285-340`; copy-helper instrumentation `src/vllm/model_executor/models/qwen3_5_weights.cpp:88,104,119,171,190,226,231` + `qwen3_5_dense_weights.cpp:64,80,109,159,164,263,323` | [reader contracts + windowed-release cases](../tests/vllm/test_safetensors.cpp#L68) green (smaps-Rss drop, byte-identity, gate semantics, neighbor safety); exact 27B accounting finds **1,155 tensors / 24,610,136,064 B (22.920 GiB)** persistent host bytes. **VmHWM A/B MEASURED** at `cb2d310` (root `~/work/vllm.cpp-windowed-load/cb2d310c…518/evidence`, one flock, single 27B load per arm): OFF **48,285,916 kB** vs ON **24,750,704 kB = VmRSS** (**−23.54 GB**, load transient eliminated), ON-arm smoke 6/6; ledger row 2026-07-15. Exact-grid memory axes remain `FAILED` (projected PASS); direct-device streaming gate still open | [specs/safetensors-windowed-load.md](specs/safetensors-windowed-load.md) | `PARTIAL` | - | | `ENG-LOAD-DIRECT-UPLOAD` | Cut the SECOND copy out of a safetensors load: a weight the device consumes VERBATIM VIEWS the read-only shard mmap (`OwnedBytes::Borrow`, keep-alive carried on `StTensor::mapping`) instead of being copied into an owned host buffer, so `ResidentWeight` uploads straight from the file mapping and the load moves those bytes ONCE. Backend- and arch-agnostic: it lives in the shared dense loader helpers, so every arch that routes through them inherits it. Additive leaf below `LOAD-SAFETENSORS`; the windowed source-page release is preserved and now also runs after the device upload. Non-verbatim paths (transpose, dtype conversion, dequant, concatenation, GGUF load-time repack) are unchanged and keep their copy. Also lands the measurement half of issue #150: per-phase load timing plus host-copy / borrowed / device-upload byte counters (`VT_LOAD_STATS`) | T1 | one move per byte: streamed shard iterator `vllm/model_executor/model_loader/weight_utils.py:905-954`; immediate copy into the destination parameter `vllm/model_executor/models/utils.py:252-279`; driver `vllm/model_executor/model_loader/base_loader.py:43-82` @ `555967922` | refcounted mapping `src/vllm/model_executor/model_loader/safetensors_reader.cpp:46-80,231-262`; byte counters `:337-400`; `BorrowStTensorBytes` + post-upload adoption/release `src/vllm/model_executor/models/qwen3_5_weights.cpp`; qualifying call sites `include/vllm/model_executor/models/dense_weight_loaders.h` (`LoadBf16Direct`, `LoadCtNvfp4W4A16`, `LoadCtMxfp4W4A16`), `src/vllm/model_executor/models/qwen3_5_dense_weights.cpp` (`LoadModelBf16Direct`, `LoadCtNvfp4Raw`), `src/vllm/model_executor/models/qwen3_5_weights.cpp` (35B `LoadBf16Direct`); upload counter `include/vllm/model_executor/models/dense_attn_block.h`; fp4 resident upload counter + post-upload residency `include/vllm/model_executor/models/dense_nvfp4_gemm.h` (`ResidentNvfp4`) and `src/vllm/model_executor/models/qwen3_5.cpp` (private `ResidentNvfp4`); shared checker text normalization `scripts/checker_text.py` | [mechanism gate](../tests/vllm/test_load_direct_upload.cpp#L1) 14/14, 183 assertions (178 through round 4) — the 6 borrow-mechanism cases, 4 post-upload residency cases that pin the adopt branch, its RELEASE-BEFORE-REASSIGN ordering and the `VT_ADOPT_DEVICE_BYTES` decoupling, 3 fp4-resident cases that pin `ResidentNvfp4`'s upload accounting, its `d_dev` publication, its adoption and the previously unexercised NON-borrowed/host-addressable regime, and 1 case that pins the GENERAL adopt branch's `MADV_DONTNEED` by OBSERVING RESIDENCY (`mincore()` over the host mirror's interior pages, glibc pinned to the sbrk arena so `free()` cannot return them by itself) — the RSS half of this row, which every value assertion was blind to. RED under eleven mutations, each applied alone with the binary rebuilt (a failed build aborts rather than re-running a stale one), tree md5-verified restored and re-GREEN after each. Mutations are named by the TEST CASE they land on, never by a line ref, because carried-forward line refs are how the counts below were twice recorded wrong: drop the size-identity check 1 case / 5 assertions; skip the borrow in `LoadBf16Direct` 2 / 7; delete the adopt branch 5 / 19; move the release after the `bytes` reassignment 5 / 7 (incl. the ordering assertions read from inside the munmap); move the release after the host-addressable early return but BEFORE the env one 2 / 3; move it after the `VT_ADOPT_DEVICE_BYTES` early return, i.e. after BOTH, 3 / 4; delete the general branch's `MADV_DONTNEED` 1 / 1; `ResidentNvfp4` drop both `AddDeviceUpload` 3 / 3; drop both `d_dev` publications 3 / 20; drop both `AdoptDeviceBytesAsHost` 3 / 16; all six at once 3 / 23. FOUR of those rows had been recorded wrong (1/1, 2/2, 3/7 and 3/3) — every one a count measured against an older suite and copied forward rather than re-measured; all eleven are measured on this tree. The `qwen3_5.cpp` duplicate of `ResidentNvfp4` is in an anonymous namespace no test can call, so it is held to the same invariant by [`scripts/check-fp4-resident-consistency.py`](../scripts/check-fp4-resident-consistency.py) (42-case mutation suite), which checks PER BUFFER inside each buffer's own `if (!w.d_)` upload block — body-wide matching let one surviving `AddDeviceUpload` satisfy both buffers, so dropping exactly one counter passed (reproduced against the real `qwen3_5.cpp` text: old checker exit 0, new exit 1). Nine drop-one/substitute-one mutations of the LIVE duplicate now go RED. Round 5 closed two holes in it. It matched RAW source, so a statement left behind as a COMMENT, inside `#if 0`, or inside `if (false)` read as present while the compiler saw a deletion; the clause matchers now run on [`scripts/checker_text.py`](../scripts/checker_text.py)'s `normalize_source`, which blanks all three IN PLACE so byte offsets and line numbers survive — `strip_comments` had existed as two byte-identical private copies (check-runner-routing-consistency.py, check-surface-coverage.py) and both now import the shared helper instead of a third copy being written. And the ordering clause required PUBLISH-before-ADOPT but not COPY-before-ADOPT, so a body whose adoption runs BEFORE its copy passed although the upload then reads pages the adoption already released; new clause (f) READ-FIRST covers it. WHICH MOTION produces that order is part of the claim, because the two are different mutations: SINKING `d.b.Copy(...)` to below `AdoptDeviceBytesAsHost` leaves the `d_dev` publication in place so ONLY clause (f) bites (MEASURED on the live duplicate, old exit 0 / new exit 1 — the 0/1 row below), whereas HOISTING the adoption above the copy also lifts it above the publication and trips the PRE-EXISTING clause (e), which the old checker already caught (MEASURED 1/1) and which is therefore no evidence for (f). The equivalent mutations of the SHARED `dense_nvfp4_gemm.h` copy are red at run time, MEASURED one at a time with the binary DELETED before each rebuild and the header md5-verified (`4665255f7af6f52254367f9118ad92ee`) before and after each: sink `packed`'s `Copy` 2 cases / 2 assertions, sink `scale`'s 2 / 2, sink BOTH 2 / 4 — the failures are `w..bytes.data()[0] == kSrcPattern` and `AllBytesMatchPattern(...)` in `fp4 resident: ResidentNvfp4 COUNTS its upload…` and `fp4 resident: a host-addressable device adopts an OWNED fp4 mirror too`, TWO per mutated buffer, so an ODD count is not obtainable; hoist `packed`'s adoption 3 / 8 and hoist both 3 / 16, wider because a null `d_dev` makes the adoption return immediately and also takes the NON-host-addressable case. This clause had been recorded as **2 cases / 3 assertions**, which is the count of the *release after the host-addressable early return, BEFORE the env one* row carried onto a different mutation — the same failure mode as the four rows above, found by a fifth reviewer and re-measured here rather than copied. MEASURED on the LIVE `qwen3_5.cpp` on disk, one mutation at a time, md5-verified restored after each (35b5ea250f490105d579f4ffb573aa36 before and after all eleven) — old checker exit / new checker exit: delete the packed adoption 1/1, `//` it out 0/1, `/* */` it out 0/1, `#if 0` around it 0/1, `if (false)` around it 0/1, `//` the packed upload counter 0/1, `//` the packed `d_dev` publication 0/1, `#if 0` around that publication 0/1, `if (false)` around it 0/1, SINK the packed `Copy` to below its adoption 0/1. That gate is STRUCTURAL: it guards the duplicate against DELETION — including deletion disguised as a comment, an `#if 0` or a never-taken branch — against gross substitution and against mis-ordering, NOT against corruption, and it does not model the preprocessor (extending it to arbitrary `#ifdef` conditions is DECLINED: `#ifdef VT_CUTLASS_NVFP4` around the live adoption stays exit 0 in both checkers, because a build configuration is not a disguised deletion). Run-time proof exists only for the shared copy. The `mincore()` residency case now also carries a RUNTIME allocator guard — `#if __GLIBC__` proves the headers, not that glibc's allocator is running — which goes red (1 case / 1 assertion) when a purging allocator is simulated; the `mallopt` calls leave glibc's `no_dyn_threshold` set for the process either way, MEASURED as not specific to `M_TRIM_THRESHOLD` (glibc 2.39, `mallinfo2().hblks` probe: no mallopt LIVE, `M_TRIM_THRESHOLD` DISABLED, `M_MMAP_MAX` DISABLED), so it is recorded rather than removed. Round-4 re-run on the dev box, CLEAN Vulkan/llvmpipe Release build: `test_load_direct_upload` 14/14 (178), `test_safetensors` 34/34 (79), `test_qwen36_weights` 7/7 (45), `test_vulkan_backend` 35/35 (2107), `test_backend_cross_device` 11/11 (132), `test_opt_paged_engine` **6/6 token-exact (96/96), 0 declines, device type 3**. Round-5 re-run on the same box, branch rebased onto `a0fa12c7`, all identical except `test_load_direct_upload` **14/14 (183)** — the five added assertions are the RSS-reclaim case's runtime allocator guard, no case-count change — plus `test_checker_text` 33/33 and `scripts/gen-vulkan-spirv.py --check` `committed SPIR-V is up to date` run with the pinned `~/tools/glslang-16.5.0/bin/glslang` (without it the script exits 1 on this tree, so the green is a real compile-and-compare and not a skip). Round 6 changed NO compiled file — this row, the spec, the `(f)` clause docstring and one checker-test name — and re-ran the whole battery on the branch rebased onto `e3cc4f64`, CLEAN Release Vulkan build, 0 warnings: every count above reproduces byte-for-byte, `check-fp4-resident-consistency` rc 0, its suite 42, `test_checker_text` 33, `test_check_surface_coverage` 46, `test_check_runner_routing_consistency` 31, SPIR-V check up to date, preflight all green. GB10 Vulkan gates on the changed tree: `test_vulkan_backend` 35/35 (2650), `test_backend_cross_device` 11/11 (132), `test_opt_paged_engine` **6/6 prompts token-exact (96/96), 0 declines, device type 3**. GB10 CUDA (cutlass+triton) full `ctest` **383/393**, BOTH SACRED gates PASS (`test_qwen36_paged_engine`, `test_qwen27_paged_engine`); all 10 failures reproduce with the same signature on a clean `origin/main` CUDA build. MEASURED 27B bf16 load **1.54x warm / 1.61x cold**, bytes moved **100.196 -> 81.260 GiB** | [specs/load-direct-upload.md](specs/load-direct-upload.md) | `ACTIVE` | `CLAIM-ENG-LOAD-DIRECT-UPLOAD` | | `LOAD-SAFETENSORS-DIRECT-DENSE` | Layer-bounded target-device loading for ordinary plain-BF16 Qwen3.5 dense safetensors on discrete CUDA; additive leaf below `LOAD-SAFETENSORS`, preserving windowed source release and owned-shard lifetime. Plain weights, stacked raw-NK owners, tied logits, logical resident state and same-queue layer staging are implemented and locally CUDA-gated. H32 Triton AOT, plain-BF16 decode graphs and ratio-4 FA2 repair the transplanted hot path; the broader row remains speed-gating | T1 | target-device model construction `vllm/model_executor/model_loader/base_loader.py:43-82`; incremental safetensors yield `vllm/model_executor/model_loader/weight_utils.py:820-954`; stacked/tied parameters `vllm/model_executor/models/qwen3_5.py:276-303,483-492` | load/dispatch `src/vllm/model_executor/models/qwen3_5_dense_weights.cpp:52-133,187-246,334-472`; discrete/unified classifier `src/vt/cuda/cuda_backend.cu:251-265`; plain execution/residency and graph selection `src/vllm/model_executor/models/qwen3_5.cpp`, `src/vllm/model_executor/models/qwen3_5_dense.cpp`; H32 recurrence `src/vt/cuda/cuda_gdn.cu`; ratio-4 FA2 `src/vt/cuda/cuda_flash_attn_fa2.cu`, `src/vt/cuda/cuda_paged_attn.cu`; exact benchmark corpus/output capture `examples/bench/bench_core.h:61-68,357-386,409-589`; reference metrics/token collector `tools/bench/vllm_closed_loop_metrics.py`; guarded driver and summarizer `tools/bench/run_qwen35_4b_compare.sh`, `tools/bench/summarize_qwen35_4b_compare.py` | [Real 4B graph/direct ON/OFF/eager gate](../tests/vllm/models/test_qwen35_plain_weights.cpp#L80) passes **3/3, 1672/1672**; [H32/GDN tests](../tests/vt/test_ops_gdn.cpp#L1) **10/10** flag and **66/66, 4242/4242** full; [paged-attention tests](../tests/vt/test_ops_paged_attn.cpp#L1354) **25/25, 454474/454474**. Final 18-leg root `/tmp/qwen35-main-final-fa2-20260725` plus stable vLLM confirmation: direct ON/OFF/vLLM-0.25 total **5769.99/5660.70/5849.80 tok/s**, output **638.03/625.94/646.85**, TPOT/ITL **43.72/43.84/38.55 ms**, peak PSS **2.406/8.592/7.662 GiB**, stable PSS **0.759/8.589/4.029 GiB**, VRAM **12850.7/12843.3/12942.7 MiB**. ON=OFF output IDs 128/128 every pair; ON is **+1.93%** total and cuts peak/stable PSS **72.0%/91.2%**. H32 AOT/graph/FA2 A/B gains are **+4.59%/+0.39%/+1.60%**. Graph-node trace has 453 launches and 200972 child kernels; local FA2 is 180.28 us/call vs vLLM 178.40, so the remaining **0.9864x** throughput and TPOT gap is host/engine-side. Sanitizer availability and external 27B/35B remain open | [plain-BF16 direct-load spike](specs/qwen35-plain-bf16-direct-load.md); [2026-07-25 evidence](../docs/bench-evidence/qwen35-4b-main-repair-20260725.md) | `GATING` | - | -| `ENG-MOE-HOSTFREE` | MoE Marlin resident host-weight release: after `BuildMoeMarlinResident` uploads+repacks the routed experts to the device Marlin resident, free the per-expert fp4 HOST mirror (`OwnedTensor` packed+scale bytes) and `madvise(MADV_DONTNEED)` the pages back to the OS — returns the ~16.9 GiB steady 35B host double-store (`LoadNvfp4Raw` `MakeOwned` copies kept resident forever). Guarded to the committed Marlin path (`MarlinMoeEnabled()`; retained for the `VT_NVFP4_MARLIN=0` wmma fallback that re-reads them); `VT_MOE_HOST_FREE=0` A/B rollback. Realizes `release_host_weights_after_upload` for the dominant host consumer. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the host-free decision is now CONSUMED from `GetPlatform(d.q.device.type).residency_policy()` via `vllm::platforms::ShouldReleaseHostWeights(policy, MarlinMoeEnabled()/*kernel-path*/, VT_MOE_HOST_FREE/*env*/)` — `CudaPlatform` flag flipped false→true (reproduces today EXACTLY); `MarlinMoeEnabled()` stays the orthogonal KERNEL-PATH safety gate.** | T0 | streamed target-device weight construction `vllm/model_executor/model_loader/base_loader.py:43-82`; residency capability `vllm/platforms/interface.py:134-229`; Marlin MoE in-place repack (no host mirror) `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434` | free region `src/vllm/model_executor/models/qwen3_5.cpp:3743-3781`; `OwnedTensor::ReleaseHost` decl `include/vllm/model_executor/models/qwen3_5_weights.h:65` + impl (madvise+swap) `src/vllm/model_executor/models/qwen3_5_weights.cpp:24`; public hook `Qwen3_5Model::PrepareMarlinResident` `src/vllm/model_executor/models/qwen3_5.cpp:9140` | `tests/vllm/test_qwen36_weights.cpp:283` (`ReleaseHost` frees buffer+capacity) + `:314` (`PrepareMarlinResident` release under Marlin / retention under `VT_NVFP4_MARLIN=0`, DGX release 27/27 + retention 15/15); DGX A/B (`VT_MOE_HOST_FREE`) 35B STEADY serving PSS **20.17→3.53 GiB** (root `dgx:~/work/mem35-hostfree`); token-neutral 315/315 + 235/235; c2 smoke clean; memcheck clean. Whole-window load-phase PEAK bounded by the `ENG-MOE-LOADSTREAM` follow-up. Ledger [parity-ledger.md#L521](parity-ledger.md#L521) | [moe-marlin-host-free.md](specs/moe-marlin-host-free.md) | `DONE` | `ac77bec` | -| `ENG-MOE-LOADSTREAM` | 35B load-phase PEAK-PSS interleave (follow-up to `ENG-MOE-HOSTFREE`): the steady free returns the routed-expert host mirror only AFTER the whole model loads, so whole-window `peak_pss`/`peak_rss` (~19.8 GiB) is still set by all N layers' ~256 experts host-coexisting at load. DEFER the routed-expert host copies (`LoadQwen3_5Moe` loads each layer WITHOUT experts + installs a per-layer `load_layer_experts` streaming closure that owns the mmap'd shards) and materialize ONE layer's experts inside `PrepareMarlinResident` immediately before that layer's device Marlin build + host free — so at most one layer's experts coexist on the host (peak ~ one layer, not all N). Device residents byte-identical (same source bytes, same per-layer build order). Non-CUDA/`VT_NVFP4_MARLIN=0`/no-Marlin build falls back to bulk host materialization (their forward reads the host bytes). 27B is a different loader (`LoadQwen3_5Dense`, true-W4A4) → unaffected; GGUF/synthetic/borrowed pass no shards owner → eager. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the per-layer interleave gate is now CONSUMED from `GetPlatform(queue.device.type).residency_policy()` via `vllm::platforms::ShouldInterleaveLoadStream(policy, MarlinMoeEnabled())` — reproduces the old `queue.device.type != kCUDA` OR `!MarlinMoeEnabled()` gate EXACTLY (unified/CPU retain-host ⇒ policy false ⇒ materialize-all fallback); the ~4 GiB load-peak win is preserved.** | T0 | streamed target-device construction `vllm/model_executor/model_loader/base_loader.py:43-82`; in-place Marlin repack, no host mirror `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434`; residency capability `vllm/platforms/interface.py:134-229` | deferred field `include/vllm/model_executor/models/qwen3_5_weights.h:1163` (`Qwen3_5MoeWeights::load_layer_experts`); loader defer + closure `src/vllm/model_executor/models/qwen3_5_weights.cpp:331,399` (`LoadMoeExpertsInto`/`LoadQwen3_5Moe`); shared shards owner `include/vllm/model_executor/models/model_registry.h:60` + `src/vllm/model_executor/models/model_registry.cpp:219` (`ModelSource::FromSafetensorsOwned`) + `src/vllm/entrypoints/model_loader.cpp:2580` (`LoadedEngine::FromModelDir`); per-layer interleave + `MaterializeAllDeferredExperts` `src/vllm/model_executor/models/qwen3_5.cpp:4498,4508` (`PrepareMarlinResident`) | CPU coexistence-bound contract `tests/vllm/test_qwen36_weights.cpp:324` ("deferred routed-expert load: move-safe closure + bounded coexistence", peak==1 across the per-layer materialize→free loop, move-safe closure); clean `-Werror` CPU build 0 warn, full ctest (3 HTTP/engine-proc parallel-port flakes pass isolated), tools 164/164. **DGX PROVEN** (`~/work/vllm.cpp-mem35-loadstream` new vs `-parent` 7a1a6d6 eager, production flags CUTLASS sm120a+Marlin+FA2 sm_121a, one flock): 35B load-to-ready **peak RSS (VmHWM) 21.43 GiB → 4.19 GiB (−17.24 GiB / −80%, below vLLM 13.3 GiB)**; token BYTE-IDENTICAL both binaries — 35B `test_qwen36_paged_engine` 315/315 + 27B `test_qwen27_paged_engine` 235/235; **27B UNAFFECTED** (peak RSS 24.8 GiB, matches its baseline — dense loader, no deferral); `compute-sanitizer memcheck` on the deferred load path **0 errors / 315 assertions** (no use-after-free of the freed host bytes); weights unit 127 assertions (CPU coexistence peak==1 + DGX residency). `benchmark_binding=false` — the orchestrator re-grids the binding `peak_pss`/`peak_rss` axes to confirm the FAIL→PASS flip | [moe-expert-load-stream.md](specs/moe-expert-load-stream.md) | `ANCHOR-BACKFILL` | CLAIM-MEM35-LOADSTREAM | +| `ENG-MOE-HOSTFREE` | MoE Marlin resident host-weight release: after `BuildMoeMarlinResident` uploads+repacks the routed experts to the device Marlin resident, free the per-expert fp4 HOST mirror (`OwnedTensor` packed+scale bytes) and `madvise(MADV_DONTNEED)` the pages back to the OS — returns the ~16.9 GiB steady 35B host double-store (`LoadNvfp4Raw` `MakeOwned` copies kept resident forever). Guarded to the committed Marlin path (`MarlinMoeEnabled()`; retained for the `VT_NVFP4_MARLIN=0` wmma fallback that re-reads them); `VT_MOE_HOST_FREE=0` A/B rollback. Realizes `release_host_weights_after_upload` for the dominant host consumer. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the host-free decision is now CONSUMED from `GetPlatform(d.q.device.type).residency_policy()` via `vllm::platforms::ShouldReleaseHostWeights(policy, MarlinMoeEnabled()/*kernel-path*/, VT_MOE_HOST_FREE/*env*/)` — `CudaPlatform` flag flipped false→true (reproduces today EXACTLY); `MarlinMoeEnabled()` stays the orthogonal KERNEL-PATH safety gate.** | T0 | streamed target-device weight construction `vllm/model_executor/model_loader/base_loader.py:43-82`; residency capability `vllm/platforms/interface.py:134-229`; Marlin MoE in-place repack (no host mirror) `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434` | free region `src/vllm/model_executor/models/qwen3_5.cpp:3743-3781`; `OwnedTensor::ReleaseHost` decl `include/vllm/model_executor/models/qwen3_5_weights.h:65` + impl (madvise+swap) `src/vllm/model_executor/models/qwen3_5_weights.cpp:24`; public hook `Qwen3_5Model::PrepareMarlinResident` `src/vllm/model_executor/models/qwen3_5.cpp:9478` | `tests/vllm/test_qwen36_weights.cpp:283` (`ReleaseHost` frees buffer+capacity) + `:314` (`PrepareMarlinResident` release under Marlin / retention under `VT_NVFP4_MARLIN=0`, DGX release 27/27 + retention 15/15); DGX A/B (`VT_MOE_HOST_FREE`) 35B STEADY serving PSS **20.17→3.53 GiB** (root `dgx:~/work/mem35-hostfree`); token-neutral 315/315 + 235/235; c2 smoke clean; memcheck clean. Whole-window load-phase PEAK bounded by the `ENG-MOE-LOADSTREAM` follow-up. Ledger [parity-ledger.md#L521](parity-ledger.md#L521) | [moe-marlin-host-free.md](specs/moe-marlin-host-free.md) | `DONE` | `ac77bec` | +| `ENG-MOE-LOADSTREAM` | 35B load-phase PEAK-PSS interleave (follow-up to `ENG-MOE-HOSTFREE`): the steady free returns the routed-expert host mirror only AFTER the whole model loads, so whole-window `peak_pss`/`peak_rss` (~19.8 GiB) is still set by all N layers' ~256 experts host-coexisting at load. DEFER the routed-expert host copies (`LoadQwen3_5Moe` loads each layer WITHOUT experts + installs a per-layer `load_layer_experts` streaming closure that owns the mmap'd shards) and materialize ONE layer's experts inside `PrepareMarlinResident` immediately before that layer's device Marlin build + host free — so at most one layer's experts coexist on the host (peak ~ one layer, not all N). Device residents byte-identical (same source bytes, same per-layer build order). Non-CUDA/`VT_NVFP4_MARLIN=0`/no-Marlin build falls back to bulk host materialization (their forward reads the host bytes). 27B is a different loader (`LoadQwen3_5Dense`, true-W4A4) → unaffected; GGUF/synthetic/borrowed pass no shards owner → eager. **Item-2 (2026-07-19, `CLAIM-BACKEND-PLATFORM-2`): the per-layer interleave gate is now CONSUMED from `GetPlatform(queue.device.type).residency_policy()` via `vllm::platforms::ShouldInterleaveLoadStream(policy, MarlinMoeEnabled())` — reproduces the old `queue.device.type != kCUDA` OR `!MarlinMoeEnabled()` gate EXACTLY (unified/CPU retain-host ⇒ policy false ⇒ materialize-all fallback); the ~4 GiB load-peak win is preserved.** | T0 | streamed target-device construction `vllm/model_executor/model_loader/base_loader.py:43-82`; in-place Marlin repack, no host mirror `vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py:375-434`; residency capability `vllm/platforms/interface.py:134-229` | deferred field `include/vllm/model_executor/models/qwen3_5_weights.h:1163` (`Qwen3_5MoeWeights::load_layer_experts`); loader defer + closure `src/vllm/model_executor/models/qwen3_5_weights.cpp:331,399` (`LoadMoeExpertsInto`/`LoadQwen3_5Moe`); shared shards owner `include/vllm/model_executor/models/model_registry.h:60` + `src/vllm/model_executor/models/model_registry.cpp:219` (`ModelSource::FromSafetensorsOwned`) + `src/vllm/entrypoints/model_loader.cpp:2672` (`LoadedEngine::FromModelDir`); per-layer interleave + `MaterializeAllDeferredExperts` `src/vllm/model_executor/models/qwen3_5.cpp:4498,4508` (`PrepareMarlinResident`) | CPU coexistence-bound contract `tests/vllm/test_qwen36_weights.cpp:324` ("deferred routed-expert load: move-safe closure + bounded coexistence", peak==1 across the per-layer materialize→free loop, move-safe closure); clean `-Werror` CPU build 0 warn, full ctest (3 HTTP/engine-proc parallel-port flakes pass isolated), tools 164/164. **DGX PROVEN** (`~/work/vllm.cpp-mem35-loadstream` new vs `-parent` 7a1a6d6 eager, production flags CUTLASS sm120a+Marlin+FA2 sm_121a, one flock): 35B load-to-ready **peak RSS (VmHWM) 21.43 GiB → 4.19 GiB (−17.24 GiB / −80%, below vLLM 13.3 GiB)**; token BYTE-IDENTICAL both binaries — 35B `test_qwen36_paged_engine` 315/315 + 27B `test_qwen27_paged_engine` 235/235; **27B UNAFFECTED** (peak RSS 24.8 GiB, matches its baseline — dense loader, no deferral); `compute-sanitizer memcheck` on the deferred load path **0 errors / 315 assertions** (no use-after-free of the freed host bytes); weights unit 127 assertions (CPU coexistence peak==1 + DGX residency). `benchmark_binding=false` — the orchestrator re-grids the binding `peak_pss`/`peak_rss` axes to confirm the FAIL→PASS flip | [moe-expert-load-stream.md](specs/moe-expert-load-stream.md) | `ANCHOR-BACKFILL` | CLAIM-MEM35-LOADSTREAM | | `LOAD-GGUF` | GGUF reader, dequantization, Qwen name transforms, embedded vocabulary | T0 | Pinned vLLM has no GGUF loader: `vllm/model_executor/model_loader/__init__.py:31-65`; compatibility reference is llama.cpp | `src/vllm/model_executor/model_loader/gguf_reader.cpp:302`; `src/vllm/model_executor/model_loader/gguf_dequant.cpp:223`; `src/vllm/model_executor/models/qwen3_5_gguf_weights.cpp:432`; `src/vllm/entrypoints/model_loader.cpp:240` | `tests/vllm/test_gguf.cpp:53`; `tests/vllm/test_gguf_dequant.cpp:25`; `tests/vllm/test_gguf_qwen36_loader.cpp:153`; real 35B `tests/parity/test_qwen36_gguf_engine.cpp:145` | `planned: specs/gguf-loader.md` | `PARTIAL` | - | | `LOAD-GGUF-MMPROJ` | A SECOND, `clip`-architecture GGUF projector file beside the language file, and the Qwen3-VL vision tower loaded out of it. **W1 LANDED (#821):** `EngineParams::mmproj_path` / `vllm_model_params.mmproj_path` (C ABI v22) / the server `--mmproj` flag name the file, `clip_mmproj_gguf.h` reads its `clip.*` metadata and `v.*` / `mm.*` tensors into the SHARED `multimodal::Qwen3VLVisionWeights`, and `LoadedEngine::vision_tower()` holds the result. The two-tensor temporal patch embedding (`v.patch_embd.weight` + `v.patch_embd.weight.1`) is INTERLEAVED per channel into the `[out, C*T*p*p]` conv3d operand the tower reads, and a file carrying only the first half is refused by name — the MuseGlimmer condition enforced rather than assumed. MuseGlimmer's own `MuseGlimmerRefuseMmproj` now has a PRODUCTION caller (routed on `clip.projector_type == "muse-glimmer"`), which is a change to MuseGlimmer's behaviour and is stated as one. **NOT supported:** no forward consumes the loaded tower yet — there is no multimodal request path on the C ABI and no GGUF image/video driver — and the COMMITTED 334-name manifest with its CI accounting is owed by `QUANT-QWEN38-27B-GGUF-ARM`, because the live confirmation below is env-gated on a NAS file and CI reads only the synthetic fixture. Auto-discovery of a sibling `mmproj*.gguf` is deliberately out of scope: a directory holding two unrelated models must not silently fuse them. First consumer is `Qwen3.8-27B` ([#821](https://github.com/mudler/vllm.cpp/issues/821)), whose `mmproj-BF16.gguf` (334 tensors, `clip.projector_type = qwen3vl_merger`, header-verified 2026-08-18: data end == file size 931,146,432) ships BOTH halves; MuseGlimmer's lacks the second | T0 | Pinned vLLM has no GGUF loader at all (`555967922`, `model_loader/__init__.py:33-49`), so the compatibility reference is llama.cpp `b10451` = `10bf611e5` (`PROJECTOR_TYPE_QWEN3VL`; the previously recorded `tools/mtmd/clip-impl.h:330` was read at the SUPERSEDED local fork `237ad9b96` and is owed re-anchoring, [#1003](https://github.com/mudler/vllm.cpp/issues/1003)) | the flag `EngineParams::mmproj_path` ([model_loader.h:1](../include/vllm/entrypoints/model_loader.h#L1)), the reader [clip_mmproj_gguf.cpp:1](../src/vllm/model_executor/models/clip_mmproj_gguf.cpp#L1), the open + refuse + read site `src/vllm/entrypoints/model_loader.cpp::LoadedEngine::FromModelDir` (the `.gguf` branch, after the device-fit refusal and BEFORE the tokenizer), the reader `src/vllm/model_executor/models/clip_mmproj_gguf.cpp::LoadQwen3VLVisionFromClipMmproj` + `::ClipMmprojVisionConfig` + `::RefuseUnsupportedClipMmproj`, the holder `include/vllm/entrypoints/model_loader.h::vision_tower` on `LoadedEngine`, the C face `include/vllm.h` `vllm_model_params.mmproj_path` (ABI v22) wired in `src/capi/vllm_c.cpp`, the server flag `src/vllm/entrypoints/openai/server_main.cpp` `--mmproj`, and the now-reached refusal `src/vllm/model_executor/models/muse_glimmer_gguf_weights.cpp::MuseGlimmerRefuseMmproj` | [test_clip_mmproj_gguf.cpp:1](../tests/vllm/models/test_clip_mmproj_gguf.cpp#L1) (9 cases / 272 assertions hermetic: the `clip.*` config mapping, the DeepStack discovery, the per-position patch-embedding interleave, every block/merger slot, and four refusals; the ninth is the LIVE confirmation, which skips loudly unless `VLLM_CPP_QWEN38_27B_MMPROJ` names the real `mmproj-BF16.gguf` and adds 43 assertions when it does — 334 consumed names == 334 shipped with nothing unread, the `clip.*` geometry, and the join checked at all 1,769,472 positions against F32 bytes read straight from the mmap. Renaming a tensor in the reader AND the fixture together leaves the hermetic gate green at 9/9 and reds only the live case, which is what the live case buys) and [test_gguf_mmproj_reach.cpp:1](../tests/vllm/entrypoints/test_gguf_mmproj_reach.cpp#L1) (6 cases / 19 assertions hermetic, all through `LoadedEngine::FromModelDir`; the sixth is the LIVE confirmation that the ENGINE holds the tower, and it skips loudly unless BOTH `VLLM_CPP_QWEN38_27B_GGUF` and `VLLM_CPP_QWEN38_27B_MMPROJ` name the real files, so the 19 assertions belong to the five hermetic cases). The two are separate targets on purpose: deleting the `LoadQwen3VLVisionFromClipMmproj` call site in `model_loader.cpp` reds the SECOND and leaves the FIRST fully green, which is the measured difference between gating a class and gating a capability. The port target for the vision config mapping is `src/vllm/model_executor/models/minimax_h3_vision_gguf.cpp::MiniMaxH3EncoderVisionConfig`, which builds the same `Qwen3VLVisionConfig` from `visual.*` | [quantized arms of Qwen3.8-27B](specs/qwen38-27b-quant-arms.md) | `PARTIAL` | - | | `LOAD-HF-BPE` | HF tokenizer.json byte-level BPE and incremental detokenization | T0 | `vllm/tokenizers/registry.py:176`; `vllm/tokenizers/hf.py:163`; `tests/tokenizers_/test_hf.py:18`; `tests/tokenizers_/test_detokenize.py:148` | `src/vllm/tokenizer/tokenizer.cpp:250,494,529`; `src/vllm/v1/engine/detokenizer.cpp:409` | `tests/vllm/test_bpe.cpp:226`; `tests/vllm/test_tokenizer_parity.cpp:66,74,82,90`; `tests/vllm/test_pretokenizer.cpp:130` | `planned: specs/hf-tokenizer.md` | `ANCHOR-BACKFILL` | - | -| `LOAD-SENTENCEPIECE` | SentencePiece (Metaspace + byte-fallback) BPE tokenizer family — the gate to Mistral/Gemma/SentencePiece `tokenizer.json`. `Tokenizer::FromHfJson` now dispatches on the pre_tokenizer FAMILY: a bare `Metaspace` node selects the SP path (space→▁ U+2581; `prepend_scheme` first/always/never with the starts-with-▁ guard; `split=false`; out-of-vocab char → `<0xNN>` byte-fallback tokens; merge-ranked BPE over the raw-UTF-8 string), else the BYTE-IDENTICAL byte-level path (`DetectPattern` still fails loudly on Metaspace, so families never overlap). Decode + the incremental detokenizer mirror HF's Sequence decoder (Replace ▁→space, ByteFallback, Fuse, Strip 1 leading space). **UNBLOCKS the Mistral (`MODEL-TEXT-mistral-mistral-for-causal-lm`) paged-engine SACRED gate.** `split=true` fails loudly (no golden in scope). Mirrors HF `tokenizers` 0.22 | T1 | `vllm/tokenizers/hf.py:163`; `vllm/tokenizers/mistral.py:235,467`; HF `tokenizers` 0.22 `pre_tokenizers/metaspace.rs`, `models/bpe/model.rs::merge_word`, `decoders/{replace,byte_fallback,fuse,strip}.rs` | dispatch `src/vllm/tokenizer/tokenizer.cpp:340` (`DetectMetaspace`), `src/vllm/tokenizer/tokenizer.cpp:1199` (`EncodePlainSp`), `src/vllm/tokenizer/tokenizer.cpp:1517` (`SpDecodeTokens`), `src/vllm/tokenizer/tokenizer.cpp:1002` (`Decode` SP branch); merge-loop factor `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`); family/params/accessors `include/vllm/tokenizer/tokenizer.h:147` (`GetFamily`); incremental dispatch `src/vllm/v1/engine/detokenizer.cpp:359`; generator `tools/parity/dump_tokenizer_mistral.py` | `tests/vllm/test_tokenizer_parity_mistral.cpp:78` **6/6, 421 assertions byte-exact** vs HF `tokenizers` 0.22.2 (= vLLM 0.25.0 backend) over a 45-entry Metaspace/byte-fallback/special-token corpus (goldens `tests/parity/goldens/tokenizer_mistral/{tokenizer.json,encodings.json}`); SACRED cross-check vLLM `AutoTokenizer` (transformers 5.13.1) 0/45 mismatch (±BOS); byte-level suites byte-identical `tests/vllm/test_bpe.cpp` 852, `tests/vllm/test_detokenizer.cpp` 221, `tests/vllm/test_tokenizer_parity.cpp` 1175, `tests/vllm/test_tokenizer_parity_deepseek.cpp` 2461 | [specs/sentencepiece.md](specs/sentencepiece.md) | `ANCHOR-BACKFILL` | `CLAIM-LOAD-SENTENCEPIECE` | -| `SPEC-BPE-QUADRATIC-MERGE` | **The BPE merge loop is O(n^2) in pretoken length, on the request path, before the length check.** `src/vllm/tokenizer/bpe.cpp::BpeMerge` rescans every adjacent pair per merge and built one `std::string` key per probe through a `MergeKey` helper that this row deletes, on the premise its own comment states: "pretokens are tiny". FIVE of the seven pretokenizer rules return an unbounded run (`src/vllm/tokenizer/pretokenizer.cpp::MatchLetterRun` rule 2, `src/vllm/tokenizer/pretokenizer.cpp::MatchPunctRun` rule 4, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNewlines` rule 5, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNotBeforeNonSpace` rule 6, `src/vllm/tokenizer/pretokenizer.cpp::MatchWs` rule 7); only rule 3 `MatchNumbers` is capped and only rule 1 `MatchContraction` is bounded by its own alternation, and on the SentencePiece family `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp` merges the WHOLE prompt as one word because Mistral and Gemma declare `split: false`. MEASURED at `31f93787c`, min-of-k on a CONTENDED 20-core box, so these are contended minima and not idle-host constants, and EACH figure carries its own load: 65,535 bytes of one repeated character costs 24.4-45.8 s of one core at load average 25-90; 64 KB of ordinary English prose through the committed Mistral golden costs 25.3 s AT LOAD AVERAGE 4-12 against HF `tokenizers` 0.22.2's 10.1 ms on the same file for byte-identical identifiers, growing n^2.0. A confirmation run at load 23-57 read 37.6 s where the 65,535-byte figure reads 24.4 s, and a fourth reading through the committed harness `tools/bench/bpe_encode_cost.cpp` moved the 8 KB English figure about 1.7x at load 194, so the SHAPE is the result and the constants move with the box. `src/vllm/v1/engine/input_processor.cpp::ValidatePromptLen` runs FIVE LINES AFTER the encode, so `max_model_len` bounds none of it, and `/tokenize` reaches the same path with no engine. This is a remote denial of service, not a latency curiosity. Fix mirrors HF `tokenizers` 0.22.2 `Word::merge_all` (heap over candidate merges, identifier-keyed merge table); a prototype is bit-identical to today's identifiers on 20 comparisons across BOTH committed goldens, all 20 of which also match HF `tokenizers` 0.22.2 reading the same files, and 8,192 newlines fall from 580.44 ms to 2.60 ms. A pretoken cap is REFUSED: it changes the token identifiers. A GROWTH-RATIO gate is refused too, by operator ruling recorded in the spec's `## Tests to port` item 3: at load 176-268 the defective code's own 4x ratios spread 4.654 to 17.896 and OVERLAP the correct algorithm's, because the two halves of a ratio are independently preemptible. The absolute cost bound of item 2 carries the timing gate alone, on about three orders of magnitude of headroom. The string key is not a separable win either, on the DESIGN: upstream's staleness test compares `new_id` (`word.rs:197-205`) and its table is keyed on an identifier pair, so a step that rebuilds a `std::string` to name a pair cannot express the test; and removing a constant from a quadratic leaves a quadratic. How much the key alone is worth is NOT measured on an idle host and this row claims nothing about it | T0 | HF `tokenizers` 0.22.2 `tokenizers/src/models/bpe/word.rs:162-250` (`Word::merge_all`), `:28-35` (`Ord for Merge`), `tokenizers/src/models/bpe/mod.rs:9` + `model.rs:19,174-192` (identifier-keyed merge table and its load-time refusal) | `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`, the heap mirroring `Word::merge_all`), `src/vllm/tokenizer/bpe.cpp:113` (`MergeRanks::Insert`) and `include/vllm/tokenizer/bpe.h:66` (the identifier-keyed table mirroring `MergeMap`), `src/vllm/tokenizer/tokenizer.cpp:108` (`InsertMerge`, the load-time vocabulary refusal, reached from `src/vllm/tokenizer/tokenizer.cpp::FromHfJson` AND `src/vllm/tokenizer/tokenizer.cpp::FromGguf`), `src/vllm/tokenizer/tokenizer.cpp:654` (`FinalizeTables`, the reserved unk-sentinel identifier); callers unchanged, `src/vllm/tokenizer/tokenizer.cpp:1175` (`EncodePlain`) and `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp`; request path `src/vllm/v1/engine/input_processor.cpp:266` (`process_inputs`), whose encode at line 260 runs five lines before its own length check at line 265 | `tests/vllm/test_bpe_equivalence.cpp:129` (80 entries x 2 goldens x 2 special-token modes = **320 id vectors, all matching HF `tokenizers` 0.22.2**, longest entry 8,034 bytes in ONE pretoken), `tests/vllm/test_bpe_equivalence.cpp:166` (the ONLY timing assertion: two 65,536-byte one-word inputs under an absolute 2,000 ms bound, landed RED at 23,918.5 ms and 23,077.3 ms against the shipped code); `tests/vllm/test_bpe.cpp:228` (leftmost tie on a long list), `:249` (stale entry, `new_id` not the pair), `:287` (no right neighbour), `:317,351` (the table), `:685` (the load-time refusal on BOTH surfaces, plus every committed golden still loading); goldens `tests/parity/goldens/bpe_equivalence/encodings.json`, generator `tools/parity/dump_bpe_equivalence.py`; `test_bpe` 24/24 971, `test_bpe_equivalence` 2/2 334, `test_tokenizer_metaspace_split` 7/7 28, `test_detokenizer` 12/12 221, `test_tokenizer_parity` 4/4 1175, `test_tokenizer_parity_mistral` 6/6 421, `test_tokenizer_parity_deepseek` 6/6 2461, `test_tokenizer_parity_gpt4o` 5/5 1000, `test_input_processor` 17/17 79; closing gate rerun and promotion [parity-ledger.md#L945](parity-ledger.md#L945) | [specs/bpe-quadratic-merge.md](specs/bpe-quadratic-merge.md) | `DONE` | `67823aee2` | +| `LOAD-SENTENCEPIECE` | SentencePiece (Metaspace + byte-fallback) BPE tokenizer family — the gate to Mistral/Gemma/SentencePiece `tokenizer.json`. `Tokenizer::FromHfJson` now dispatches on the pre_tokenizer FAMILY: a bare `Metaspace` node selects the SP path (space→▁ U+2581; `prepend_scheme` first/always/never with the starts-with-▁ guard; `split=false`; out-of-vocab char → `<0xNN>` byte-fallback tokens; merge-ranked BPE over the raw-UTF-8 string), else the BYTE-IDENTICAL byte-level path (`DetectPattern` still fails loudly on Metaspace, so families never overlap). Decode + the incremental detokenizer mirror HF's Sequence decoder (Replace ▁→space, ByteFallback, Fuse, Strip 1 leading space). **UNBLOCKS the Mistral (`MODEL-TEXT-mistral-mistral-for-causal-lm`) paged-engine SACRED gate.** `split=true` fails loudly (no golden in scope). Mirrors HF `tokenizers` 0.22 | T1 | `vllm/tokenizers/hf.py:163`; `vllm/tokenizers/mistral.py:235,467`; HF `tokenizers` 0.22 `pre_tokenizers/metaspace.rs`, `models/bpe/model.rs::merge_word`, `decoders/{replace,byte_fallback,fuse,strip}.rs` | dispatch `src/vllm/tokenizer/tokenizer.cpp:340` (`DetectMetaspace`), `src/vllm/tokenizer/tokenizer.cpp:1223` (`EncodePlainSp`), `src/vllm/tokenizer/tokenizer.cpp:1541` (`SpDecodeTokens`), `src/vllm/tokenizer/tokenizer.cpp:1616` (`Decode` SP branch); merge-loop factor `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`); family/params/accessors `include/vllm/tokenizer/tokenizer.h:147` (`GetFamily`); incremental dispatch `src/vllm/v1/engine/detokenizer.cpp:359`; generator `tools/parity/dump_tokenizer_mistral.py` | `tests/vllm/test_tokenizer_parity_mistral.cpp:78` **6/6, 421 assertions byte-exact** vs HF `tokenizers` 0.22.2 (= vLLM 0.25.0 backend) over a 45-entry Metaspace/byte-fallback/special-token corpus (goldens `tests/parity/goldens/tokenizer_mistral/{tokenizer.json,encodings.json}`); SACRED cross-check vLLM `AutoTokenizer` (transformers 5.13.1) 0/45 mismatch (±BOS); byte-level suites byte-identical `tests/vllm/test_bpe.cpp` 852, `tests/vllm/test_detokenizer.cpp` 221, `tests/vllm/test_tokenizer_parity.cpp` 1175, `tests/vllm/test_tokenizer_parity_deepseek.cpp` 2461 | [specs/sentencepiece.md](specs/sentencepiece.md) | `ANCHOR-BACKFILL` | `CLAIM-LOAD-SENTENCEPIECE` | +| `SPEC-BPE-QUADRATIC-MERGE` | **The BPE merge loop is O(n^2) in pretoken length, on the request path, before the length check.** `src/vllm/tokenizer/bpe.cpp::BpeMerge` rescans every adjacent pair per merge and built one `std::string` key per probe through a `MergeKey` helper that this row deletes, on the premise its own comment states: "pretokens are tiny". FIVE of the seven pretokenizer rules return an unbounded run (`src/vllm/tokenizer/pretokenizer.cpp::MatchLetterRun` rule 2, `src/vllm/tokenizer/pretokenizer.cpp::MatchPunctRun` rule 4, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNewlines` rule 5, `src/vllm/tokenizer/pretokenizer.cpp::MatchWsNotBeforeNonSpace` rule 6, `src/vllm/tokenizer/pretokenizer.cpp::MatchWs` rule 7); only rule 3 `MatchNumbers` is capped and only rule 1 `MatchContraction` is bounded by its own alternation, and on the SentencePiece family `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp` merges the WHOLE prompt as one word because Mistral and Gemma declare `split: false`. MEASURED at `31f93787c`, min-of-k on a CONTENDED 20-core box, so these are contended minima and not idle-host constants, and EACH figure carries its own load: 65,535 bytes of one repeated character costs 24.4-45.8 s of one core at load average 25-90; 64 KB of ordinary English prose through the committed Mistral golden costs 25.3 s AT LOAD AVERAGE 4-12 against HF `tokenizers` 0.22.2's 10.1 ms on the same file for byte-identical identifiers, growing n^2.0. A confirmation run at load 23-57 read 37.6 s where the 65,535-byte figure reads 24.4 s, and a fourth reading through the committed harness `tools/bench/bpe_encode_cost.cpp` moved the 8 KB English figure about 1.7x at load 194, so the SHAPE is the result and the constants move with the box. `src/vllm/v1/engine/input_processor.cpp::ValidatePromptLen` runs FIVE LINES AFTER the encode, so `max_model_len` bounds none of it, and `/tokenize` reaches the same path with no engine. This is a remote denial of service, not a latency curiosity. Fix mirrors HF `tokenizers` 0.22.2 `Word::merge_all` (heap over candidate merges, identifier-keyed merge table); a prototype is bit-identical to today's identifiers on 20 comparisons across BOTH committed goldens, all 20 of which also match HF `tokenizers` 0.22.2 reading the same files, and 8,192 newlines fall from 580.44 ms to 2.60 ms. A pretoken cap is REFUSED: it changes the token identifiers. A GROWTH-RATIO gate is refused too, by operator ruling recorded in the spec's `## Tests to port` item 3: at load 176-268 the defective code's own 4x ratios spread 4.654 to 17.896 and OVERLAP the correct algorithm's, because the two halves of a ratio are independently preemptible. The absolute cost bound of item 2 carries the timing gate alone, on about three orders of magnitude of headroom. The string key is not a separable win either, on the DESIGN: upstream's staleness test compares `new_id` (`word.rs:197-205`) and its table is keyed on an identifier pair, so a step that rebuilds a `std::string` to name a pair cannot express the test; and removing a constant from a quadratic leaves a quadratic. How much the key alone is worth is NOT measured on an idle host and this row claims nothing about it | T0 | HF `tokenizers` 0.22.2 `tokenizers/src/models/bpe/word.rs:162-250` (`Word::merge_all`), `:28-35` (`Ord for Merge`), `tokenizers/src/models/bpe/mod.rs:9` + `model.rs:19,174-192` (identifier-keyed merge table and its load-time refusal) | `src/vllm/tokenizer/bpe.cpp:235` (`BpeMerge`, the heap mirroring `Word::merge_all`), `src/vllm/tokenizer/bpe.cpp:113` (`MergeRanks::Insert`) and `include/vllm/tokenizer/bpe.h:66` (the identifier-keyed table mirroring `MergeMap`), `src/vllm/tokenizer/tokenizer.cpp:108` (`InsertMerge`, the load-time vocabulary refusal, reached from `src/vllm/tokenizer/tokenizer.cpp::FromHfJson` AND `src/vllm/tokenizer/tokenizer.cpp::FromGguf`), `src/vllm/tokenizer/tokenizer.cpp:654` (`FinalizeTables`, the reserved unk-sentinel identifier); callers unchanged, `src/vllm/tokenizer/tokenizer.cpp:1199` (`EncodePlain`) and `src/vllm/tokenizer/tokenizer.cpp::EncodePlainSp`; request path `src/vllm/v1/engine/input_processor.cpp:266` (`process_inputs`), whose encode at line 260 runs five lines before its own length check at line 265 | `tests/vllm/test_bpe_equivalence.cpp:129` (80 entries x 2 goldens x 2 special-token modes = **320 id vectors, all matching HF `tokenizers` 0.22.2**, longest entry 8,034 bytes in ONE pretoken), `tests/vllm/test_bpe_equivalence.cpp:166` (the ONLY timing assertion: two 65,536-byte one-word inputs under an absolute 2,000 ms bound, landed RED at 23,918.5 ms and 23,077.3 ms against the shipped code); `tests/vllm/test_bpe.cpp:228` (leftmost tie on a long list), `:249` (stale entry, `new_id` not the pair), `:287` (no right neighbour), `:317,351` (the table), `:685` (the load-time refusal on BOTH surfaces, plus every committed golden still loading); goldens `tests/parity/goldens/bpe_equivalence/encodings.json`, generator `tools/parity/dump_bpe_equivalence.py`; `test_bpe` 24/24 971, `test_bpe_equivalence` 2/2 334, `test_tokenizer_metaspace_split` 7/7 28, `test_detokenizer` 12/12 221, `test_tokenizer_parity` 4/4 1175, `test_tokenizer_parity_mistral` 6/6 421, `test_tokenizer_parity_deepseek` 6/6 2461, `test_tokenizer_parity_gpt4o` 5/5 1000, `test_input_processor` 17/17 79; closing gate rerun and promotion [parity-ledger.md#L945](parity-ledger.md#L945) | [specs/bpe-quadratic-merge.md](specs/bpe-quadratic-merge.md) | `DONE` | `67823aee2` | | `LOAD-CONFIG-SURFACE` | Dataclass-for-dataclass config and serve-compatible flags. **Internal scheduler config versus serve surface:** local `SchedulerConfig` implements `max_num_batched_tokens`, `max_num_scheduled_tokens`, `max_num_seqs`, `long_prefill_token_threshold`, `enable_chunked_prefill`, `policy`, `scheduler_reserve_full_isl`, `watermark`, and `async_scheduling`; only upstream-named `--max-num-batched-tokens`, `--max-num-seqs`, and `--scheduling-policy` are public. The current upstream scheduler flag set also has `--max-num-scheduled-tokens`, `--long-prefill-token-threshold`, `--enable-chunked-prefill`, `--disable-chunked-mm-input`, `--scheduler-cls`, `--scheduler-reserve-full-isl`, `--watermark`, `--prefill-schedule-interval`, `--disable-hybrid-kv-cache-manager`, `--async-scheduling`, and `--stream-interval`; none has that public local spelling. Local config has no fields for upstream `runner_type`, `is_multimodal_model`, `disable_chunked_mm_input`, custom `scheduler_cls`, `disable_hybrid_kv_cache_manager`, `prefill_schedule_interval`, or engine-level `stream_interval`. **Cache config versus serve surface:** exact public spellings exist for `--block-size`, `--gpu-memory-utilization`, `--kv-cache-dtype`, and `--enable-prefix-caching`; equivalent behavior uses local `--kv-cache-memory` instead of upstream `--kv-cache-memory-bytes`, and local `--num-blocks` instead of upstream `--num-gpu-blocks-override`. Local block size defaults to 32 and refuses values that are not positive multiples of 16; upstream `CacheConfig` defaults to 16 and accepts any positive value at that layer. `--gpu-memory-utilization` is accepted but inert: it warns and falls back to 256 blocks because no profile run converts the fraction into capacity. Supported KV dtype values are `auto`, `bfloat16`, `fp8`, and `fp8_e4m3`; `float16` and `fp8_e5m2` parse but are refused by the store/read path, and `fp8_inc`, `fp8_ds_mla`, `turboquant_k8v4`, `turboquant_4bit_nc`, `turboquant_k3v4_nc`, `turboquant_3bit_nc`, `int4_per_token_head`, `int8_per_token_head`, `fp8_per_token_head`, and `nvfp4` are refused by name. The remaining upstream CacheConfig serve flags are absent: `--prefix-caching-hash-algo`, `--calculate-kv-scales`, `--kv-cache-dtype-skip-layers`, `--kv-sharing-fast-prefill`, `--mamba-cache-dtype`, `--mamba-ssm-cache-dtype`, `--mamba-block-size`, `--prefix-match-unit`, `--mamba-cache-mode`, `--replayssm-buffer-len`, `--use-replayssm`, `--kv-offloading-size`, and `--kv-offloading-backend`. Corresponding CacheConfig-only fields, plus derived `mamba_page_size_padded` and `skip_page_size_padded`, have no local public dataclass surface. No `CompilationConfig` dataclass or serve flags expose its modes, backends, custom ops, passes, Inductor settings, or CUDA-graph settings; internal CUDA-graph controls are separate behavior, not that upstream config surface | T0/T1 | `vllm/config/scheduler.py:26`; `vllm/config/cache.py:25`; `vllm/config/compilation.py:378` | `include/vllm/config/scheduler.h:67`; `src/vllm/config/scheduler.cpp:11`; `src/vllm/transformers_utils/hf_config.cpp:83`; limited flags incl. `max_num_seqs`/`max_num_batched_tokens` `examples/server/main.cpp:63,116,170` | `tests/vllm/test_scheduler_config.cpp:10`; `tests/vllm/test_hf_config.cpp:131,224,265`; `examples/CMakeLists.txt:34` | `planned: specs/config-surface.md` | `PARTIAL` | - | | `ENG-HF-MODEL-DOWNLOAD` | Fetch a checkpoint from HuggingFace so `--model` accepts a repository identifier and not a local path only. Two forms behind one flag, with the local path probed first: `org/repo` mirrors vLLM's full-snapshot download, and `org/repo:Q4_K_M` fetches one GGUF file, a form vLLM does not implement and which llama.cpp supplies as the secondary oracle. Mirrors vLLM's two-phase fetch (config JSON first, so a bad repository fails after 200 KB and not 60 GB) and its index-driven file selection, which reads `model.safetensors.index.json` and fetches the exact names in `weight_map` instead of every match for `*.safetensors`. Reference is resolved to a commit before any byte is fetched, so a moving `main` cannot change what a second run loads. Cache layout is HuggingFace's documented local cache, so a host holding a Python `huggingface_hub` cache gets a hit and `model_loader.cpp:279-303` reads it unchanged. Transport is the already-vendored cpp-httplib with OpenSSL, matching llama.cpp, which retired libcurl at `CMakeLists.txt:195` at stock tag `b10451`. NOT a verbatim port on one point: llama.cpp's `is_valid_oid` accepts any 40- or 64-character hexadecimal string, and on 17 August 2026 this project measured the tree API answering an unauthenticated caller on gated `Lightricks/LTX-2.5` with an `lfs.oid` of one character repeated 64 times, identical for all 14 large-file-storage files, so this row treats an untokenized `lfs.oid` as absent and proves completeness structurally instead | T1 | `vllm/model_executor/model_loader/weight_utils.py:345,349-357,459,472-490,493-496,506`; `vllm/model_executor/model_loader/default_loader.py:167-184`; `vllm/engine/arg_utils.py:839`; `vllm/config/model.py:183` at pin `5559679229`. Secondary oracle llama.cpp for the `:QUANT` form only, stock tag `b10451`, anchors re-verified by W1 at commit `10bf611e533d81f739128304991c5e133c6aebd8` | W1 and W2 only: `src/vllm/transformers_utils/hf_hub.cpp:1`, `src/vllm/transformers_utils/hf_cache.cpp:1`, reached from `src/vllm/entrypoints/model_loader.cpp:280`. No downloader, no `--model` grammar, no TLS option | `tests/vllm/transformers_utils/test_hf_cache.cpp:1`, `tests/vllm/transformers_utils/test_hf_hub.cpp:1` (in-process fake hub), `tests/vllm/entrypoints/test_dflash_draft_hf_cache.cpp:1` (the loader reach, red when the call site is deleted) | [hf-model-download.md](specs/hf-model-download.md) | `READY` | - | | `LOAD-LONGTAIL` | Sharded-state, tensorizer, RunAI, BitsAndBytes loaders | T3 | `vllm/model_executor/model_loader/__init__.py:33-65` | - | - | `planned: specs/loader-longtail.md` | `INVENTORIED` | - | From a2fdde9f64f15c8c4003858497d9fd5551dab878 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 29 Nov 2026 10:38:45 +0100 Subject: [PATCH 7/9] fix(ENG-CHUNKED-PREFILL): ride the hybrid empty slot_mapping through the slice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The consumer-reported Inkling-2-Mini gate SIGSEGV inside SliceCommonAttentionMetadata: inkling2_loop publishes its packed KV group as a SlidingWindowSpec (kind kSlidingWindow), so the runner's full_attn_group_id_ stays the -1 sentinel (the selector only takes kFullAttention/kMlaAttention groups, runner.cpp:846) and MakeCommonAttentionMetadata leaves the step's slot_mapping EMPTY (the `group < slot_mapping.size()` guard is false for the cast sentinel, backend.cpp:86-89). The whole-step path passes the empty vector through untouched; the chunk loop sliced `begin() + begin` on it, and the consumer's gdb frame was exactly that assign. T2's synthetic fixture always populated slot_mapping, so the shape was never covered — a fixture gap, not a transcription error. The fix mirrors the whole-step behavior: an empty step-level slot_mapping rides through empty; a populated one slices exactly as before. The new T2b case in test_prefill_chunks builds the crashing shape (10-token prefill, empty slot_mapping and block table) and was RED on the pre-fix header, GREEN after. Mutation checks: forcing the runner's chunk_plan empty (runner.cpp:3366) reds the F1 reachability case; reverting the guard reds T2b. Tree restored byte-for-byte after each mutation. Focused set green: test_prefill_chunks 6/6, test_prepare_inputs 9/9, test_runner 42/42 (CPU-only). FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [task] --- .../eng-chunked-prefill-20261128/PROCESS.md | 43 +++++++++++++++++++ include/vllm/v1/worker/gpu/prefill_chunks.h | 14 +++++- tests/vllm/v1/worker/test_prefill_chunks.cpp | 43 +++++++++++++++++++ 3 files changed, 98 insertions(+), 2 deletions(-) diff --git a/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md b/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md index 2b974c177..18af9290a 100644 --- a/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md +++ b/.agents/evidence/eng-chunked-prefill-20261128/PROCESS.md @@ -228,3 +228,46 @@ UNAMBIGUOUS in source — no NEEDS_DECISION. Transcribed from - Committed as `77472837c` on `row/ENG-CHUNKED-PREFILL` (`test(ENG-CHUNKED-PREFILL): reach the production chunk-forward loop and pin the 4+ub offset order`). No push. + +## 2026-11-29 — consumer crash repair: hybrid empty slot_mapping in the slice + +- Consumer report: the Inkling-2-Mini exact-token gate SIGSEGVs inside + `vllm::v1::SliceCommonAttentionMetadata` on ce128190e with + `EngineParams::prefill_ubatch=16`; knob unset → gate green. gdb frame named + the slice, before any token comparison. +- ROOT CAUSE (source-level, no live gate run needed — the W1 tree + `/tmp/inkling2-w1` @ 25983a7bd carries the shape): `MakeInkling2LoopKVCache` + publishes the packed KV group as a `SlidingWindowSpec` (kind kSlidingWindow, + `inkling2_loop_registry.cpp:122`); the runner's group selector only takes + kFullAttention/kMlaAttention groups (`runner.cpp:846`), so + `full_attn_group_id_` stays the -1 sentinel; `MakeCommonAttentionMetadata` + casts the sentinel and the `group < step.slot_mapping.size()` guard is false + (`backend.cpp:86-89`), leaving the whole-step `slot_mapping` EMPTY. The + whole-step path passes it through untouched (the hybrid forward reads pages + through the runner's per-group tables); the chunk loop sliced + `cam.slot_mapping.begin() + begin` on the empty vector (`prefill_chunks.h:139` + pre-fix) — the consumer's SIGSEGV. T2's fixture populated slot_mapping, so + the shape was never covered: a fixture gap, not a transcription error. +- RED FIRST: new case `T2b: SliceCommonAttentionMetadata rides the empty + slot_mapping through` (`test_prefill_chunks.cpp:216`) builds the crashing + shape (10-token prefill, empty slot_mapping + empty block table). Verbatim + red on the pre-fix header (this build's allocator turned the UB into garbage + rather than a segfault; the consumer's binary died in the same assign): + `test_prefill_chunks.cpp:234: ERROR: CHECK( chunk.slot_mapping.empty() ) is + NOT correct! values: CHECK( false )` — 1 failed / 6 cases, `Status: FAILURE!`. +- FIX (`include/vllm/v1/worker/gpu/prefill_chunks.h:139-149`): guard the slice + on `!cam.slot_mapping.empty()`; an empty step-level slot_mapping rides + through empty — byte-identical to what the whole-step path hands the model. + Populated slot_mappings slice exactly as before (T2 unchanged, green). +- GREEN after: test_prefill_chunks 6/6 (1291/1291), test_prepare_inputs 9/9, + test_runner 42/42 (1927/1927) — all `Status: SUCCESS!`, CPU-only. +- Mutation checks (tree restored byte-for-byte after each, `cmp` verified): + 1. runner.cpp plan forced empty → F1 + (`ENG-CHUNKED-PREFILL: execute_model runs ONE forward PER CHUNK`) RED + (7 assertions, 2 failed, `Status: FAILURE!`); restored. + 2. header guard reverted (`if (true)`) → T2b RED (14 assertions, 2 failed, + `Status: FAILURE!`); restored. +- Focused gate re-run green after both restores. Preflight `--staged` + (PATH=/usr/share/pwsh-7.6) launched; result recorded below. +- Consumer re-verification of the staged W1 gate is OWED to the consumer + (no committed W1 config in this row). diff --git a/include/vllm/v1/worker/gpu/prefill_chunks.h b/include/vllm/v1/worker/gpu/prefill_chunks.h index 631d6a205..65da9b747 100644 --- a/include/vllm/v1/worker/gpu/prefill_chunks.h +++ b/include/vllm/v1/worker/gpu/prefill_chunks.h @@ -136,8 +136,18 @@ inline CommonAttentionMetadata SliceCommonAttentionMetadata( chunk.max_seq_len = cam.max_seq_len; chunk.block_table_tensor = cam.block_table_tensor; chunk.block_table_num_cols = cam.block_table_num_cols; - chunk.slot_mapping.assign(cam.slot_mapping.begin() + begin, - cam.slot_mapping.begin() + end); + // HYBRID NO-FULL-ATTN-GROUP SHAPE (consumer crash, inkling2_loop): when the + // model's target attention group is not kFullAttention/kMlaAttention + // (inkling2_loop publishes its packed KV group as a SlidingWindowSpec), the + // runner's full_attn_group_id_ stays the -1 sentinel and + // MakeCommonAttentionMetadata leaves the step's slot_mapping EMPTY — and the + // whole-step path passes that empty vector through untouched. Mirror it: an + // empty step-level slot_mapping rides through empty. Slicing + // `begin() + begin` on the empty vector was the SIGSEGV. + if (!cam.slot_mapping.empty()) { + chunk.slot_mapping.assign(cam.slot_mapping.begin() + begin, + cam.slot_mapping.begin() + end); + } chunk.causal = cam.causal; chunk.uniform_spec_query_len = 0; return chunk; diff --git a/tests/vllm/v1/worker/test_prefill_chunks.cpp b/tests/vllm/v1/worker/test_prefill_chunks.cpp index 945a4583f..59880e972 100644 --- a/tests/vllm/v1/worker/test_prefill_chunks.cpp +++ b/tests/vllm/v1/worker/test_prefill_chunks.cpp @@ -200,6 +200,49 @@ TEST_CASE("T2: SliceCommonAttentionMetadata yields the chunk's token rows") { CHECK(begin == 10); } +// ── T2b: the hybrid no-full-attn-group shape (the consumer crash) ──────────── +// +// The Inkling-2-Mini crash (ENG-CHUNKED-PREFILL, consumer report, gdb frame +// `vllm::v1::SliceCommonAttentionMetadata`): inkling2_loop publishes its packed +// KV group as a `SlidingWindowSpec` (kind kSlidingWindow), so the runner's +// `full_attn_group_id_` stays the -1 sentinel (runner.cpp only selects +// kFullAttention/kMlaAttention groups) and `MakeCommonAttentionMetadata` leaves +// the step's `slot_mapping` EMPTY (the `group < slot_mapping.size()` guard is +// false for the cast sentinel). The whole-step path passes that empty +// slot_mapping through untouched — the hybrid forward reads its pages through +// the runner's per-group tables, not through cam.slot_mapping. The chunk loop +// must mirror that: an empty step-level slot_mapping rides through empty, never +// sliced (slicing `begin()+begin` on an empty vector is the SIGSEGV). +TEST_CASE("T2b: SliceCommonAttentionMetadata rides the empty slot_mapping through") { + CommonAttentionMetadata cam = OneReqCam(/*computed0=*/0, /*t=*/10, + /*block_table_cols=*/0); + // MakeCommonAttentionMetadata with the -1 group sentinel: no slot rows, no + // block table — exactly the shape the whole-step path hands the model. + cam.slot_mapping.clear(); + cam.block_table_tensor.clear(); + cam.block_table_num_cols = 0; + const auto plan = PlanPrefillChunks(16, 16, 1, 10, false, false, true, false); + REQUIRE(plan == std::vector{6, 4}); + + int begin = 0; + for (const int len : plan) { + const int end = begin + len; + const CommonAttentionMetadata chunk = + vllm::v1::SliceCommonAttentionMetadata(cam, begin, end); + // THE WHOLE-STEP MIRROR: the step carried no slot rows, so the chunk + // carries none either — not a sliced-out-of-empty-vector read. + CHECK(chunk.slot_mapping.empty()); + CHECK(chunk.block_table_tensor.empty()); + CHECK(chunk.block_table_num_cols == 0); + // Everything the step DID carry is still sliced normally. + CHECK(chunk.num_actual_tokens == len); + CHECK(chunk.query_start_loc == std::vector{0, len}); + CHECK(chunk.seq_lens == std::vector{end}); + begin = end; + } + CHECK(begin == 10); +} + // ── T3: the state hand-off across a chunk boundary ────────────────────────── TEST_CASE("T3: chunk k+1 reads the state slot chunk k wrote") { CommonAttentionMetadata cam = OneReqCam(0, 10, 4); From 6b7d296ec56e486f359a26f41c01388b5267aea0 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 30 Nov 2026 00:24:07 +0100 Subject: [PATCH 8/9] docs(ENG-CHUNKED-PREFILL): close the falsified parity premise and record the outcome MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The consuming Inkling-2-Mini W1 gate ran with chunking engaged (plan (1,4), two ModelRegistry::Forward calls, stderr-verified in the exact failing run) and the raw token gate did not move; the per-position pre/post-conv table is byte-identical with and without chunking. Our quantized kernels compute each output row independently, so the issue's premise — batch-shape-dependent matmul accumulation that exact parity could repair by matching the oracle's graph boundaries — is falsified by measurement. The residue's actual mechanism is the kernel class (repacked vs vec_dot), owned by the consuming row. This change closes ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J on that evidence, marks the spec DONE with an ## Outcome recording what was built, measured, rejected, and why the knob-0 default and opt-in VT-style knob keep their values, adds ## Now (seam landed, parity purpose falsified, W1 convergence re-owned by the consuming row's kernel-class wave), and notes in ## Owed that the seam's non-parity uses stand with no current consumer. Records only; no product code. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [task] --- .../ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md | 8 +-- .agents/specs/chunked-prefill.md | 50 ++++++++++++++++++- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md b/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md index a3e1f6c90..409e1c34a 100644 --- a/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md +++ b/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md @@ -1,14 +1,14 @@ ID: ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J Title: Prefill graph formation must follow the oracle server's ubatch chunking Row: ENG-CHUNKED-PREFILL -State: OPEN +State: CLOSED Kind: bug GitHub: - Mirror: PENDING Availability: FULL Created: 2026-11-27 -Updated: 2026-11-27 -Closed: - +Updated: 2026-11-29 +Closed: 2026-11-29 ## Problem @@ -16,4 +16,4 @@ Our CPU prefill computes projections one token at a time (per-token matvec), so ## Resolution -- +Falsified by measurement (2026-11-28, consumer-measured): the premise that divergence comes from batch-shape-dependent matmul accumulation fixable by matching the oracle's graph boundaries does not hold on our side. The consuming Inkling-2-Mini W1 raw token gate ran with chunking ENGAGED at the oracle shape (knob=16): the runner's chunk plan was (1,4) for the 5-token prompt, two ModelRegistry::Forward calls, stderr-verified in the exact failing run (probe record, /tmp/inkling2-w1/docs/bench-evidence/new-candidate-inkling2-w1-20261125/focused.log lines 1041-1050, worktree a2fdde9f6), and the raw gate did NOT move (j=5 flips 151663 vs oracle 161721, unchanged), with the per-position pre/post-conv table byte-identical with and without chunking. Our quantized kernels compute each output row independently, so the oracle server's graph formation does not change per-row numerics here. The residue's actual mechanism is the kernel CLASS (repacked vs vec_dot), owned by the consuming row. The seam itself landed mutation-verified and inert-by-default; the falsification closes this issue per the falsified-by-the-tree rule. diff --git a/.agents/specs/chunked-prefill.md b/.agents/specs/chunked-prefill.md index cacd6978b..a7f28ff9d 100644 --- a/.agents/specs/chunked-prefill.md +++ b/.agents/specs/chunked-prefill.md @@ -1,6 +1,15 @@ # Row: ENG-CHUNKED-PREFILL — Prefill graph formation mirrors the serving oracle's ubatch chunking -Status: ACTIVE (spec committed before implementation) +Status: DONE (spec committed before implementation; parity purpose falsified and closed 2026-11-29) + +## Now + +The seam landed mutation-verified and is inert by default (knob 0). The row's +parity purpose is falsified and closed: chunking does not change our per-row +numerics (see Outcome), so the W1 convergence gap is re-owned by the consuming +row's kernel-class wave (repacked vs vec_dot), not by graph formation. The +seam's remaining non-parity uses — mirroring oracle serving behavior for future +exact gates that pin `-b`/`-ub` — stand; no consumer currently depends on it. Issue: `.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md` Base SHA: `891c4f27d` Git integration: repository default — one pull request carries this spec and its @@ -188,3 +197,42 @@ Red-first, smallest failing test first: a follow-up once a consuming gate needs them). - vLLM-side anchor for the ubatch concept does not exist; if vLLM later gains a matching surface, reconcile this seam onto it and record the change here. +- The seam's remaining NON-PARITY uses stand: mirroring oracle serving behavior + for future exact gates that pin `-b`/`-ub`. No consumer currently depends on + it; the parity use that motivated the row is closed (falsified, below). + +## Outcome + +What was built: the engine-level prefill chunk seam (`n_ubatch` analog), +plumbed from `EngineParams`/CLI through the runner to the forward boundary, +with the pinned server prompt-fill checkpoint split rule, conv/recurrent-state +hand-off across boundaries, and focused tests T1–T4. Mutation-verified (the +reviewer mutated each claimed guarantee and the focused gate detected every +mutation) and inert by default. + +What was measured (2026-11-28, consumer-measured): chunking does not change our +per-row numerics. The consuming Inkling-2-Mini W1 raw token gate ran with +chunking ENGAGED at the oracle shape (knob=16) — chunk plan (1,4), two +`ModelRegistry::Forward` calls, stderr-verified in the exact failing run +(probe record: `/tmp/inkling2-w1/docs/bench-evidence/new-candidate-inkling2-w1-20261125/focused.log` +lines 1041–1050, worktree `a2fdde9f6`) — and the raw gate did not move +(j=5 flips 151663 vs oracle 161721, unchanged), with the per-position +pre/post-conv table byte-identical with and without chunking. Our quantized +kernels compute each output row independently, so the oracle server's graph +formation does not change per-row numerics on our side. + +What was rejected and why: the row's parity premise — that divergence comes +from batch-shape-dependent matmul accumulation and exact parity needs our +prefill chunking to match the oracle's graph boundaries — is FALSIFIED by that +measurement. The residue's actual mechanism is the kernel CLASS (repacked vs +vec_dot), pursued by the consuming row, not this one. Issue +`ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J` closed on that evidence 2026-11-29. + +Why each default keeps its value: the knob defaults to 0 (inert) so the +declared default-path inertness contract holds — no existing gate or benchmark +changes behavior, which R3 required. The VT-style knob stays opt-in rather than +being removed: it is a faithful llama-server-behavior mirror (the pinned +checkpoint split rule), kept as the instrument for future llama.cpp-parity +gates that pin `-b`/`-ub`. The Gates section's expected W1 flip (151663 → +161721 with chunking) did not occur; that record stands as falsified evidence, +not a pending claim. From 471e0ee480b9af19aec77f7b59ffb33c50865059 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 30 Nov 2026 00:24:34 +0100 Subject: [PATCH 9/9] docs(ENG-CHUNKED-PREFILL): correct the closure record after the second falsification The issue resolution and spec Outcome named the kernel class (repacked vs vec_dot) as the residue mechanism; the consuming row falsified that too within the day (QuantRepackMatmul bit-exact to the ggml repack gemm on live rows, table unchanged when W1's projections route through it). Both premises are now measured-falsified; the mechanism is unidentified and the consuming row continues via a three-way against the oracle's own captured kproj inputs. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:zai/glm-5.3-flash [maki] --- .../ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md | 2 +- .agents/specs/chunked-prefill.md | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md b/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md index 409e1c34a..65fa9b78c 100644 --- a/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md +++ b/.agents/issues/ENG-CHUNKED-PREFILL/ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J.md @@ -16,4 +16,4 @@ Our CPU prefill computes projections one token at a time (per-token matvec), so ## Resolution -Falsified by measurement (2026-11-28, consumer-measured): the premise that divergence comes from batch-shape-dependent matmul accumulation fixable by matching the oracle's graph boundaries does not hold on our side. The consuming Inkling-2-Mini W1 raw token gate ran with chunking ENGAGED at the oracle shape (knob=16): the runner's chunk plan was (1,4) for the 5-token prompt, two ModelRegistry::Forward calls, stderr-verified in the exact failing run (probe record, /tmp/inkling2-w1/docs/bench-evidence/new-candidate-inkling2-w1-20261125/focused.log lines 1041-1050, worktree a2fdde9f6), and the raw gate did NOT move (j=5 flips 151663 vs oracle 161721, unchanged), with the per-position pre/post-conv table byte-identical with and without chunking. Our quantized kernels compute each output row independently, so the oracle server's graph formation does not change per-row numerics here. The residue's actual mechanism is the kernel CLASS (repacked vs vec_dot), owned by the consuming row. The seam itself landed mutation-verified and inert-by-default; the falsification closes this issue per the falsified-by-the-tree rule. +Falsified by measurement (2026-11-28, consumer-measured): the premise that divergence comes from batch-shape-dependent matmul accumulation fixable by matching the oracle's graph boundaries does not hold on our side. The consuming Inkling-2-Mini W1 raw token gate ran with chunking ENGAGED at the oracle shape (knob=16): the runner's chunk plan was (1,4) for the 5-token prompt, two ModelRegistry::Forward calls, stderr-verified in the exact failing run (probe record, /tmp/inkling2-w1/docs/bench-evidence/new-candidate-inkling2-w1-20261125/focused.log lines 1041-1050, worktree a2fdde9f6), and the raw gate did NOT move (j=5 flips 151663 vs oracle 161721, unchanged), with the per-position pre/post-conv table byte-identical with and without chunking. Our quantized kernels compute each output row independently, so the oracle server's graph formation does not change per-row numerics here. CORRECTION (2026-11-30): the kernel-class hypothesis was ALSO falsified the same day — vt::cpu::QuantRepackMatmul proved bit-exact to ggml_gemm_q8_0_4x8_q8_0 on live rows (0/6400), and routing W1's Q8_0 projections through the repack class left the per-position table byte-for-byte unchanged. With inputs ULP, kernels bit-exact, and shapes engaged, the residue mechanism remains UNIDENTIFIED; the consuming row continues the hunt via a three-way against the oracle's own captured kproj inputs (fused-projection suspect), and owns the residue. The seam itself landed mutation-verified and inert-by-default; the falsification closes this issue per the falsified-by-the-tree rule. diff --git a/.agents/specs/chunked-prefill.md b/.agents/specs/chunked-prefill.md index a7f28ff9d..db103f339 100644 --- a/.agents/specs/chunked-prefill.md +++ b/.agents/specs/chunked-prefill.md @@ -224,9 +224,13 @@ formation does not change per-row numerics on our side. What was rejected and why: the row's parity premise — that divergence comes from batch-shape-dependent matmul accumulation and exact parity needs our prefill chunking to match the oracle's graph boundaries — is FALSIFIED by that -measurement. The residue's actual mechanism is the kernel CLASS (repacked vs -vec_dot), pursued by the consuming row, not this one. Issue -`ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J` closed on that evidence 2026-11-29. +measurement. CORRECTION (2026-11-30): the kernel-class hypothesis was also +falsified the same day (QuantRepackMatmul bit-exact to the ggml repack gemm on +live rows; routing W1's Q8_0 projections through it left the table unchanged), +so the residue mechanism is UNIDENTIFIED and the consuming row continues via a +three-way against the oracle's own captured kproj inputs. Issue +`ISSUE-LOCAL-01M8FKEEA4VJBDK75035DR365J` closed on the falsification evidence +2026-11-29; this correction 2026-11-30. Why each default keeps its value: the knob defaults to 0 (inert) so the declared default-path inertness contract holds — no existing gate or benchmark