ashxhart commited on
Commit
bbbe540
·
verified ·
1 Parent(s): a517fc5

Add Mac memory chooser and reproducible demo prompt

Browse files
Files changed (1) hide show
  1. README.md +74 -0
README.md CHANGED
@@ -13,26 +13,33 @@ tags:
13
  - 8-bit
14
  ---
15
 
 
16
  <p align="center">
17
  <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*4QxcQrBlTiAAAAAAQXAAAAgAemJ7AQ/original" width="100" alt="Ling logo">
18
  </p>
19
 
 
20
  <h1 align="center">Ling 3.0 Flash — MLX 8-bit</h1>
21
 
 
22
  <p align="center">
23
  A native Apple-silicon conversion of <a href="https://huggingface.co/inclusionAI/Ling-3.0-flash">inclusionAI/Ling-3.0-flash</a>, quantized with the stock MLX-LM converter and packaged for MLX-LM and oMLX.
24
  </p>
25
 
 
26
  <p align="center">
27
  <a href="https://huggingface.co/inclusionAI/Ling-3.0-flash">Original model</a> ·
28
  <a href="https://modelscope.cn/organization/inclusionAI">InclusionAI on ModelScope</a> ·
29
  <a href="https://openrouter.ai/inclusionai/ling-3.0-flash:free">OpenRouter</a>
30
  </p>
31
 
 
32
  ## About this conversion
33
 
 
34
  This repository contains an **8-bit affine MLX conversion** of Ling 3.0 Flash. Ling is a 124B-parameter hybrid-linear mixture-of-experts model with approximately 5.1B active parameters per token. The conversion preserves the upstream tokenizer and chat template and includes an MLX architecture adapter for the model's KDA, MLA, and sparse-MoE layers.
35
 
 
36
  | Item | Value |
37
  | --- | --- |
38
  | Base model | [`inclusionAI/Ling-3.0-flash`](https://huggingface.co/inclusionAI/Ling-3.0-flash) |
@@ -44,15 +51,20 @@ This repository contains an **8-bit affine MLX conversion** of Ling 3.0 Flash. L
44
  | Maximum configured context | 262,144 tokens |
45
  | Architecture | `bailing_hybrid` |
46
 
 
47
  > [!IMPORTANT]
48
  > This model includes the custom architecture file `bailing_hybrid.py`. Review the file and enable **Trust Remote Code** before loading it. In oMLX, enable Trust Remote Code in the model settings. With MLX-LM, pass `--trust-remote-code`.
49
 
 
50
  ## Apple-silicon validation
51
 
 
52
  The converted weights were loaded strictly with both stock MLX-LM and the MLX runtime bundled with oMLX. End-to-end generation was also tested through the oMLX OpenAI-compatible API on an Apple-silicon Mac Studio.
53
 
 
54
  One short local smoke test produced:
55
 
 
56
  | Measurement | Result |
57
  | --- | ---: |
58
  | Prefill | 24.15 tokens/s |
@@ -60,18 +72,24 @@ One short local smoke test produced:
60
  | Reported peak memory | 132.36 GB |
61
  | oMLX API | HTTP 200, valid completion |
62
 
 
63
  These figures confirm that the model runs; they are not a controlled benchmark. Prompt length, sampler settings, macOS memory pressure, thermal state, and MLX/oMLX versions can materially change performance.
64
 
 
65
  ## Quick start with MLX-LM
66
 
 
67
  Install recent MLX-LM and Hugging Face tooling:
68
 
 
69
  ```bash
70
  python -m pip install -U mlx-lm huggingface_hub
71
  ```
72
 
 
73
  Run a chat prompt directly from the Hub:
74
 
 
75
  ```bash
76
  mlx_lm.generate \
77
  --model Vontra/Ling-3.0-flash-MLX-8bit \
@@ -83,8 +101,10 @@ mlx_lm.generate \
83
  --top-k 20
84
  ```
85
 
 
86
  Thinking mode is enabled by the upstream chat template by default. It can be disabled with:
87
 
 
88
  ```bash
89
  mlx_lm.generate \
90
  --model Vontra/Ling-3.0-flash-MLX-8bit \
@@ -93,22 +113,28 @@ mlx_lm.generate \
93
  --prompt "Write a short hello-world program in Swift."
94
  ```
95
 
 
96
  To download the repository first:
97
 
 
98
  ```bash
99
  hf download Vontra/Ling-3.0-flash-MLX-8bit \
100
  --local-dir ~/.omlx/models/Vontra/Ling-3.0-flash-MLX-8bit
101
  ```
102
 
 
103
  ## Using it with oMLX
104
 
 
105
  1. Place the model at `~/.omlx/models/Vontra/Ling-3.0-flash-MLX-8bit`.
106
  2. Refresh the oMLX model registry.
107
  3. Open the model settings and enable **Trust Remote Code**.
108
  4. Load `Ling-3.0-flash-MLX-8bit` and use the normal chat or OpenAI-compatible endpoint.
109
 
 
110
  Example request:
111
 
 
112
  ```bash
113
  curl http://localhost:8000/v1/chat/completions \
114
  -H "Content-Type: application/json" \
@@ -122,12 +148,16 @@ curl http://localhost:8000/v1/chat/completions \
122
  }'
123
  ```
124
 
 
125
  For long prompts, begin with a conservative context limit and increase it while watching memory pressure. The advertised 256K context is a model capability, not a promise that every host can prefill that context within its available unified memory.
126
 
 
127
  ## Architecture
128
 
 
129
  Ling 3.0 Flash is a native hybrid-linear MoE model. It alternates Kimi Delta Attention (KDA) and gated Multi-head Latent Attention (MLA) in a 5:1 ratio and uses highly sparse routed experts.
130
 
 
131
  | Architecture detail | Upstream value |
132
  | --- | ---: |
133
  | Total / active parameters | 124B / 5.1B |
@@ -142,14 +172,19 @@ Ling 3.0 Flash is a native hybrid-linear MoE model. It alternates Kimi Delta Att
142
  | Vocabulary size | 157,184 |
143
  | Context training schedule | 8K → 32K → 256K |
144
 
 
145
  The included MLX adapter uses MLX-LM's native primitives for delta attention, absorbed MLA projections, RoPE, and quantized SwitchGLU experts. The auxiliary MTP training head is intentionally excluded from ordinary causal generation; this release does **not** claim MTP/DSpark speculative decoding support.
146
 
 
147
  ## Upstream model highlights
148
 
 
149
  InclusionAI describes Ling 3.0 Flash as a next-generation hybrid reasoning model designed for efficient long-context inference and agentic workloads. The upstream release reports strong results across software-engineering agents, tool use, deep research, general knowledge, mathematical reasoning, instruction following, and long-context understanding.
150
 
 
151
  The upstream defaults are:
152
 
 
153
  ```text
154
  thinking: enabled
155
  temperature: 0.6
@@ -157,20 +192,59 @@ top_p: 0.95
157
  top_k: 20
158
  ```
159
 
 
160
  For benchmark methodology, scores, limitations, and framework-specific SGLang/vLLM deployment instructions, see the [original InclusionAI model card](https://huggingface.co/inclusionAI/Ling-3.0-flash).
161
 
 
162
  ## Conversion notes
163
 
 
164
  - Source weights: BF16 upstream checkpoint.
165
  - Conversion command: stock `mlx_lm.convert` with `--quantize --q-bits 8 --q-group-size 64 --q-mode affine`.
166
  - The upstream `chat_template.jinja` is included unchanged.
167
  - All source tensors required for base causal generation were consumed by a strict load before conversion.
168
  - The 42 base transformer layers are retained. The separate depth-5 MTP training/speculation stack is not part of this runtime adapter.
169
 
 
170
  This is a community conversion, not an official InclusionAI release. Because the architecture adapter is new, validate quality and numerical behavior on your own representative workload before production use.
171
 
 
172
  ## License and attribution
173
 
 
174
  The upstream model is released under the **MIT License**. This conversion preserves that license and is derived from [`inclusionAI/Ling-3.0-flash`](https://huggingface.co/inclusionAI/Ling-3.0-flash).
175
 
 
176
  All model design, training, and benchmark credit belongs to InclusionAI and the original contributors. The MLX conversion and compatibility adapter are provided by [Vontra](https://huggingface.co/Vontra).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  - 8-bit
14
  ---
15
 
16
+
17
  <p align="center">
18
  <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*4QxcQrBlTiAAAAAAQXAAAAgAemJ7AQ/original" width="100" alt="Ling logo">
19
  </p>
20
 
21
+
22
  <h1 align="center">Ling 3.0 Flash — MLX 8-bit</h1>
23
 
24
+
25
  <p align="center">
26
  A native Apple-silicon conversion of <a href="https://huggingface.co/inclusionAI/Ling-3.0-flash">inclusionAI/Ling-3.0-flash</a>, quantized with the stock MLX-LM converter and packaged for MLX-LM and oMLX.
27
  </p>
28
 
29
+
30
  <p align="center">
31
  <a href="https://huggingface.co/inclusionAI/Ling-3.0-flash">Original model</a> ·
32
  <a href="https://modelscope.cn/organization/inclusionAI">InclusionAI on ModelScope</a> ·
33
  <a href="https://openrouter.ai/inclusionai/ling-3.0-flash:free">OpenRouter</a>
34
  </p>
35
 
36
+
37
  ## About this conversion
38
 
39
+
40
  This repository contains an **8-bit affine MLX conversion** of Ling 3.0 Flash. Ling is a 124B-parameter hybrid-linear mixture-of-experts model with approximately 5.1B active parameters per token. The conversion preserves the upstream tokenizer and chat template and includes an MLX architecture adapter for the model's KDA, MLA, and sparse-MoE layers.
41
 
42
+
43
  | Item | Value |
44
  | --- | --- |
45
  | Base model | [`inclusionAI/Ling-3.0-flash`](https://huggingface.co/inclusionAI/Ling-3.0-flash) |
 
51
  | Maximum configured context | 262,144 tokens |
52
  | Architecture | `bailing_hybrid` |
53
 
54
+
55
  > [!IMPORTANT]
56
  > This model includes the custom architecture file `bailing_hybrid.py`. Review the file and enable **Trust Remote Code** before loading it. In oMLX, enable Trust Remote Code in the model settings. With MLX-LM, pass `--trust-remote-code`.
57
 
58
+
59
  ## Apple-silicon validation
60
 
61
+
62
  The converted weights were loaded strictly with both stock MLX-LM and the MLX runtime bundled with oMLX. End-to-end generation was also tested through the oMLX OpenAI-compatible API on an Apple-silicon Mac Studio.
63
 
64
+
65
  One short local smoke test produced:
66
 
67
+
68
  | Measurement | Result |
69
  | --- | ---: |
70
  | Prefill | 24.15 tokens/s |
 
72
  | Reported peak memory | 132.36 GB |
73
  | oMLX API | HTTP 200, valid completion |
74
 
75
+
76
  These figures confirm that the model runs; they are not a controlled benchmark. Prompt length, sampler settings, macOS memory pressure, thermal state, and MLX/oMLX versions can materially change performance.
77
 
78
+
79
  ## Quick start with MLX-LM
80
 
81
+
82
  Install recent MLX-LM and Hugging Face tooling:
83
 
84
+
85
  ```bash
86
  python -m pip install -U mlx-lm huggingface_hub
87
  ```
88
 
89
+
90
  Run a chat prompt directly from the Hub:
91
 
92
+
93
  ```bash
94
  mlx_lm.generate \
95
  --model Vontra/Ling-3.0-flash-MLX-8bit \
 
101
  --top-k 20
102
  ```
103
 
104
+
105
  Thinking mode is enabled by the upstream chat template by default. It can be disabled with:
106
 
107
+
108
  ```bash
109
  mlx_lm.generate \
110
  --model Vontra/Ling-3.0-flash-MLX-8bit \
 
113
  --prompt "Write a short hello-world program in Swift."
114
  ```
115
 
116
+
117
  To download the repository first:
118
 
119
+
120
  ```bash
121
  hf download Vontra/Ling-3.0-flash-MLX-8bit \
122
  --local-dir ~/.omlx/models/Vontra/Ling-3.0-flash-MLX-8bit
123
  ```
124
 
125
+
126
  ## Using it with oMLX
127
 
128
+
129
  1. Place the model at `~/.omlx/models/Vontra/Ling-3.0-flash-MLX-8bit`.
130
  2. Refresh the oMLX model registry.
131
  3. Open the model settings and enable **Trust Remote Code**.
132
  4. Load `Ling-3.0-flash-MLX-8bit` and use the normal chat or OpenAI-compatible endpoint.
133
 
134
+
135
  Example request:
136
 
137
+
138
  ```bash
139
  curl http://localhost:8000/v1/chat/completions \
140
  -H "Content-Type: application/json" \
 
148
  }'
149
  ```
150
 
151
+
152
  For long prompts, begin with a conservative context limit and increase it while watching memory pressure. The advertised 256K context is a model capability, not a promise that every host can prefill that context within its available unified memory.
153
 
154
+
155
  ## Architecture
156
 
157
+
158
  Ling 3.0 Flash is a native hybrid-linear MoE model. It alternates Kimi Delta Attention (KDA) and gated Multi-head Latent Attention (MLA) in a 5:1 ratio and uses highly sparse routed experts.
159
 
160
+
161
  | Architecture detail | Upstream value |
162
  | --- | ---: |
163
  | Total / active parameters | 124B / 5.1B |
 
172
  | Vocabulary size | 157,184 |
173
  | Context training schedule | 8K → 32K → 256K |
174
 
175
+
176
  The included MLX adapter uses MLX-LM's native primitives for delta attention, absorbed MLA projections, RoPE, and quantized SwitchGLU experts. The auxiliary MTP training head is intentionally excluded from ordinary causal generation; this release does **not** claim MTP/DSpark speculative decoding support.
177
 
178
+
179
  ## Upstream model highlights
180
 
181
+
182
  InclusionAI describes Ling 3.0 Flash as a next-generation hybrid reasoning model designed for efficient long-context inference and agentic workloads. The upstream release reports strong results across software-engineering agents, tool use, deep research, general knowledge, mathematical reasoning, instruction following, and long-context understanding.
183
 
184
+
185
  The upstream defaults are:
186
 
187
+
188
  ```text
189
  thinking: enabled
190
  temperature: 0.6
 
192
  top_k: 20
193
  ```
194
 
195
+
196
  For benchmark methodology, scores, limitations, and framework-specific SGLang/vLLM deployment instructions, see the [original InclusionAI model card](https://huggingface.co/inclusionAI/Ling-3.0-flash).
197
 
198
+
199
  ## Conversion notes
200
 
201
+
202
  - Source weights: BF16 upstream checkpoint.
203
  - Conversion command: stock `mlx_lm.convert` with `--quantize --q-bits 8 --q-group-size 64 --q-mode affine`.
204
  - The upstream `chat_template.jinja` is included unchanged.
205
  - All source tensors required for base causal generation were consumed by a strict load before conversion.
206
  - The 42 base transformer layers are retained. The separate depth-5 MTP training/speculation stack is not part of this runtime adapter.
207
 
208
+
209
  This is a community conversion, not an official InclusionAI release. Because the architecture adapter is new, validate quality and numerical behavior on your own representative workload before production use.
210
 
211
+
212
  ## License and attribution
213
 
214
+
215
  The upstream model is released under the **MIT License**. This conversion preserves that license and is derived from [`inclusionAI/Ling-3.0-flash`](https://huggingface.co/inclusionAI/Ling-3.0-flash).
216
 
217
+
218
  All model design, training, and benchmark credit belongs to InclusionAI and the original contributors. The MLX conversion and compatibility adapter are provided by [Vontra](https://huggingface.co/Vontra).
219
+
220
+
221
+
222
+ <!-- vontra-chooser-start -->
223
+ ## Choose for your Mac
224
+
225
+ [64GB Macs](https://huggingface.co/collections/Vontra/mlx-models-for-64gb-macs-6a9fefda17932216ec9ab457) · [128GB Macs](https://huggingface.co/collections/Vontra/mlx-models-for-128gb-macs-6a9ff0abd31bc9abbe7922d7) · [256GB Macs](https://huggingface.co/collections/Vontra/mlx-models-for-256gb-macs-6a9ff0ef9fed7c5bdca15e9b)
226
+
227
+ Published peak memory: **132.36 GB**; estimated starting tier: **256GB**, leaving about **123 GB** nominal headroom. The collections use published M3 Studio peaks with at least 25% nominal headroom; fit on other Macs is an estimate, and full context is not guaranteed. Start with short context and one request.
228
+
229
+ ### Runtime and evidence
230
+
231
+ The exact tested oMLX application version is not recorded here; a library version is not an app version. The original performance tables retain their benchmark conditions and speed figures; this documentation update adds no new test results.
232
+
233
+ ### Quick start and demo prompt
234
+
235
+ ```bash
236
+ hf download Vontra/Ling-3.0-flash-MLX-8bit --local-dir ./models/Ling-3.0-flash-MLX-8bit
237
+ ```
238
+
239
+ Add the downloaded folder to oMLX model directories, refresh the list, and follow this card's architecture and MTP compatibility requirements before loading.
240
+
241
+ Try this in a new chat with a 128-token output limit:
242
+
243
+ ```text
244
+ Explain why the sky looks blue in three short sentences.
245
+ ```
246
+
247
+ This is a demo prompt to try, not a recorded successful run; a captured demonstration for this documentation update is not yet available.
248
+
249
+ [Follow Vontra for new Apple Silicon releases and fixes.](https://huggingface.co/Vontra)
250
+ <!-- vontra-chooser-end -->