Add Step 3.5 Flash model support with MTP#94
Open
janhilgard wants to merge 1 commit intowaybarrios:mainfrom
Open
Add Step 3.5 Flash model support with MTP#94janhilgard wants to merge 1 commit intowaybarrios:mainfrom
janhilgard wants to merge 1 commit intowaybarrios:mainfrom
Conversation
Step 3.5 Flash is a 196B MoE model (288 experts, top-8 routing, ~11B active params) with 3 MTP prediction layers. The MLX community 4-bit conversion strips MTP weights and lacks MTP-aware modeling code. This adds: - scripts/add_mtp_weights_step3p5.py: Downloads BF16 MTP shards from the original model, extracts layers 45-47, remaps to mtp.layers.*, quantizes to 4-bit, and installs the MTP modeling file - scripts/modeling_step3p5_mtp.py: Full MLX-native model implementation with MTP support (Step3p5MTP, Step3p5MTPLayer, Step3p5SharedHead) - Reasoning parser alias "step3p5" (reuses deepseek_r1 <think> parser) - Documentation updates in README.md and docs/reference/models.md Note: The custom modeling file is a workaround until ml-explore/mlx-lm#901 is merged upstream. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
scripts/add_mtp_weights_step3p5.py— downloads BF16 MTP shards, extracts layers 45-47, remaps tomtp.layers.*, quantizes to 4-bit, installs MTP-enabled modeling filescripts/modeling_step3p5_mtp.py— complete model implementation withStep3p5MTP,Step3p5MTPLayer,Step3p5SharedHead,mtp_forward,make_mtp_cachestep3p5(reusesdeepseek_r1<think>tag parser)Key differences from Qwen3-Next MTP (
add_mtp_weights.py)shared_headmtp.*passthroughmodel.layers.{45,46,47}.*→mtp.layers.{0,1,2}.*Usage
Note on custom modeling file
The MLX community 4-bit model ships without MTP support in its
modeling_step3p5.py. The script automatically installs an MTP-enabled version. This is a workaround until ml-explore/mlx-lm#901 is merged upstream.Test plan
add_mtp_weights_step3p5.pyon a freshmlx-community/Step-3.5-Flash-4bitdownloadmodel-mtp.safetensorsand updatedconfig.json--enable-mtpand confirm MTP speculative decoding works--reasoning-parser step3p5correctly extracts<think>tags🤖 Generated with Claude Code