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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
+
<p align="center">
|
| 5 |
+
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*4QxcQrBlTiAAAAAAQXAAAAgAemJ7AQ/original" width="100"/>
|
| 6 |
+
</p>
|
| 7 |
+
<p align="center">🤗 <a href="https://huggingface.co/inclusionAI">Hugging Face</a> | 🤖 <a href="https://modelscope.cn/organization/inclusionAI">ModelScope </a> | 🐙 <a href="https://openrouter.ai/inclusionai/ling-3.0-tiny:free">OpenRouter </a> </p>
|
| 8 |
+
|
| 9 |
+
# Introduction
|
| 10 |
+
We are introducing Ling-3.0-tiny, a native hybrid reasoning model with 7.9B total parameters and only 1.3B activated parameters during inference. This release provides BF16, FP8, and INT4 variants, allowing developers to choose flexibly based on their hardware environment, capability requirements, and deployment costs.
|
| 11 |
+
|
| 12 |
+
Key highlights of the model are summarized below:
|
| 13 |
+
|
| 14 |
+
+ **Efficient Hybrid-Linear Architecture:** Ling-3.0-tiny uses a 3:1 alternating stacking of KDA and MLA (3 Kimi Delta Attention layers followed by 1 Multi-Head Latent Attention layer in every 4-layer block), combined with a sparse MoE comprising 128 routed experts. Each token activates only 8 routed experts and 1 shared expert, allowing the model—with 7.9B total parameters and 1.3B activated parameters—to balance long-context modeling capability, parameter efficiency, and computational cost.
|
| 15 |
+
+ **Native Hybrid Reasoning and Agentic Capabilities:** Ling-3.0-tiny supports both fast responses and multi-step reasoning, with thinking mode configurable per request through `enable_thinking`. It delivers balanced performance across general agent tasks, tool use, mathematical and scientific reasoning, and instruction following.
|
| 16 |
+
+ **Local and Edge Deployment:** BF16, FP8, and INT4 weights are provided to support different requirements, including high-precision evaluation, balancing throughput and resource usage, and deployment in resource-constrained environments.
|
| 17 |
+
|
| 18 |
+
# Model Overview
|
| 19 |
+
Ling-3.0-tiny adopts the native hybrid linear attention architecture of Ling-3.0 series and is further optimized for lightweight, accessible deployment scenarios. The model has 7.9B total parameters, with only 1.3B parameters activated per token.
|
| 20 |
+
|
| 21 |
+
The architecture of Ling-3.0-tiny is not designed to optimize a single technical metric; instead, it aims to translate efficiency into real-world task performance.
|
| 22 |
+
|
| 23 |
+
+ A 3:1 KDA–MLA architecture (3 KDA layers and 1 MLA layer in every 4-layer block) enables more efficient long-context processing;
|
| 24 |
+
+ A sparse MoE with 128 experts activates 8 routed experts and 1 shared expert per token, enabling the model to deliver more comprehensive capabilities with only 1.3B activated parameters;
|
| 25 |
+
+ Native hybrid reasoning enables fast responses for routine tasks and multi-step reasoning for complex tasks within a single model;
|
| 26 |
+
+ The Multi-Token Prediction training objective provides a foundation for more efficient token prediction and further inference acceleration.
|
| 27 |
+
|
| 28 |
+
Together, these designs target three goals:
|
| 29 |
+
|
| 30 |
+
+ Reduce the computational resources required for inference;
|
| 31 |
+
+ Lower the barriers to local deployment and downstream development;
|
| 32 |
+
+ Enable lightweight models to participate in real-world agent workflows.
|
| 33 |
+
|
| 34 |
+
<!-- Ling-3.0-tiny architecture diagram -->
|
| 35 |
+

