Text Generation
MLX
Safetensors
English
Chinese
bailing_hybrid
mlx-lm
omlx
mixture-of-experts
linear-attention
quantized
apple-silicon
custom_code
oq5
conversational
5-bit
Instructions to use TensorFold/Ling-3.0-flash-oQ5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use TensorFold/Ling-3.0-flash-oQ5 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("TensorFold/Ling-3.0-flash-oQ5") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use TensorFold/Ling-3.0-flash-oQ5 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Ling-3.0-flash-oQ5"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "TensorFold/Ling-3.0-flash-oQ5" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use TensorFold/Ling-3.0-flash-oQ5 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "TensorFold/Ling-3.0-flash-oQ5"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "TensorFold/Ling-3.0-flash-oQ5" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TensorFold/Ling-3.0-flash-oQ5", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use TensorFold/Ling-3.0-flash-oQ5 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Ling-3.0-flash-oQ5"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default TensorFold/Ling-3.0-flash-oQ5
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use TensorFold/Ling-3.0-flash-oQ5 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TensorFold/Ling-3.0-flash-oQ5"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "TensorFold/Ling-3.0-flash-oQ5" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 10,263 Bytes
c85dd63 853b799 75e6e29 c85dd63 75e6e29 c85dd63 853b799 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 853b799 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 853b799 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 853b799 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 c85dd63 75e6e29 853b799 75e6e29 853b799 75e6e29 853b799 75e6e29 853b799 75e6e29 853b799 | 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | ---
library_name: mlx
license: mit
base_model: inclusionAI/Ling-3.0-flash
base_model_relation: quantized
pipeline_tag: text-generation
language:
- en
- zh
tags:
- mlx
- mlx-lm
- omlx
- bailing_hybrid
- mixture-of-experts
- linear-attention
- quantized
- apple-silicon
- custom_code
- oq5
---
<p align="center">
<a href="https://tensorfold.dev">
<img src="https://huggingface.co/spaces/TensorFold/README/resolve/main/tensorfold-logo.png" alt="TensorFold" width="160">
</a>
</p>
<p align="center">
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*4QxcQrBlTiAAAAAAQXAAAAgAemJ7AQ/original" width="100" alt="Ling logo">
</p>
<p align="center">
<img src="https://img.shields.io/badge/InclusionAI-Ling-1677FF?style=for-the-badge" alt="InclusionAI Ling">
<img src="https://img.shields.io/badge/Apple_Silicon-MLX-000000?style=for-the-badge&logo=apple&logoColor=white" alt="Apple silicon MLX">
<img src="https://img.shields.io/badge/TensorFold-oMLX-6E56CF?style=for-the-badge&logo=huggingface&logoColor=white" alt="TensorFold oMLX">
</p>
<h1 align="center">Ling 3.0 Flash — oQ5</h1>
<p align="center">
A native Apple-silicon conversion of <a href="https://huggingface.co/inclusionAI/Ling-3.0-flash">inclusionAI/Ling-3.0-flash</a>, quantized with oMLX's optimized mixed-precision oQ5 recipe and packaged for oMLX and compatible MLX-LM runtimes.
</p>
<p align="center">
<a href="https://huggingface.co/inclusionAI/Ling-3.0-flash">Original model</a> ·
<a href="https://modelscope.cn/organization/inclusionAI">InclusionAI on ModelScope</a> ·
<a href="https://openrouter.ai/inclusionai/ling-3.0-flash:free">OpenRouter</a> ·
<a href="https://github.com/ml-explore/mlx-lm">MLX-LM</a>
</p>
## About this conversion
This repository contains an **oMLX-optimized mixed-precision oQ5 conversion** of Ling 3.0 Flash. Ling is a 124B-total / 5.1B-active hybrid-linear mixture-of-experts model. The conversion preserves the upstream tokenizer and chat template and includes the custom MLX architecture adapter required for Kimi Delta Attention, gated MLA, and sparse MoE layers.
| Item | Value |
| --- | --- |
| Base model | [`inclusionAI/Ling-3.0-flash`](https://huggingface.co/inclusionAI/Ling-3.0-flash) |
| Format | MLX safetensors |
| Quantization | oQ5 affine mixed precision, group size 64 |
| Base precision | 5-bit |
| Protected modules | 130 at 6-bit and 325 at 8-bit |
| Conversion/runtime stack | oMLX with MLX-LM 0.31.3 / MLX 0.32.0 |
| Weight shards | 16 |
| Weight size | 86.62 GB (80.67 GiB) |
| Maximum configured context | 262,144 tokens |
| Architecture | `bailing_hybrid` |
> [!IMPORTANT]
> This model uses the included `bailing_hybrid.py` custom MLX adapter. In oMLX, enable **Trust Remote Code** for this model before loading it. Standalone MLX-LM requires a build whose `mlx_lm.load` supports the `trust_remote_code` argument and repository-provided `model_file` adapters; stock PyPI `mlx-lm 0.31.3` does not provide that loader path.
## Apple-silicon performance
This checkpoint was load-tested, generation-tested, and benchmarked on:
| Hardware | Configuration |
| --- | --- |
| Host | Mac Studio |
| Chip | Apple M3 Ultra |
| CPU | 32 cores (24 performance + 8 efficiency) |
| Unified memory | 256 GB |
| Runtime | oMLX-bundled MLX-LM 0.31.3 / MLX 0.32.0 |
A warmed local test produced:
| Measurement | Result |
| --- | ---: |
| Decode (median) | **73.10 tokens/s** |
| Individual decode runs | 73.23 / 73.10 / 73.09 tokens/s |
| Reported peak memory | **87.44 GB** |
| Timed runs | 3 × 256 generated tokens |
| Warm-up | 256 generated tokens |
| Prompt | 39 tokens after chat templating |
The decode figure is the median of three greedy 256-token runs after a full 256-token Metal-kernel warm-up. It is a practical local reference, not a controlled cross-platform benchmark. Prompt length, context growth, sampler settings, memory pressure, thermal state, and runtime versions can materially change performance.
## Recommended use with oMLX
1. Download the model into the oMLX model directory:
```bash
hf download TensorFold/Ling-3.0-flash-oQ5 \
--local-dir ~/.omlx/models/TensorFold/Ling-3.0-flash-oQ5
```
2. Refresh the oMLX model registry.
3. Open the model settings and enable **Trust Remote Code**.
4. Load `Ling-3.0-flash-oQ5` and use the normal chat UI or OpenAI-compatible endpoint.
Example request:
```bash
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OMLX_API_KEY" \
-d '{
"model": "Ling-3.0-flash-oQ5",
"messages": [{"role": "user", "content": "Explain why hybrid linear attention is useful."}],
"temperature": 0.6,
"top_p": 0.95,
"max_tokens": 512
}'
```
Thinking mode is enabled by the upstream chat template by default. Disable it with the model's chat-template configuration when a direct answer is preferred.
## Compatible standalone MLX-LM builds
With an MLX-LM build that supports repository-provided model adapters:
```bash
mlx_lm.generate \
--model TensorFold/Ling-3.0-flash-oQ5 \
--trust-remote-code \
--prompt "Explain why hybrid linear attention is useful." \
--max-tokens 512 \
--temp 0.6 \
--top-p 0.95 \
--top-k 20
```
Python usage with the same capability:
```python
from mlx_lm import load, generate
model, tokenizer = load(
"TensorFold/Ling-3.0-flash-oQ5",
trust_remote_code=True,
tokenizer_config={"trust_remote_code": True},
)
messages = [
{"role": "user", "content": "Explain sparse mixture-of-experts routing."}
]
prompt = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=False,
enable_thinking=False,
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=512))
```
Only enable remote code after reviewing the included adapter files.
## Architecture
Ling 3.0 Flash alternates Kimi Delta Attention (KDA) and gated Multi-head Latent Attention (MLA) in a 5:1 ratio and uses highly sparse routed experts.
| Architecture detail | Upstream value |
| --- | ---: |
| Total / active parameters | 124B / 5.1B |
| Transformer layers | 35 KDA + 7 gated MLA |
| Dense layers | 2 |
| Routed / shared experts | 512 / 1 |
| Active routed experts | 8 |
| Attention heads | 32 |
| Hidden size | 2,560 |
| Expert intermediate size | 768 |
| Dense intermediate size | 6,144 |
| Vocabulary size | 157,184 |
| Context training schedule | 8K → 32K → 256K |
The included MLX adapter uses MLX-LM primitives for delta attention, absorbed MLA projections, RoPE, and quantized SwitchGLU experts. The auxiliary MTP training head is excluded from ordinary causal generation; this release does **not** claim MTP or DSpark speculative-decoding support.
## Upstream model highlights
InclusionAI describes Ling 3.0 Flash as a hybrid reasoning model for software-engineering agents, tool use, deep research, general knowledge, mathematical reasoning, instruction following, and long-context understanding.
The upstream defaults are:
```text
thinking: enabled
temperature: 0.6
top_p: 0.95
top_k: 20
```
For benchmark methodology, scores, intended use, limitations, and framework-specific deployment instructions, see the [original InclusionAI model card](https://huggingface.co/inclusionAI/Ling-3.0-flash).
## Conversion and validation notes
- Source weights: upstream BF16 checkpoint.
- Quantization mode: affine, group size 64.
- oQ5 uses a 5-bit base with 455 sensitive modules kept at higher precision.
- Both `quantization` and `quantization_config` preserve the per-module recipe.
- The upstream chat template is included unchanged.
- All 2,067 converted tensors and all 16 indexed shards were checked locally.
- The custom adapter was loaded with explicit trust and exercised through end-to-end generation.
- Quantization can reduce output quality relative to BF16; use a higher-precision variant when quality matters more than memory use.
This is a community conversion, not an official InclusionAI release. Validate quality and numerical behavior on representative workloads before production use.
## License and attribution
The upstream model declares the **MIT License** in its Hugging Face metadata. A standard MIT licence copy is included in this repository.
All model design, training, benchmark, and upstream documentation credit belongs to InclusionAI and the original contributors. The mixed-precision conversion, Apple-silicon validation, compatibility packaging, and model card are provided by [TensorFold](https://huggingface.co/TensorFold).
<!-- TensorFold-chooser-start -->
## Choose for your Mac
[64GB Macs](https://huggingface.co/collections/TensorFold/mlx-models-for-64gb-macs-6a9fefda17932216ec9ab457) · [128GB Macs](https://huggingface.co/collections/TensorFold/mlx-models-for-128gb-macs-6a9ff0abd31bc9abbe7922d7) · [256GB Macs](https://huggingface.co/collections/TensorFold/mlx-models-for-256gb-macs-6a9ff0ef9fed7c5bdca15e9b)
Published peak memory: **87.44 GB**; estimated starting tier: **128GB**, leaving about **40 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.
### Runtime and evidence
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.
### Quick start and demo prompt
```bash
hf download TensorFold/Ling-3.0-flash-oQ5 --local-dir ./models/Ling-3.0-flash-oQ5
```
Add the downloaded folder to oMLX model directories, refresh the list, and follow this card's architecture and MTP compatibility requirements before loading.
Try this in a new chat with a 128-token output limit:
```text
Explain why the sky looks blue in three short sentences.
```
This is a demo prompt to try, not a recorded successful run; a captured demonstration for this documentation update is not yet available.
[Follow TensorFold for new Apple Silicon releases and fixes.](https://huggingface.co/TensorFold)
<!-- TensorFold-chooser-end -->
|