jc-builds commited on
Commit
22f69b9
·
verified ·
1 Parent(s): aa6527a

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +199 -0
README.md ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ - ja
7
+ - ko
8
+ - fr
9
+ - de
10
+ - es
11
+ - pt
12
+ - ru
13
+ - ar
14
+ - it
15
+ - tr
16
+ - nl
17
+ - hi
18
+ tags:
19
+ - qwen
20
+ - qwen3.5
21
+ - gguf
22
+ - on-device
23
+ - ios
24
+ - mobile
25
+ - thinking
26
+ - hybrid-attention
27
+ - deltanet
28
+ model_name: Qwen3.5-9B Q4_K_M GGUF
29
+ base_model: Qwen/Qwen3.5-9B
30
+ quantized_by: jc-builds
31
+ pipeline_tag: text-generation
32
+ ---
33
+
34
+ # Qwen3.5-9B Q4_K_M GGUF
35
+
36
+ > **4-bit quantized GGUF** of [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) optimized for **on-device iOS inference** via [llama.cpp](https://github.com/ggml-org/llama.cpp). The most capable model you can run on an iPhone.
37
+
38
+ | Property | Value |
39
+ |---|---|
40
+ | **Parameters** | 9 billion |
41
+ | **Quantization** | Q4_K_M (4-bit, medium quality) |
42
+ | **File Size** | 5.3 GB |
43
+ | **Context Window** | 262,144 tokens (native) |
44
+ | **Architecture** | Hybrid Gated DeltaNet + Attention |
45
+ | **License** | Apache 2.0 |
46
+ | **Languages** | 201 languages/dialects |
47
+
48
+ ## Key Features
49
+
50
+ - **Best-in-Class On-Device AI**: Matches or beats models 9-13x its size
51
+ - **Thinking Mode**: `<think>...</think>` chain-of-thought reasoning
52
+ - **Hybrid Architecture**: Gated DeltaNet + Attention for efficient, high-quality inference
53
+ - **Natively Multimodal**: Trained with early vision fusion
54
+ - **Massive Context**: 262K native, extendable to 1M+ with YaRN
55
+
56
+ ## Benchmarks
57
+
58
+ ### Qwen3.5-9B vs Models 9-13x Larger
59
+
60
+ ![9B vs Large Models](9b_vs_large.png)
61
+
62
+ The 9B model **beats Qwen3-80B** on GPQA Diamond (81.7 vs 77.2), IFEval (91.5 vs 88.9), and HMMT math (83.2 vs 73.7). It also **outperforms GPT-OSS-120B** on MMLU-Pro (82.5 vs 80.8) and GPQA Diamond (81.7 vs 80.1).
63
+
64
+ ### MMLU-Pro: Size Class Comparison
65
+
66
+ | Model | Params | MMLU-Pro |
67
+ |---|---|---|
68
+ | **Qwen3.5-9B** | **9B** | **82.5** |
69
+ | Qwen3-30B | 30B | 80.9 |
70
+ | GPT-OSS-120B | 120B | 80.8 |
71
+ | Qwen3.5-4B | 4B | 79.1 |
72
+ | Gemma2-9B | 9B | ~55* |
73
+ | Phi-4-mini | 3.8B | 52.8 |
74
+
75
+ ### On-Device Inference Speed
76
+
77
+ ![Speed Comparison](speed.png)
78
+
79
+ ### Vision Capabilities
80
+
81
+ ![Vision Benchmarks](vision.png)
82
+
83
+ The 9B model outperforms the dedicated Qwen3-VL-30B (3x its size) on MMMU, MMMU-Pro, MathVision, OmniDocBench, and VideoMME.
84
+
85
+ ### Full Benchmark Table
86
+
87
+ | Benchmark | Qwen3.5-9B | Qwen3-30B | Qwen3-80B | GPT-OSS-120B |
88
+ |---|---|---|---|---|
89
+ | **MMLU-Pro** | 82.5 | 80.9 | 82.7 | 80.8 |
90
+ | **MMLU-Redux** | 91.1 | 91.4 | 92.5 | 91.0 |
91
+ | **GPQA Diamond** | 81.7 | 73.4 | 77.2 | 80.1 |
92
+ | **IFEval** | 91.5 | 88.9 | 88.9 | - |
93
+ | **HMMT Feb 25** | 83.2 | 63.1 | 73.7 | 76.7 |
94
+ | **HMMT Nov 25** | 82.9 | 73.8 | 81.2 | 81.8 |
95
+ | **LiveCodeBench v6** | 65.6 | 66.0 | 68.7 | 82.7 |
96
+ | **BFCL-V4 (Tool Use)** | 66.1 | 42.4 | - | - |
97
+ | **C-Eval** | 88.2 | 87.4 | 89.7 | 76.2 |
98
+ | **SuperGPQA** | 58.2 | 56.8 | 60.8 | 54.6 |
99
+
100
+ ### Vision Benchmarks
101
+
102
+ | Benchmark | Qwen3.5-9B | Qwen3-VL-30B | GPT-5-Nano |
103
+ |---|---|---|---|
104
+ | **MMMU** | 78.4 | 76.0 | 75.8 |
105
+ | **MMMU-Pro** | 70.1 | 63.0 | 57.2 |
106
+ | **MathVision** | 78.9 | 65.7 | 62.2 |
107
+ | **OmniDocBench** | 87.7 | 86.8 | 55.9 |
108
+ | **VideoMME** | 84.5 | 79.9 | 71.7 |
109
+ | **OSWorld** | 41.8 | 30.6 | - |
110
+
111
+ ## Device Compatibility
112
+
113
+ | Device | RAM | Compatible | Speed |
114
+ |---|---|---|---|
115
+ | iPhone 16 Pro Max | 8 GB | Yes | ~22-28 tok/s |
116
+ | iPhone 16 Pro | 8 GB | Yes | ~20-25 tok/s |
117
+ | iPhone 16 / 15 Pro | 8 GB | Possible (tight) | ~15-20 tok/s |
118
+ | iPhone 15 and older | 6 GB | Not recommended | - |
119
+ | iPad Pro (M-series) | 8-16 GB | Yes | ~25-40 tok/s |
120
+ | Mac (Apple Silicon) | 16+ GB | Yes | ~30-50 tok/s |
121
+
122
+ > **Note**: The 9B model at 5.3 GB requires devices with 8 GB+ RAM. For older devices, use the [Qwen3.5-4B](https://huggingface.co/jc-builds/Qwen3.5-4B-Q4_K_M-GGUF) instead.
123
+
124
+ ## Usage
125
+
126
+ ### With llama.cpp
127
+
128
+ ```bash
129
+ # Download
130
+ huggingface-cli download jc-builds/Qwen3.5-9B-Q4_K_M-GGUF Qwen3.5-9B-Q4_K_M.gguf
131
+
132
+ # Run (with thinking mode)
133
+ ./llama-cli -m Qwen3.5-9B-Q4_K_M.gguf -p "Prove that there are infinitely many primes." -ngl 99
134
+ ```
135
+
136
+ ### With Ollama
137
+
138
+ ```bash
139
+ ollama run qwen3.5:9b
140
+ ```
141
+
142
+ ### In HaploAI (iOS)
143
+
144
+ This model is available directly in the [HaploAI](https://apps.apple.com/app/haploai/id6503772307) iOS app (v1.18+). Download it from the model selection page.
145
+
146
+ ## Prompt Format
147
+
148
+ Uses ChatML format:
149
+
150
+ ```
151
+ <|im_start|>system
152
+ You are a helpful assistant.<|im_end|>
153
+ <|im_start|>user
154
+ Hello!<|im_end|>
155
+ <|im_start|>assistant
156
+ ```
157
+
158
+ ### Thinking Mode
159
+
160
+ ```
161
+ <|im_start|>assistant
162
+ <think>
163
+ Let me reason through this carefully...
164
+ First, assume there are finitely many primes p1, p2, ..., pn.
165
+ Consider N = p1 * p2 * ... * pn + 1.
166
+ N is not divisible by any pi, so either N is prime or has a prime factor not in our list.
167
+ This contradicts our assumption.
168
+ </think>
169
+ There are infinitely many primes. Here is Euclid's classic proof...
170
+ ```
171
+
172
+ ## Architecture Details
173
+
174
+ Qwen3.5 introduces a **hybrid Gated DeltaNet + Gated Attention** architecture:
175
+
176
+ - **3:1 ratio**: 3 layers of Gated DeltaNet (linear attention) per 1 layer of full softmax attention
177
+ - **32 total layers**: 8 blocks x (3 DeltaNet + 1 Attention)
178
+ - **Hidden dimension**: 4,096
179
+ - **Near-constant memory**: DeltaNet layers maintain bounded memory
180
+ - **GQA**: 16 query heads, 4 KV heads for attention layers
181
+ - **FFN intermediate**: 12,288
182
+ - **RoPE**: `theta=10,000,000` with YaRN extension
183
+
184
+ ## Why Qwen3.5-9B?
185
+
186
+ This model represents a paradigm shift in on-device AI:
187
+
188
+ 1. **9B params that beat 80B**: On GPQA Diamond, IFEval, and math benchmarks
189
+ 2. **Hybrid attention is the future**: DeltaNet layers provide near-constant memory, enabling huge context on mobile
190
+ 3. **Natively multimodal**: No separate vision encoder needed for basic image understanding
191
+ 4. **201 languages**: Broadest language support in its class
192
+ 5. **Apache 2.0**: Fully open, commercially usable
193
+
194
+ ## Credits
195
+
196
+ - **Original model**: [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) by Alibaba Cloud
197
+ - **GGUF conversion**: [Unsloth](https://huggingface.co/unsloth/Qwen3.5-9B-GGUF)
198
+ - **Quantization**: Q4_K_M via llama.cpp
199
+ - **Optimized for iOS**: [jc-builds](https://huggingface.co/jc-builds)