|
| 36 |
+
|
| 37 |
+
# Evaluation
|
| 38 |
+
We evaluated Ling-3.0-tiny across general agent tasks, coding agents, code generation, long-context understanding, knowledge reliability, mathematical and scientific reasoning, and instruction following.
|
| 39 |
+
|
| 40 |
+
Ling-3.0-tiny scores **25** on the Artificial Analysis Intelligence Index v4.1.1 and **16** on the Artificial Analysis Agentic Index. In Artificial Analysis testing, the model achieves an output speed of more than **160 tokens/s** and an end-to-end latency of approximately **18 seconds** for generating 500 tokens (including the reasoning model's thinking time), reflecting a balance among overall capability, activated parameter scale, and response efficiency.
|
| 41 |
+
|
| 42 |
+
The following table presents representative benchmarks for Ling-3.0-tiny:
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
|
| 46 |
+
> All Ling-3.0-tiny evaluation results use Thinking mode; the recommended sampling parameters are `temperature=1.0`, `top_p=0.95`, and `top_k=20`.
|
| 47 |
+
|
| 48 |
+
# Quickstart
|
| 49 |
+
## SGLang
|
| 50 |
+
The hardware- and recipe-specific launch matrix (BF16/FP8 × Low-Latency / High-Throughput / HiCache + Mooncake) includes a live command generator and verified configurations:
|
| 51 |
+
|
| 52 |
+
### Install SGLang
|
| 53 |
+
Use the pre-built image that tracks the Ling-3.0 runtime:
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
docker pull lmsysorg/sglang:dev-Ling-3.0-tiny
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### Run Inference
|
| 60 |
+
We recommend the low-latency recipe (built-in MTP / NEXTN, 256K YaRN context) on 1× 141GB-class GPU (H20-3e) or a 1-GPU Blackwell node:
|
| 61 |
+
|
| 62 |
+
**Server**
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
docker run --rm --gpus all --ipc=host --shm-size 32g \
|
| 66 |
+
-p 30000:30000 \
|
| 67 |
+
-e HF_TOKEN=<your-hf-token> \
|
| 68 |
+
lmsysorg/sglang:dev-Ling-3.0-tiny \
|
| 69 |
+
env SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 \
|
| 70 |
+
python3 -m sglang.launch_server \
|
| 71 |
+
--model-path inclusionAI/Ling-3.0-tiny \
|
| 72 |
+
--tp 1 \
|
| 73 |
+
--json-model-override-args '{"rope_scaling":{"rope_type":"yarn","factor":2.0,"rope_theta":6000000,"partial_rotary_factor":0.5,"original_max_position_embeddings":131072}}' \
|
| 74 |
+
--context-length 262144 \
|
| 75 |
+
--speculative-algorithm NEXTN \
|
| 76 |
+
--mem-fraction-static 0.8 \
|
| 77 |
+
--host 0.0.0.0 \
|
| 78 |
+
--port 30000
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
**Client**
|
| 82 |
+
|
| 83 |
+
The chat template and the `ling3` reasoning parser enable thinking mode by default. To disable it for an individual request, set `"chat_template_kwargs": {"enable_thinking": false}`. We recommend the sampling parameters `temperature=1.0`, `top_p=0.95`, and `top_k=20`.
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
curl -s http://localhost:30000/v1/chat/completions \
|
| 87 |
+
-H "Content-Type: application/json" \
|
| 88 |
+
-d '{"model": "auto",
|
| 89 |
+
"messages": [{"role": "user", "content": "What is the capital of France?"}],
|
| 90 |
+
"stream": true,
|
| 91 |
+
"temperature": 1.0,
|
| 92 |
+
"top_k": 20,
|
| 93 |
+
"top_p": 0.95
|
| 94 |
+
}'
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
## vLLM
|
| 98 |
+
### Install our vLLM
|
| 99 |
+
```bash
|
| 100 |
+
pip install uv
|
| 101 |
+
|
| 102 |
+
uv venv ~/my_ling_env
|
| 103 |
+
|
| 104 |
+
source ~/my_ling_env/bin/activate
|
| 105 |
+
|
| 106 |
+
git clone -b ling_3_0 https://github.com/inclusionAI/vllm-ling-v3.git
|
| 107 |
+
|
| 108 |
+
cd vllm-ling-v3
|
| 109 |
+
|
| 110 |
+
VLLM_USE_PRECOMPILED=1 uv pip install --editable . --torch-backend=auto
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
### Run Inference
|
| 114 |
+
The following example runs Ling-3.0-tiny on 1 GPU, with the server listening on port `${PORT}`:
|
| 115 |
+
|
| 116 |
+
**Server**
|
| 117 |
+
|
| 118 |
+
```bash
|
| 119 |
+
vllm serve "$MODEL_PATH" \
|
| 120 |
+
--port "$PORT" \
|
| 121 |
+
--trust-remote-code \
|
| 122 |
+
--served-model-name auto \
|
| 123 |
+
--tensor-parallel-size 1 \
|
| 124 |
+
--gpu-memory-utilization 0.85 \
|
| 125 |
+
--enable-prefix-caching \
|
| 126 |
+
--mamba-cache-mode align \
|
| 127 |
+
--enable-auto-tool-choice \
|
| 128 |
+
--tool-call-parser ling3 \
|
| 129 |
+
--reasoning-parser ling3
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
**Client**
|
| 133 |
+
|
| 134 |
+
We recommend using the sampling parameters `temperature=1.0`, `top_p=0.95`, and `top_k=20`, and enabling `enable_thinking` for better performance.
|
| 135 |
+
|
| 136 |
+
```bash
|
| 137 |
+
curl -s http://${MASTER_IP}:${PORT}/v1/chat/completions \
|
| 138 |
+
-H "Content-Type: application/json" \
|
| 139 |
+
-d '{"model": "auto",
|
| 140 |
+
"messages": [{"role": "user", "content": "What is the capital of France?"}],
|
| 141 |
+
"chat_template_kwargs": {"enable_thinking": true},
|
| 142 |
+
"stream": true,
|
| 143 |
+
"temperature": 1.0,
|
| 144 |
+
"top_k": 20,
|
| 145 |
+
"top_p": 0.95
|
| 146 |
+
}'
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
## Ollama
|
| 150 |
+
> This configuration has been verified on an M4 Pro Mac with 48 GB of unified memory.
|
| 151 |
+
>
|
| 152 |
+
|
| 153 |
+
### Preparation and Build
|
| 154 |
+
```bash
|
| 155 |
+
git clone https://github.com/ollama/ollama.git
|
| 156 |
+
cd ollama
|
| 157 |
+
git fetch origin refs/pull/17643/head:bailing-moe-v3
|
| 158 |
+
git switch bailing-moe-v3
|
| 159 |
+
|
| 160 |
+
cmake -B build .
|
| 161 |
+
cmake --build build --parallel 8
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
> Support is currently provided by [ollama/ollama#17643](https://github.com/ollama/ollama/pull/17643) and is limited to running via MLX on Apple Silicon.
|
| 165 |
+
>
|
| 166 |
+
> Use the local `./ollama` executable built from source in this section. This functionality is not yet included in the official Ollama release.
|
| 167 |
+
>
|
| 168 |
+
|
| 169 |
+
### Import Model
|
| 170 |
+
Replace `/absolute/path/to/fp8_weights` with the absolute path to the FP8 model weights directory. The imported model will be named `ling-tiny-fp8`:
|
| 171 |
+
|
| 172 |
+
```bash
|
| 173 |
+
printf 'FROM /absolute/path/to/fp8_weights\n' > /tmp/Modelfile.ling
|
| 174 |
+
./ollama create ling-tiny-fp8 --experimental -f /tmp/Modelfile.ling
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
### Start Service
|
| 178 |
+
Set the default context length to 8192, and then start the Ollama service:
|
| 179 |
+
|
| 180 |
+
```bash
|
| 181 |
+
# The service listens on http://127.0.0.1:11434 by default
|
| 182 |
+
OLLAMA_CONTEXT_LENGTH=8192 ./ollama serve
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
### Call API
|
| 186 |
+
```bash
|
| 187 |
+
curl -sS http://127.0.0.1:11434/api/generate -d '{
|
| 188 |
+
"model": "ling-tiny-fp8",
|
| 189 |
+
"prompt": "<role>SYSTEM</role>detailed thinking on<|role_end|><role>HUMAN</role>Calculate 17 × 23 and output only the number.<|role_end|><role>ASSISTANT</role>\n<think>",
|
| 190 |
+
"raw": true,
|
| 191 |
+
"think": true,
|
| 192 |
+
"stream": false,
|
| 193 |
+
"options": {
|
| 194 |
+
"temperature": 1.0,
|
| 195 |
+
"top_p": 0.95,
|
| 196 |
+
"top_k": 20,
|
| 197 |
+
"num_predict": 2048
|
| 198 |
+
}
|
| 199 |
+
}' | jq -r .response
|
| 200 |
+
```
|