Views
No views yet
1pip install mlx-lm
2
3mlx_lm.generate --model mlx-community/GLM-5.1-DQ4plus-q8 --prompt "Hallo"We further proposeDQ3_K_M, a dynamic 3-bit quantization method that significantly outperforms traditionalQ3_K_Mvariant on various benchmarks, which is also comparable with 4-bit quantization (Q4_K_M) approach in most tasks.
dynamic 3-bit quantization method (DQ3_K_M) that outperforms the 3-bit quantization implementation inllama.cppand achieves performance comparable to 4-bit quantization across multiple benchmarks.
up and gate expert tensors are quantized to 4-bit, and the down expert to a mix of 5-bit and 6-bit. All the other tensors are kept at 8-bit. You could say that this quant has an 8-bit "brain" and 4-bit/5-bit/6-bit experts.convert.py file of mlx-lm on your system ( you can see the original code here ), replace the code inside def mixed_quant_predicate() with something like1 # Build a mixed quant like "DQ4plus-q8" similar to the "DQ3" of Arxiv paper https://arxiv.org/abs/2505.02390
2 # Quantitative Analysis of Performance Drop in DeepSeek Model Quantization
3 q_bits = 8
4 # For "switch experts"
5 if "switch_mlp.up_proj" in path:
6 q_bits = 4
7 if "switch_mlp.gate_proj" in path:
8 q_bits = 4
9 if "switch_mlp.down_proj" in path:
10 q_bits = 5
11 # Blocks up to 5 are higher quality
12 if index < 5:
13 q_bits = 6
14 # Every 5th block is "medium" quality
15 if (index % 5) == 0:
16 q_bits = 6
17 print("path:", path, "index:", index, "q_bits:", q_bits)
18 return {"group_size": group_size, "bits": q_bits, "mode": mode}mlx_lm.convert --hf-path zai-org/GLM-5.1 --mlx-path GLM-5.1-DQ4plus-q8 -q --quant-predicate mixed_3_4