Repository navigation
feat: load a Qwen 3.5 base checkpoint's bundled MTP head - #3673
Merged
Merged
Conversation
inureyes
added a commit
that referenced
this pull request
Dec 2, 2026
Qwen 3.5 / 3.6 / 3.8 base checkpoints carry their MTP head inline as raw mtp.* tensors, but mlxcel could only use a head split into a qwen3_5_mtp directory. Detect a native MTP source from the checkpoint config (mtp_num_hidden_layers or num_nextn_predict_layers at the root or under text_config) or from mtp.* tensor presence, and build the existing Qwen35MtpDraftModel from only those tensors through the index-filtered loader. The detection sits after every family-specific arm so a bundled drafter is not captured by it, and a qwen3_5_text root is read with the root config as the text config. Other base families that declare a head but have no bundled runtime (deepseek_v3, glm4_moe_lite, the qwen3_5_moe aliases) now fail with a named NoBundledDrafterRuntime instead of the Gemma 4 assistant loader, and glm4_moe_lite points at mlxcel split-mtp. Refs #2400
inureyes
force-pushed
the
feature/issue-2400-bundled-qwen35-mtp
branch
from
December 2, 2026 01:21
aa8297b to
9ee1713
Compare
inureyes
marked this pull request as ready for review
December 2, 2026 01:21
inureyes
added a commit
that referenced
this pull request
Dec 2, 2026
#3673 added MLXCEL_TEST_QWEN35_MTP_BASE in the qwen3_5_mtp drafter tests without documenting or allowlisting it, so the env-var-docs gate fails on main. It is the checkpoint path of an opt-in real-model test, the same as its MLXCEL_TEST_QWEN35_MTP_DRAFTER sibling, so it joins that allowlist group. Refs #3660
inureyes
added a commit
that referenced
this pull request
Dec 2, 2026
## Problem `main` is red on two jobs, both from the same cause: - `env var docs`: `MLXCEL_TEST_QWEN35_MTP_BASE` is read in `src/lib/mlxcel-core/src/drafter/qwen3_5_mtp/tests.rs` but is neither documented nor allowlisted. - `python tooling tests`: `test_check_env_var_docs.CheckEnvVarDocsTests.test_repository_passes` fails with `AssertionError: 1 != 0 : env-var-docs: FAIL`, the same check under pytest. The name arrived with #3673's real-checkpoint gate and was missed because the per-unit pre-merge checks did not include `scripts/ci/check_env_var_docs.py`. ## Change Add `MLXCEL_TEST_QWEN35_MTP_BASE` to `ALLOWLIST` in `scripts/ci/check_env_var_docs.py`, in a new group mirroring the existing GLM-4.7-Flash MTP test-parameter group. It is test-only, so the allowlist is the correct path rather than a `docs/environment-variables.md` entry. ## Verification `python3 scripts/ci/check_env_var_docs.py` now exits 0: ``` env-var-docs: OK, 433 MLXCEL_* names in 3441 *.rs files under src/, 281 documented on docs/environment-variables.md, 152 allowlisted. ``` `pytest` is not installed in this environment, but `test_repository_passes` only asserts that this script exits 0, which is verified above. ## Note `cargo-clippy` and `OpenXLA feature compile` are also red on `main` and were red before #3673 merged (`cdfd25473`, `96f1c55c4`, `5526a0cfa`). They are not addressed here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2400
A Qwen 3.5 / 3.6 / 3.8 base checkpoint keeps its MTP head inline as raw
mtp.*tensors, but mlxcel could only draft with a head split into aqwen3_5_mtpdirectory, and it has no splitter for that family. This makes the checkpoint its own drafter:mlxcel generate -m <dir> --draft-model <dir>andmlxcel-server --model-draft <dir>read only themtp.*tensors through the index-filtered loader and build the existingQwen35MtpDraftModelfrom them, so the target's shards are not loaded twice.resolve_drafter_kindrecognizes a native MTP source frommtp_num_hidden_layersornum_nextn_predict_layers(root ortext_config) or frommtp.*tensor presence. The rule sits after every family-specific arm, skips model types already in the kind map, and excludesqwen4_exp, so a family with its own bundled drafter is not captured (issue #3262's DSpark arm belongs above it too). Aqwen3_5_textroot uses the whole root config as the text config (Neywa-Labs/mlx-vlm#2677). Base families that declare a head but have no bundled runtime (deepseek_v3,glm4_moe_lite,qwen3_5_moe,qwen3_5_moe_text) now return a namedNoBundledDrafterRuntimeinstead of the Gemma 4 assistant loader, andglm4_moe_litepoints atmlxcel split-mtp. An explicit--draft-kindkeeps priority with the existing mismatch warning.Validation:
cargo test --profile test-fast -p mlxcel-core drafter::: 348 passed, covering detection from config and tensors, refusal by family, thefrom_base_checkpointinventory, head-less and text-only fixtures, and the realQwen/Qwen3.5-0.8Bhead load (ignored test, run by hand).mlxcel generate -m models/Qwen3.5-0.8B --draft-model models/Qwen3.5-0.8B -p "Write a quicksort in Python." -n 128 --temp 0ran 51 MTP rounds with acceptance rate 0.507, and its completion was byte-identical to the run without--draft-model(258-character completion extracted from both runs).mlxcel-server --model models/Qwen3.5-0.8B --model-draft models/Qwen3.5-0.8Bserved 128 tokens through 33 MTP rounds with 95 accepted draft tokens (rate 0.969).cargo fmt --checkpasses.cargo clippy -p mlxcel-core --lib --tests -- -D warningspasses. Root clippy on the touched files reports nothing; the repository-wide root clippy is blocked by pre-existing lints insrc/vision/dense/preprocess.rsandsrc/vision/encoders/qwen3_vl_tests.rs, which this change does not touch.