Skip to content

[Experiment][SM70] Qualify E4M3 KV with MTP3 - #16

Draft
Leonccaa wants to merge 47 commits into
mainfrom
integration/ct252-e4m3-mtp-c4-20260915
Draft

Leonccaa wants to merge 47 commits into
mainfrom
integration/ct252-e4m3-mtp-c4-20260915

Conversation

@Leonccaa

@Leonccaa Leonccaa commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Problem and resulting behavior

Qwen4Exp QSA rejected every E4M3 target KV configuration that also had a speculative drafter, even though the check recorded the original MTP0 qualification boundary. This draft removes that admission-only check and records the additional runtime work required for a safe MTP3 configuration.

The current branch now:

  • permits the combined configuration to reach real SM70 qualification;
  • finalizes QSA scale state for standalone MTP loading and refuses an E4M3 draft whose calibrated K/V scales are missing;
  • allocates the Flash-V100 XQA temporary output in FP32 for E4M3 KV, matching the native ABI;
  • honors speculative_config.kv_cache_dtype in the Model Runner V2 Eagle/MTP loader.

The SM70, FP16 activation, TP4, cache-format, and calibrated target-scale gates remain intact.

Integration baseline

Duplicate-work check

Searched both 1CatAI/1Cat-vLLM and Leonccaa/1Cat-vLLM for E4M3, MTP, and QSA work. 1CatAI#639 admits checkpoint-native FP8 MTP expert weights under pipeline parallelism; it does not change target KV dtype or the QSA E4M3/MTP0 admission check.

Validation

Static and CPU checks

  • Changed-file pre-commit passed after each change, including Ruff, format, mypy, SPDX, configuration validation, and repository checks.
  • Initial focused CPU test bodies: 17 passed and 7 CUDA cases skipped. The no-GPU host reported 16 teardown-only errors when the shared cleanup fixture called the accelerator API.
  • Draft scale/XQA workspace tests: 2 passed in the release container.
  • MRV2 draft KV override and Eagle weight-sharing tests: 8 passed in the release container.
  • Full native CPU build completed without OOM; 15 native modules and all manifest-tracked Python files passed the release-image hash/import verifier.

CT252 runtime findings

The runtime used the existing Qwen3.8 Flash-Next AWQ g32 target, native FP8 MTP3 weights, TP4, 262,144 max context, 8,192 batched-token budget, C4, and 32 GiB CPU KV offload.

  1. Target and draft both inherited E4M3: the service started, loaded all 24/24 calibrated target K/V scales, captured the C4/mixed grouped-XQA graphs, and allocated 867,200 GPU KV tokens (3.31 full 262,144-token requests). The draft checkpoint had 0/2 QSA K/V scales. Runtime acceptance failed: the [Bugfix][MRV2] Backport phase-aware decode graph dispatch 1CatAI/1Cat-vLLM#637 804-token regression returned duct plus repeated punctuation instead of OK; all four short concurrent responses were wrong or empty; forced tool choice returned HTTP 500 after the grammar rejected token 0; speculative acceptance was 0/510 drafted tokens.
  2. E4M3 target with explicit FP16 draft KV: after fixing MRV2 to honor the draft override, the scale failure disappeared and target/draft weights loaded. KV planning then failed with CSA+linear layer 48 violates cache geometry, showing that the current cache grouper cannot build this mixed target/draft cache layout.
  3. Rollback control: the preserved [Bugfix][MRV2] Backport phase-aware decode graph dispatch 1CatAI/1Cat-vLLM#637 FP16 target-KV/MTP3/C2 instance returned the same 804-token probe as exact OK in 0.58 seconds. This distinguishes the new E4M3/MTP interaction from the original [Bugfix][MRV2] Backport phase-aware decode graph dispatch 1CatAI/1Cat-vLLM#637 K+1 prefill/decode classification bug.

Status

