Repository navigation
feat(dflash): allow MiniCPM-V 4.7 as a DFlash/DSpark target - #4737
Merged
Merged
Conversation
Allow MiniCPM-V 4.7 (minicpmv4_7) as a DFlash/DSpark target on the VLM engine. The gate keys on the top-level model_type; MiniCPM-V 4.7 is a VLM wrapper whose text backbone (qwen3_5_moe_text) is already supported. Adds the allow-list entry, names the model in the dflash_compatibility() message, a docs table row and a unit test for the allow-list.
jundot
approved these changes
Oct 24, 2026
jundot
left a comment
Owner
There was a problem hiding this comment.
I checked this against the mlx-vlm version oMLX pins. The MiniCPM-V 4.7 language model is a subclass of the Qwen3.5 MoE one, so DFlash runs through the same verify and rollback path that already works for Qwen3.5 MoE.
One small thing I'll fix on main after this is the runtime patch scope table, so a MiniCPM-V 4.7 load only applies the Qwen3.5 patches. LGTM, merging.
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
Allow MiniCPM-V 4.7 (
minicpmv4_7) as a DFlash/DSpark target on the VLM engine.Today the admin DFlash toggle refuses this model:
DFlash supports Qwen3, Qwen3.5/3.6, Laguna, MiMo V2, GLM-5.3, Gemma 4 and Muse Glimmer models (model_type='minicpmv4_7', engine='vlm').The gate keys on the top-level
model_type; MiniCPM-V 4.7 is a VLM wrapper (minicpmv4_7) whose text backbone isqwen3_5_moe_text, a family that is already supported. MiniCPM-V 4.7 itself has loaded since 0.7.1 (#4527, #4529).OpenBMB publishes a matching DSpark draft:
openbmb/MiniCPM-V-4.7-35B-A3B-DSpark(Apache-2.0, 778 MB,Qwen3DSparkModel,dflash_configwithprojector_type: dspark).Changes (3 files, +41/-2):
omlx/utils/model_loading.py: add"minicpmv4_7"to_DFLASH_BATCHED_MODEL_TYPES["vlm"]and name MiniCPM-V 4.7 in thedflash_compatibility()message. Nothing else keys on the model type:omlx/speculative/dflash/*has no model-type keys, andengine_pool, the admin routes andmodel_loadingall go throughdflash_batched_supported()/dflash_compatibility().docs/experimental/dflash_mlx_integration.md: supported-targets table row.tests/test_dflash_model_types.py(new): the allow-list and its message. Run against copies of the code: 4 of 7 cases fail without the change, all 7 pass with it.Related: #4508, #4525, mlx-vlm #2499 (merged, added the model) and mlx-vlm #2506 (draft, opt-in SIMD verification and DSpark for MiniCPM 1B and 35B-A3B).
Validation
Hardware and software: MacBook M4 Max, 36 GB, macOS 26.5.2; oMLX 0.7.1 release app (bundled mlx-vlm 0.7.8).
This change was validated on the 0.7.1 release, not on a build of current
main: the allow-list entry was applied in memory in a separate instance (port 7001, fresh base path, default model settings; the instance ran with--memory-guard offbecause the default guard rejected the 22 GB load on that fresh configuration), nothing in the app was modified. The allow-list block and message onmain(2ecf137) are identical to 0.7.1.Model:
mlx-community/MiniCPM-V-4.7-35B-A3B-mxfp4; draft:openbmb/MiniCPM-V-4.7-35B-A3B-DSparkas published. Settings:dflash_enabled=true,dflash_draft_model=<local path of the draft>; the log showsDFlash drafter loaded ... block=9 ... layers=[3,11,19,27,35]and "attached", with no "loading without DFlash" line and no traceback.Decode, same instance, model reloaded between runs: 5 fixed prompts (code, prose explanation, translation, ...), 400 new tokens each, greedy (temperature 0), thinking off, one request at a time:
Other checks with DFlash on (each run once):
tool_callsin both modes. Streaming was used by the 4k smoke request.Correctness: a 5-prompt temperature-0 comparison gives 14 of 15 text fields identical; the "math" answer diverges at character 151 (coherent, similar length). Plain mode also differs between a solo request and the same prompt inside a 2-way batch, so I read this as batched-verify numerics on mxfp4 rather than a DSpark problem, but I have not proven it. For comparison, mlx-vlm's own speculative loop on the same target and draft was bit-identical on all 5 prompts (67.3 -> 112.3 tok/s, 1.67x, 2.58 accepted tokens per round).
Not tested: contexts above ~4k; prefix-cache reuse with DFlash on; combination with Affine/TurboQuant KV compression or MoE expert offload; temperature above 0; chips other than M4 Max (the
_SPEC_CAPS_TARGET_TYPESpath is for other GPU generations); a build of currentmain; the new unit tests under pytest in a full checkout (I ran their bodies against copies of the code with a minimal stand-in forpytest.mark.parametrize).Reproduction: enable DFlash for the model with the draft path above, send greedy 400-token requests with DFlash off and on, and compare tok/s and the accepted-tokens line in the log. A script that drives mlx-vlm directly and the raw result files are available on request.
AI assistance: this change and its validation were prepared with AI assistance and run on my hardware; I take responsibility for it.
Checklist