Repository navigation
feat(convert): add official Unsloth MXFP and NVFP4 maps for Qwen3.5/3.6 - #96
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_7e5322ae-da02-4df7-a546-ac5ccd675756) |
Summary
Recipe maps
--q-recipe unsloth --q-mxfp: early FFNs use MXFP4 4/32--q-recipe unsloth --q-mode nvfp4: early FFNs use NVFP4 4/16lm_headuse MXFP8 8/32This follows the official Unsloth Qwen3.6 NVFP4 class map, substituting MXFP4/MXFP8 only for the Apple-oriented path.
Root cause
The previous
--q-mxfppath mechanically upgraded legacy Dynamic 2.0 affine decisions, leaving several sensitive classes as 5/6/8-bit affine instead of applying the official float-class map. The existing DGX path similarly promoted only legacy 4-bit decisions to NVFP4. Both entry points also needed an explicit Qwen family-and-shape gate so Qwen-specific MXFP heads could not be emitted for incompatible model families.Validation
cargo test -p mlx-core --lib convert::tests— 141 passed, 1 ignoredcargo clippy -p mlx-core --lib -- -D warningscargo fmt --checkgit diff --checkLocal generated artifacts (not committed):
Note
Medium Risk
Changes quantization outputs for Unsloth +
--q-mxfp/nvfp4on Qwen hybrids; gating limits blast radius, but wrong gate logic could mis-quantize or leave sensitive layers in unexpected formats.Overview
Adds official Unsloth float-class quantization for verified Qwen3.5/Qwen3.6 hybrid checkpoints when using
--q-recipe unslothwith either--q-mxfp(early FFNs → MXFP4, high classes → MXFP8) or--q-mode nvfp4(early FFNs → NVFP4 4/16, same MXFP8/BF16 split). This replaces the prior path that only mechanically upgraded legacy Dynamic 2.0 affine decisions.Gating: Activation requires matching config family, requested model type, and hybrid tensor shape (full attention + GDN keys). Non-Qwen, mismatched, or plain affine Unsloth inputs still use Dynamic 2.0 plus
apply_mxfp_upgrade/apply_nvfp4_upgrade.Scope: The new predicate covers layer-depth rules (final eight FFNs MXFP8), MoE/shared experts,
lm_headMXFP8, and BF16 exclusions (embeddings, routers, GDN a/b, vision, MTP). The same selector is wired in SafeTensors (convert.rs) and GGUF (is_qwen35_hybrid_gguf).CLI/docs: Help and convert logs describe the official maps as requested until the backend verifies family/shape; tests cover messaging and flag forwarding.
Reviewed by Cursor Bugbot for commit 5d75264. Bugbot is set up for automated code reviews on this repo. Configure here.