This PR remains draft. It is useful as the integration and evidence branch, but neither tested draft-cache arrangement is production-safe yet. The next gate is either calibrated E4M3 scales for the MTP QSA layer or cache grouping support for an FP16 draft beside an E4M3 target, followed by the same 804-token, tool-call, C4, and business-workload acceptance.

AI assistance from OpenAI Codex was used to inspect the dependency stack, prepare the integration branch, implement the changes, and run validation. Leon requested the configuration experiment and will review the result before production acceptance.

Leonccaa and others added 30 commits September 10, 2026 13:57
Assisted-by: Codex
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Assisted-by: Codex
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Assisted-by: Codex
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Assisted-by: Codex
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Recycle uncached scratch before cached blocks and add opt-in sparse checkpoint admission while preserving both replay boundaries.

Assisted-by: OpenAI Codex

Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Recycle uncached scratch before cached blocks and add opt-in sparse checkpoint admission while preserving both replay boundaries.

Assisted-by: OpenAI Codex

Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Assisted-by: OpenAI Codex
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Express the opt-in interval in manager blocks so model-specific block sizes do not require token-unit conversion. Cover portable intervals and dense admission across four block sizes.

Co-authored-by: OpenAI Codex <noreply@openai.com>

Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Express the opt-in interval in manager blocks so model-specific block sizes do not require token-unit conversion. Cover portable intervals and dense admission across four block sizes.

Co-authored-by: OpenAI Codex <noreply@openai.com>

Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Adapt vLLM #45845, #47782, #53945 and #54713 to the 1Cat aligned-state layout. Replace custom interval environment variables with upstream token-based CacheConfig semantics.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Adapt vLLM #45845, #47782, #53945 and #54713 to the 1Cat aligned-state layout. Replace custom interval environment variables with upstream token-based CacheConfig semantics.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Preserve logical event ranges and admit completed decode boundaries before the cache horizon advances. Add regression coverage and repair baseline CI typing and conflicting header checks.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Preserve logical event ranges and admit completed decode boundaries before the cache horizon advances. Add regression coverage and repair baseline CI typing and conflicting header checks.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Adapt the prefix-cacheable grouping invariant from vllm-project/vllm#54743 to the 1Cat offload layout. Preserve original worker group IDs and exact Mamba boundary stores.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Keep group-local block IDs in disjoint CPU tensor pools. Derive matching scheduler and worker budgets from physical tensor sharing instead of simplified per-layer specs. This avoids evicting attention prefixes while other group slots waste the same RAM budget.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Forward child lifecycle hooks and exercise fresh-process restoration, eviction, and truncated-file handling through existing tier managers. Document the remaining GPU serving and persistent namespace gates.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Reuse existing strided mmap views and transfer handlers. Verify scheduler and worker slice visibility plus cleanup after initialization failures. Tiering spec serving integration remains gated.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Compose existing primary and secondary tier managers per group with failure cleanup. Namespace filesystem cache by declared physical layout and validate spec routing, restart recovery and unsupported topology. GPU serving acceptance remains pending.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Workers can create shared mappings before the scheduler and exit without unlinking. Assign scheduler final unlink responsibility and keep repeated cleanup harmless. Validated with shared-region and grouped-tiering CPU tests; real shutdown acceptance pending.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Batch KV transfers require registered host memory. Do not continue after cudaHostRegister failure and defer the error to a later kernel or transfer. Reuse the existing construction cleanup path.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Document RAM eviction, filesystem restart and pressure under MTP0/MTP3, ordinary single-group output comparisons, and the observed host-registration failure boundary.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Roll back newly reserved slots through complete_store(success=False) before returning None, preserving scheduler retry cursors. Cover asymmetric pressure, reservation reuse, and existing in-flight writes.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Exercise real LMCache conversion with fork cache specs and document the known QSA scratch exclusion gap using a strict expected failure. This does not claim serving or GPU acceptance.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Leonccaa and others added 17 commits September 13, 2026 09:43
Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
…al junctions

