Views
No views yet
1huggingface-cli download jdfelo/gemma-4-31B-v2-MLX-4bit run_mac.sh chat.html patch_mlx_vlm_fast_verify.py --local-dir .
2bash run_mac.sh1DRAFT=0 bash run_mac.sh # dense only, no drafter
2BLOCK=3 bash run_mac.sh # force a block size (auto by default)| Config | tok/s | speedup |
|---|---|---|
| dense 4-bit | 15.0 | 1.0x |
| MTP, stock pip mlx 0.31.2 | 20.4 | 1.4x |
| MTP + fast-verify patch | 24.6 | 1.6x |
| MTP + patch + fast mlx wheel | 31.8 | 2.1x |
patch_mlx_vlm_fast_verify.py. mlx-vlm's Gemma 4 is missing a hook its own MTP loop
looks for, so every verify round did K+1 sequential lm_head projections with a blocking
sync each. The patch adds the 9-line hook: one batched projection, one sync, same logits.
Idempotent, --revert undoes it.wheels/mlx-0.32.0.dev*.whl. A prebuilt mlx with the qmv_wide kernel
(PR #3764, merged upstream but not yet on
PyPI). Stock 0.31.2 re-reads the whole weight matrix once per verify row; qmv_wide reads it
once per round. Verify at block 4 drops from 142 ms to 95 ms. Built for Python 3.11 on
macOS 26 (Apple Silicon). On other setups, either build mlx from source
(pip wheel git+https://github.com/ml-explore/mlx --no-deps, after
xcodebuild -downloadComponent MetalToolchain) or skip it and stay at 24.6.1pip install -U "git+https://github.com/Blaizzy/mlx-vlm.git"
2python patch_mlx_vlm_fast_verify.py
3pip install --force-reinstall --no-deps "$(huggingface-cli download jdfelo/gemma-4-31B-v2-MLX-4bit wheels/mlx-0.32.0.dev20260702+e9463bb-cp311-cp311-macosx_26_0_universal2.whl)"
4
5python -m mlx_vlm server --host 127.0.0.1 --port 8080 \
6 --model jdfelo/gemma-4-31B-v2-MLX-4bit \
7 --draft-model mlx-community/gemma-4-31B-it-assistant-bf16 \
8 --draft-kind mtp --draft-block-size 4--draft-block-size 3 if you stayed on stock mlx 0.31.2. One-off generation works the
same way with python -m mlx_vlm generate ... --prompt "..." --temperature 0.~/.lmstudio/models/jdfelo/, load it, chat. LM Studio
can't run the MTP drafter, so use mlx-vlm for the fast path.1pip install -U mlx-lm
2mlx_lm.generate --model jdfelo/gemma-4-31B-v2-MLX-4bit --prompt "Hi" --max-tokens 128sudo sysctl iogpu.wired_limit_mb=36864 keeps the weights wired on a 48 GB Mac.
Ollama can't run this (it wants GGUF, these are MLX weights).