Skip to content

fix: opt Qwen3-Next out of no-ID chunked prefill - #2295

Merged
inureyes merged 3 commits into
mainfrom
fix/issue-2285-qwen3-next-chunking
Oct 13, 2026
Merged

inureyes merged 3 commits into
mainfrom
fix/issue-2285-qwen3-next-chunking

Conversation

@inureyes

@inureyes inureyes commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Opt Qwen3-Next out of chunked prefill for cache-less no-sequence-ID callers, whose multi-token forwards reset the model-owned GatedDelta and KV state.
  • Add a one-layer GatedDelta model loaded through Qwen3NextModel::from_weights that proves independent no-ID prompts reset to offset 3 while a stable sequence ID continues to offset 5.

Validation

  • The CUDA mlxcel and mlxcel-surgery library test graph builds successfully, and qwen3_next_loaded_model_chunking_contract_is_safe passes 1/1 under the GPU lock.
  • Rust formatting and diff checks pass; independent implementation review reports no findings.
  • The repository contract gate passes, including 123 Python tests and 49 WebUI contract tests. An initial timing-sensitive GPU guard sample missed a short foreign process during concurrent native compilation; its isolated retry and the broad contract rerun passed without code changes.

Current DirectEngine prefill keeps one stable sequence ID across its pieces, so its state handling is safe. PrefillCaps consumes this model-wide false capability for every token-ID prefill plan, however, so DirectEngine and cache-less callers both build one whole-prompt graph instead of bounded chunks and can use more transient memory for long prompts.

Closes #2285

Qwen3-Next resets its model-owned GatedDelta and KV state when a multi-token forward carries no sequence ID. Advertise the conservative single-pass policy so cache-less callers cannot silently discard earlier prompt pieces while preserving independent-prompt resets and stable sequence-ID continuation.

Add a one-layer GatedDelta model loaded from deterministic nonzero weights. The regression forces both paths and verifies offset 3 after two independent no-ID prompts and offset 5 after two forwards with one sequence ID. The CUDA library test graph builds, the focused GPU test passes, and formatting and diff checks pass.

Refs #2285
@inureyes inureyes added status:review Under review type:bug Bug fixes, error corrections, or issue resolutions priority:medium Medium priority area:models Model architectures, weights, loading, metadata area:inference Generation, sampling, decoding (incl. speculative, DRY) labels Oct 13, 2026
`PrefillCaps` consumes the model-wide chunking capability for every token-ID prefill plan. Clarify that DirectEngine's stable sequence ID makes its state handling safe while the false capability still forces DirectEngine and cache-less callers to build one whole-prompt graph.

This changes only the source comment, PR documentation, and bilingual reports. The prior focused GPU test and contract results remain applicable.

Refs #2285
@inureyes
inureyes merged commit 90d78fc into main Oct 13, 2026
27 checks passed
@inureyes inureyes added status:done Completed and removed status:review Under review labels Oct 13, 2026
@inureyes
inureyes deleted the fix/issue-2285-qwen3-next-chunking branch October 13, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:inference Generation, sampling, decoding (incl. speculative, DRY) area:models Model architectures, weights, loading, metadata priority:medium Medium priority status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(qwen3_next): correct the no-ID chunked prefill contract

1 participant