Converge this PR on the offload side of sparse Mamba retention; the core
policy (prefix_cache_retention_interval, replay boundaries, shared-prefix
junctions, reachable_block_mask) comes from PR 1CatAI#617, on which this branch
is now stacked.

- Grouped CPU pools carry per-group slot counts. Mamba state slots are
  derived from MambaManager.reachable_block_mask for a reference request
  length (mamba_state_slots_reference_tokens, default max_model_len) plus
  one junction allowance per request, so RAM holds the states the GPU
  mask admits instead of one state slot per token slot. On the 16 GiB
  TP4 Flash-Next layout the default policy gives 390 token slots and 10
  state slots per group (4.6 contexts of 64K) versus 107/107 dense.
- The offloading connector records a shared-prefix junction on the
  request when the host tier holds a longer full-attention prefix than a
  sparse group can serve, so the state is materialized, kept and offloaded
  and the next sibling hits after a restart or GPU eviction.
- Shared regions, tier managers and worker tensors honor per-group slot
  counts; the design doc describes the sizing and the validation history.

Offload suites plus 1CatAI#617's retention tests: 300 passed, 2 skipped.
Changed-file pre-commit including mypy passed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Wait for the current compute stream in both offload directions. H2D destination pages may still be undergoing zeroing when a load is submitted. Add CUDA regressions for contiguous and strided pages and stream reuse.

Co-authored-by: Codex <noreply@openai.com>

Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Adapt vllm-project/vllm#51865 (0a94d85a66499cad8297ead86a470967de5c0212)
to the current target and Eagle/MTP draft paths. A K+1-token prompt tail
must not replay a decode graph merely because its shape matches.
Preserve dummy capture and genuine decode classification.

Co-authored-by: Rahul Chalamala <22563365+rchalamala@users.noreply.github.com>
Co-authored-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: Janelle Cai <janelle.cai@modal.com>
Assisted-by: OpenAI Codex
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
(cherry picked from commit 1892fb2)
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
(cherry picked from commit fb808b7)
…ck-size factor

Two review findings on the offload side of sparse Mamba retention:

- The core offers each Mamba align boundary-state hand-off once. With
  semantic retention the state pools hold only a few slots per group, so
  prepare_store() can fail while those slots are pinned by in-flight loads,
  stores or a filesystem cascade; the offer was logged and lost while the
  attention blocks were stored, leaving a prefix that could never be
  restored. Pending offers now stay on the request and are retried every
  step (the source block remains owned by the request); a re-offer of the
  same boundary supersedes the older entry, and offers still pending when
  the request finishes or is preempted are dropped with a warning because
  the block is about to be reused.

- Sparse retention keeps states on the GPU block grid while boundary
  stores need offloaded-block alignment, so kv_connector_extra_config
  block_size above the GPU block size would offload attention blocks
  without their Mamba state for most prompt lengths. SchedulerOffloadConfig
  now rejects that combination at start-up (dense retention still works);
  retaining offload-aligned checkpoints needs the core mask to learn the
  offload alignment and is left to the core policy.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
(cherry picked from commit 0b2d937)
Remove the validation-only MTP0 admission gate while retaining the SM70, FP16, TP4, calibrated-scale, and KV-quantization checks. The combined target and drafter path will be qualified end to end on CT252.

Assisted-by: OpenAI Codex
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Finalize standalone MTP QSA scale state after draft loading. Keep calibrated target scale validation strict while allowing explicit unit-scale fallback for uncalibrated speculative draft shards.

Assisted-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Separate cached XQA workspaces by KV format and allocate FP32 temporary output for E4M3, matching the Flash-V100 native ABI.

Assisted-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Fail fast when a Qwen4Exp speculative draft inherits E4M3 KV without calibrated QSA scales. Point operators to the supported independent FP16 draft cache instead of silently using unit scales that produced invalid proposals during CT252 qualification.

Assisted-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Build Eagle and MTP draft attention layers with the speculative KV cache override. This lets an FP16 draft cache remain independent when the target cache uses E4M3, matching the existing Model Runner V1 contract.

Assisted-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant