File size: 3,055 Bytes
a4144b9
 
 
 
 
 
 
 
 
 
 
 
1a0dcd0
 
 
 
 
a4144b9
d8e4208
 
 
a4144b9
 
 
 
 
 
 
1a0dcd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a4144b9
 
1a0dcd0
 
a4144b9
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
library_name: mlx
license: apache-2.0
license_link: https://huggingface.co/Qwen/Qwen3.6-35B-A3B/blob/main/LICENSE
pipeline_tag: text-generation
tags:
- mlx
base_model: Qwen/Qwen3.6-35B-A3B
---

[Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B) optimized for MLX.

- 4-bit baseline with important layers at 8-bit and BF16.
- This quant does not support image input.

I ended up selecting two winners from my trials. This is the speed+ version, and
here's the [quality+](https://huggingface.co/spicyneuron/Qwen3.6-35B-A3B-MLX-5.4bit) version.

**EDIT:** Added an [optional chat template patch](https://huggingface.co/spicyneuron/Qwen3.6-35B-A3B-MLX-4.8bit/blob/main/chat_template.optional.jinja)
to improve prompt caching with thinking disabled. 

# Usage

```sh
# Start server at http://localhost:8080/v1/chat/completions
uvx --from mlx-lm mlx_lm.server \
  --host 127.0.0.1 \
  --port 8080 \
  --model spicyneuron/Qwen3.6-35B-A3B-MLX-4.8bit
```

# Benchmarks

metric | mlx-community/ Qwen3.6-35B-A3B-4bit | mlx-community/ Qwen3.6-35B-A3B-4.4bit-msq | 4.8 bit (this model) | 5.4 bit
--- | --- | --- | --- | ---
bpw | 4.503 | 4.787 | 4.788 | 5.438
peak memory (1024/512) | 20.683 | 21.922 | 21.928 | 24.741
prompt tok/s (1024) | 2719.4470 ± 15.2250 | 2695.9370 ± 12.5260 | 2734.5260 ± 3.8810 | 2665.3060 ± 11.4520
gen tok/s (512) | 108.4990 ± 0.4910 | 94.2940 ± 0.3650 | 97.2820 ± 0.0800 | 89.4920 ± 0.2610
kl divergence | 0.0838 ± 0.0008 | 0.1689 ± 0.0015 | 0.0244 ± 0.0004 | 0.0189 ± 0.0003
perplexity | 4.6150 ± 0.0320 | 4.2490 ± 0.0280 | 4.6410 ± 0.0320 | 4.6440 ± 0.0320
hellaswag | 0.5560 ± 0.0220 | 0.5780 ± 0.0220 | 0.5440 ± 0.0220 | 0.5370 ± 0.0110
piqa | 0.7940 ± 0.0180 | 0.7920 ± 0.0180 | 0.7920 ± 0.0180 | 0.7980 ± 0.0180
winogrande | 0.7260 ± 0.0200 | 0.7400 ± 0.0200 | 0.7120 ± 0.0200 | 0.7100 ± 0.0200

I've moved over to using speed + KL divergence as my primary optimization metrics.
Hellaswag, PIQA, Winogrande, and perplexity are kept as sanity checks, though these require
high sample sizes to get usable signal.

Tested on a Mac Studio M3 Ultra with:

```
mlx_lm.convert --hf-path Qwen/Qwen3.6-35B-A3B --mlx-path ./mlx && mlx_lm.kld --baseline-model ./mlx
mlx_lm.perplexity --sequence-length 512 --seed 123
mlx_lm.benchmark --prompt-tokens 1024 --generation-tokens 512 --num-trials 5
mlx_lm.evaluate --tasks hellaswag --seed 123 --num-shots 0 --limit 500
mlx_lm.evaluate --tasks piqa --seed 123 --num-shots 0 --limit 500
mlx_lm.evaluate --tasks winogrande --seed 123 --num-shots 0 --limit 500
```

`mlx_lm.kld` is still an [open PR](https://github.com/ml-explore/mlx-lm/pull/1146).

# Methodology

Quantized with a [mlx-lm fork](https://github.com/ml-explore/mlx-lm/pull/922), drawing inspiration from Unsloth/AesSedai/ubergarm style mixed-precision GGUFs.
MLX quantization options differ than llama.cpp, but the principles are the same:

- Sensitive layers like MoE routing, attention, and output embeddings get higher precision
- More tolerant layers like MoE experts get lower precision