linchao-2026 commited on
Commit
7fa9e17
·
verified ·
1 Parent(s): f2c10b6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +512 -0
README.md CHANGED
@@ -1,3 +1,515 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - llm
7
+ - sparkx2_5
8
+ base_model:
9
+ - XHToken/Spark-X2.5-1.7B-Base
10
  ---
11
+
12
+
13
+ # Spark-X2.5
14
+ <div align="center">
15
+
16
+ [![Slack](https://img.shields.io/badge/Slack-Join-4A154B?logo=slack&logoColor=white)](https://join.slack.com/t/tokenspark/shared_invite/zt-432qf8l2f-5~dLyXv8uETr0P0UuC07nw)
17
+ [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/kTDE2Hg8aw)
18
+ [![YouTube](https://img.shields.io/badge/YouTube-Subscribe-FF0000?logo=youtube&logoColor=white)](https://www.youtube.com/@SparkLLM)
19
+ [![dev.to](https://img.shields.io/badge/dev.to-Follow-0A0A0A?logo=devdotto&logoColor=white)](https://dev.to/sparkllm)
20
+ [![Bluesky](https://img.shields.io/badge/Bluesky-Follow-0285FF?logo=bluesky&logoColor=white)](https://bsky.app/profile/sparkllm.bsky.social)
21
+ [![X](https://img.shields.io/badge/X-Follow-000000?logo=x&logoColor=white)](https://x.com/sparkllm)
22
+ [![Zhihu](https://img.shields.io/badge/Zhihu-Follow-0084FF?logo=zhihu&logoColor=white)](https://www.zhihu.com/people/zhiikz7qh7m)
23
+ [![WeChat](https://img.shields.io/badge/WeChat-Join-07C160?logo=wechat&logoColor=white)](images/xhtoken-wechat.jpg)
24
+
25
+ </div>
26
+
27
+ > [!Note]
28
+ > This repository contains model weights and configuration files for the post-trained model in the Hugging Face Transformers format.
29
+
30
+ ## Introduction
31
+
32
+ We are introducing Spark-X2.5-4B and Spark-X2.5-1.7B, two compact, general-purpose language models designed to make capable AI more practical, efficient, and accessible. The models deliver strong performance across a broad range of everyday tasks—including conversation, writing, translation, reasoning, coding, tool use, and agentic workflows—achieving leading results among open-source models of comparable size. Spark-X2.5 combines an efficiency-oriented architecture with native context windows of up to 1M tokens, and support for more than 200 languages.
33
+
34
+ **Technical Highlights**:
35
+ - **Efficient Architecture and Native 1M-token Context**: The models use a hybrid attention architecture that combines one full-attention layer with three sliding-window attention layers. This design substantially reduces the computational overhead typically associated with long-context models while natively supporting a context window of up to 1M tokens.
36
+ - **Strong Coding and Agent Capabilities**: The models are deeply integrated with popular agent harnesses, including Codex, Claude Code, OpenClaw, and Hermes. They deliver state-of-the-art performance among models of comparable size across everyday coding, agentic workflows, reasoning, and instruction-following tasks.
37
+ - **Broad Hardware and Software Compatibility**: The models support a wide range of hardware platforms, including NVIDIA, Huawei, Hygon, HOUMO.AI, etc. It is compatible with leading inference frameworks such as vLLM, SGLang, llama.cpp, MLX, and can be deployed quickly through platforms including Ollama and LM Studio. The models can also be customized using popular fine-tuning frameworks such as LLaMA-Factory. Across multiple hardware platforms, they deliver superior TTFT, TOPT, and overall inference efficiency compared with similarly sized models.
38
+ - **Advanced Training Algorithms**: The models were trained on Huawei Ascend clusters. Large-scale reinforcement learning and post-training techniques such as MOPD significantly enhance its reasoning, coding, agentic, and instruction-following capabilities.
39
+
40
+ <p align="center">
41
+ <img src="./images/model-benchmark-comparison.svg" alt="Spark-X2.5 benchmark comparison">
42
+ </p>
43
+
44
+
45
+ ## Model Overview
46
+
47
+ For agent tasks, balancing performance, inference speed, and cache usage has long been a key bottleneck limiting model performance. Spark-X2.5 systematically integrates and optimizes mature attention technologies, combining sliding-window attention (SWA) with a hybrid full-attention architecture. This approach leverages the strengths of both mechanisms while avoiding the limitations of relying on a single structure, achieving an effective balance among performance, inference efficiency, and KV-cache size—thereby improving its practicality and effectiveness across real-world deployment scenarios.
48
+
49
+ <p align="center">
50
+ <img src="./images/spark25-hybrid-architecture-light.png" alt="Spark-X2.5 hybrid architecture">
51
+ </p>
52
+
53
+
54
+
55
+ ## Training Methods
56
+
57
+ Spark-X2.5 is pretrained on approximately 20 trillion tokens from a diverse corpus spanning web pages, books, academic publications, code, and encyclopedic materials. Particular attention is paid to data quality, domain coverage, and the sampling weights assigned to different data categories. Extensive data-mixture studies are conducted to determine an effective balance among mathematics, logic, code, and other high-value domains. This enables the models to acquire broad general knowledge while developing stronger capabilities in complex reasoning and code generation. Long-context capability is developed through a dedicated training stage comprising hundreds of billions of tokens, with sequence lengths extending to 1M tokens.
58
+
59
+ Post-training begins with supervised fine-tuning on a carefully curated corpus. This stage establishes robust instruction following, structured generation, and task-completion, while providing a stable policy initialization for reinforcement learning. We subsequently apply large-scale reinforcement learning across several capability domains, including language understanding, reasoning, programming, tool-augmented agentic behavior, and instruction following. This process yields a set of domain-specialized teacher policies, whose complementary strengths are consolidated into a single deployable model through MOPD.
60
+
61
+ <p align="center">
62
+ <img src="./images/post_training_pipeline.svg" alt="Spark-X2.5 hybrid architecture">
63
+ </p>
64
+
65
+ ## Benchmarks
66
+
67
+ We evaluate our models and compare them with leading on-device models of similar size across a broad range of tasks, including agent, code, math, general and knowledge.
68
+
69
+ <div style="overflow-x: auto; width: 100%;">
70
+ <table style="width: 100%; min-width: 1080px; border-collapse: collapse; text-align: center;">
71
+ <colgroup>
72
+ <col style="width: 190px;">
73
+ <col span="8" style="width: 110px;">
74
+ </colgroup>
75
+ <thead>
76
+ <tr>
77
+ <th align="center">Benchmark</th>
78
+ <th align="center"><span style="white-space: nowrap;">Spark‑X2.5‑4B</span></th>
79
+ <th align="center"><span style="white-space: nowrap;">Spark‑X2.5‑1.7B</span></th>
80
+ <th align="center"><span style="white-space: nowrap;">Qwen3.5‑9B</span></th>
81
+ <th align="center"><span style="white-space: nowrap;">Qwen3.5‑4B</span></th>
82
+ <th align="center"><span style="white-space: nowrap;">Qwen3.5‑2B</span></th>
83
+ <th align="center"><span style="white-space: nowrap;">Gemma4‑12B</span></th>
84
+ <th align="center"><span style="white-space: nowrap;">Gemma4‑E4B</span></th>
85
+ <th align="center"><span style="white-space: nowrap;">Gemma4‑E2B</span></th>
86
+ </tr>
87
+ </thead>
88
+ <tbody>
89
+ <tr><th colspan="9" align="left">Agent</th></tr>
90
+ <tr><td align="center">BFCL‑V4</td><td align="center">65.1</td><td align="center">46.9</td><td align="center"><strong>66.1*</strong></td><td align="center">50.3*</td><td align="center">43.6*</td><td align="center">37.4</td><td align="center">36.9</td><td align="center">30.2</td></tr>
91
+ <tr><td align="center">τ²‑bench</td><td align="center">75.1</td><td align="center">65.3</td><td align="center">79.1*</td><td align="center"><strong>79.9*</strong></td><td align="center">48.8*</td><td align="center">69.0*</td><td align="center">42.2*</td><td align="center">24.5*</td></tr>
92
+ <tr><td align="center">τ³‑bench</td><td align="center"><strong>30.4</strong></td><td align="center">20.1</td><td align="center">9.3</td><td align="center">6.7</td><td align="center">4.1</td><td align="center">13.3</td><td align="center">10.1</td><td align="center">8.8</td></tr>
93
+ <tr><td align="center">MCP‑Atlas</td><td align="center"><strong>54.6</strong></td><td align="center">23.4</td><td align="center">47.4*</td><td align="center">40.8*</td><td align="center">14.8</td><td align="center">30.5*</td><td align="center">15.0*</td><td align="center">12.6</td></tr>
94
+ <tr><td align="center">MCP‑Mark</td><td align="center"><strong>14.2</strong></td><td align="center">2.3</td><td align="center">13.4</td><td align="center">12.5</td><td align="center">–</td><td align="center">–</td><td align="center">–</td><td align="center">–</td></tr>
95
+ <tr><td align="center"><span style="white-space: nowrap;">Workspace Bench</span></td><td align="center"><strong>31.2</strong></td><td align="center">18.9</td><td align="center">25.5</td><td align="center">21.3</td><td align="center">7.7</td><td align="center">–</td><td align="center">–</td><td align="center">–</td></tr>
96
+ <tr><td align="center">VitaBench2.0</td><td align="center"><strong>25.2</strong></td><td align="center">8.3</td><td align="center">15.6</td><td align="center">18.2</td><td align="center">5.2</td><td align="center">12.4</td><td align="center">4.8</td><td align="center">4.4</td></tr>
97
+ <tr><td align="center">BrowseComp</td><td align="center"><strong>40.9</strong></td><td align="center">29.7</td><td align="center">8.3</td><td align="center">14.3</td><td align="center">3.1</td><td align="center">10.0</td><td align="center">8.3</td><td align="center">3.7</td></tr>
98
+ <tr><th colspan="9" align="left">Code</th></tr>
99
+ <tr><td align="center"><span style="white-space: nowrap;">SWE‑Bench Pro</span></td><td align="center"><strong>44.4</strong></td><td align="center">10.4</td><td align="center">33.8*</td><td align="center">29.4*</td><td align="center">1.9</td><td align="center">21.9*</td><td align="center">4.0*</td><td align="center">–</td></tr>
100
+ <tr><td align="center"><span style="white-space: nowrap;">SWE‑Bench Verified</span></td><td align="center">41.6</td><td align="center">28.3</td><td align="center"><strong>53.1*</strong></td><td align="center">38.8*</td><td align="center">6.8</td><td align="center">44.2*</td><td align="center">14.0*</td><td align="center">–</td></tr>
101
+ <tr><td align="center"><span style="white-space: nowrap;">SWE‑Bench Multilingual</span></td><td align="center"><strong>53.3</strong></td><td align="center">23.3</td><td align="center">43.3</td><td align="center">27.7</td><td align="center">5.0</td><td align="center">32.5*</td><td align="center">–</td><td align="center">–</td></tr>
102
+ <tr><td align="center">SciCode</td><td align="center">34.7</td><td align="center">18.2</td><td align="center">32.7*</td><td align="center">24.0</td><td align="center">6.0</td><td align="center"><strong>39.8</strong></td><td align="center">27.5</td><td align="center">20.5</td></tr>
103
+ <tr><th colspan="9" align="left">Math</th></tr>
104
+ <tr><td align="center"><span style="white-space: nowrap;">Gaokao 2026</span></td><td align="center">133.4</td><td align="center">114.8</td><td align="center"><strong>135.5</strong></td><td align="center">130.3</td><td align="center">94.0</td><td align="center">130.6</td><td align="center">102.4</td><td align="center">81.8</td></tr>
105
+ <tr><td align="center"><span style="white-space: nowrap;">AIME 2026</span></td><td align="center"><strong>90.7</strong></td><td align="center">69.4</td><td align="center">88.2</td><td align="center">83.0</td><td align="center">30.8</td><td align="center">82.1*</td><td align="center">42.5*</td><td align="center">37.5*</td></tr>
106
+ <tr><td align="center"><span style="white-space: nowrap;">HMMT Feb 2026</span></td><td align="center"><strong>81.2</strong></td><td align="center">48.4</td><td align="center">70.8</td><td align="center">69.7</td><td align="center">21.5</td><td align="center">65.6</td><td align="center">34.2</td><td align="center">20.5</td></tr>
107
+ <tr><td align="center"><span style="white-space: nowrap;">IMO‑AnswerBench</span></td><td align="center"><strong>74.2</strong></td><td align="center">45.4</td><td align="center">69.8</td><td align="center">68.5</td><td align="center">–</td><td align="center">57.2</td><td align="center">26.9</td><td align="center">22.6</td></tr>
108
+ <tr><th colspan="9" align="left">General &amp; Knowledge</th></tr>
109
+ <tr><td align="center">IFEval</td><td align="center">93.0</td><td align="center">89.5</td><td align="center">91.5*</td><td align="center">89.8*</td><td align="center">78.6*</td><td align="center"><strong>94.8</strong></td><td align="center">45.3</td><td align="center">34.8</td></tr>
110
+ <tr><td align="center">IFBench</td><td align="center"><strong>75.0</strong></td><td align="center">66.3</td><td align="center">64.5</td><td align="center">59.2</td><td align="center">41.3*</td><td align="center">73.5*</td><td align="center">44.0*</td><td align="center">22.7</td></tr>
111
+ <tr><td align="center">AA‑LCR</td><td align="center">56.3</td><td align="center">24.3</td><td align="center"><strong>63.0*</strong></td><td align="center">57.0*</td><td align="center">25.6*</td><td align="center">55.3*</td><td align="center">34.7</td><td align="center">18.3</td></tr>
112
+ <tr><td align="center">HLE</td><td align="center">12.3</td><td align="center">6.3</td><td align="center"><strong>14.3</strong></td><td align="center">8.6</td><td align="center">2.1</td><td align="center">13.1</td><td align="center">3.9</td><td align="center">2.5</td></tr>
113
+ <tr><td align="center">GPQA</td><td align="center">67.4</td><td align="center">43.8</td><td align="center"><strong>77.2</strong></td><td align="center">67.2</td><td align="center">44.6</td><td align="center">72.8</td><td align="center">54.5</td><td align="center">43.8</td></tr>
114
+ </tbody>
115
+ </table>
116
+ </div>
117
+
118
+ - \* denotes reported results from publicly‑released model cards / papers and - denotes scores not yet available.
119
+ - All evaluations are conducted in thinking mode. The recommended sampling parameters for Spark-X2.5 are temperature=1.0, top_p=0.95, and top_k=-1.
120
+ - Gaokao 2026 consists of the five 2026 Chinese GAOKAO examinations (National I,National II, Beijing, Shanghai, Tianjin), each graded out of 150 points.
121
+
122
+ ## Quickstart
123
+
124
+ The examples below serve a local Spark-X2.5-1.7B checkpoint. Set `MODEL_PATH` to its absolute path before starting a container:
125
+
126
+ ```bash
127
+ export MODEL_PATH=/absolute/path/to/Spark-X2.5-1.7B
128
+ ```
129
+
130
+ ### SGLang
131
+
132
+ #### Install SGLang
133
+
134
+ Use the pre-built image that tracks the Spark-X2.5 runtime:
135
+
136
+ ##### For NVIDIA GPUs:
137
+
138
+ ```bash
139
+ docker pull lmsysorg/sglang:nightly-dev-cu13-20260827-20621aa1
140
+ ```
141
+ ##### For Ascend NPUs:
142
+
143
+ ```bash
144
+ # A3 daily build
145
+ export SGLANG_IMAGE=quay.io/ascend/sglang:main-cann9.0.0-a3
146
+
147
+ # A2 daily build (use this instead on A2 hardware)
148
+ export SGLANG_IMAGE=quay.io/ascend/sglang:main-cann9.0.0-910b
149
+
150
+ docker pull "$SGLANG_IMAGE"
151
+ ```
152
+
153
+ #### Run Inference
154
+
155
+ The following commands start an OpenAI-compatible API server configured for a maximum context length of 1,048,576 tokens. This setting requires sufficient device memory; reduce `--context-length` when necessary.
156
+
157
+ #### Server
158
+
159
+ ##### NVIDIA GPU:
160
+
161
+ ```bash
162
+ docker run --rm -it \
163
+ --gpus '"device=0"' \
164
+ --ipc=host \
165
+ -p 30000:30000 \
166
+ -v "$MODEL_PATH:/root/Spark-X2.5-1.7B:ro" \
167
+ lmsysorg/sglang:nightly-dev-cu13-20260827-20621aa1 \
168
+ python -m sglang.launch_server \
169
+ --model-path /root/Spark-X2.5-1.7B \
170
+ --served-model-name spark2.5 \
171
+ --tool-call-parser spark25 \
172
+ --reasoning-parser qwen3 \
173
+ --tp-size 1 \
174
+ --mem-fraction-static 0.8 \
175
+ --context-length 1048576 \
176
+ --chat-template /root/Spark-X2.5-1.7B/chat_template.jinja \
177
+ --host 0.0.0.0 \
178
+ --port 30000
179
+ ```
180
+
181
+ ##### Ascend NPU:
182
+
183
+ ```bash
184
+ docker run -it --rm -e ASCEND_USE_FIA=1 --network=host --ipc=host --shm-size=16g \
185
+ --device=/dev/davinci0 --device=/dev/davinci1 --device=/dev/davinci2 --device=/dev/davinci3 \
186
+ --device=/dev/davinci4 --device=/dev/davinci5 --device=/dev/davinci6 --device=/dev/davinci7 \
187
+ --device=/dev/davinci8 --device=/dev/davinci9 --device=/dev/davinci10 --device=/dev/davinci11 \
188
+ --device=/dev/davinci12 --device=/dev/davinci13 --device=/dev/davinci14 --device=/dev/davinci15 \
189
+ --device=/dev/davinci_manager \
190
+ --device=/dev/devmm_svm \
191
+ --device=/dev/hisi_hdc \
192
+ --volume /usr/local/sbin:/usr/local/sbin \
193
+ --volume /usr/local/Ascend/driver:/usr/local/Ascend/driver \
194
+ --volume /usr/local/Ascend/firmware:/usr/local/Ascend/firmware \
195
+ --volume /etc/ascend_install.info:/etc/ascend_install.info \
196
+ --volume /var/queue_schedule:/var/queue_schedule \
197
+ --volume ~/.cache/:/root/.cache/ \
198
+ --volume "$MODEL_PATH:/root/Spark-X2.5-1.7B:ro" \
199
+ --entrypoint=python \
200
+ "$SGLANG_IMAGE" \
201
+ -m sglang.launch_server \
202
+ --model-path /root/Spark-X2.5-1.7B \
203
+ --served-model-name spark2.5 \
204
+ --tool-call-parser spark25 \
205
+ --reasoning-parser qwen3 \
206
+ --tp-size 1 \
207
+ --mem-fraction-static 0.8 \
208
+ --context-length 1048576 \
209
+ --chat-template /root/Spark-X2.5-1.7B/chat_template.jinja \
210
+ --host 0.0.0.0 \
211
+ --port 30000
212
+ ```
213
+
214
+ #### Client
215
+
216
+ Thinking is enabled by default by both the chat template and the Qwen3 reasoning parser. To disable thinking for a specific request, set `"chat_template_kwargs": {"enable_thinking": false}`.
217
+
218
+ ```bash
219
+ curl -s http://localhost:30000/v1/chat/completions \
220
+ -H "Content-Type: application/json" \
221
+ -d '{
222
+ "model": "spark2.5",
223
+ "messages": [
224
+ {
225
+ "role": "user",
226
+ "content": "What is the capital of Anhui Province?"
227
+ }
228
+ ],
229
+ "max_tokens": 131072,
230
+ "temperature": 1,
231
+ "top_k": -1,
232
+ "top_p": 0.95,
233
+ "repetition_penalty": 1,
234
+ "presence_penalty": 0,
235
+ "frequency_penalty": 0
236
+ }'
237
+ ```
238
+
239
+ ### vLLM
240
+
241
+ #### Deploy vLLM
242
+
243
+ vLLM provides an official Docker image for NVIDIA GPU deployment:
244
+
245
+ ```bash
246
+ docker run --rm --gpus all \
247
+ --ipc=host \
248
+ -p 30000:30000 \
249
+ -v "$MODEL_PATH:/models/Spark-X2.5-1.7B:ro" \
250
+ vllm/vllm-openai:latest \
251
+ --model /models/Spark-X2.5-1.7B \
252
+ --port 30000 \
253
+ --trust-remote-code \
254
+ --served-model-name spark25 \
255
+ --tensor-parallel-size 1 \
256
+ --gpu-memory-utilization 0.7 \
257
+ --enable-prefix-caching \
258
+ --chat-template /models/Spark-X2.5-1.7B/chat_template.jinja
259
+ ```
260
+
261
+ For Ascend NPUs, choose an official image for the fastest setup.
262
+
263
+ ##### Ascend A2:
264
+
265
+ ```bash
266
+ export IMAGE=quay.io/ascend/vllm-ascend:nightly-main
267
+ docker pull "$IMAGE"
268
+
269
+ export DEVICE=/dev/davinci0
270
+ export MODEL_CACHE="${HOME}/.cache"
271
+
272
+ mkdir -p "$MODEL_CACHE"
273
+
274
+ docker run --rm \
275
+ --name vllm-ascend \
276
+ --shm-size=1g \
277
+ --device "$DEVICE" \
278
+ --device /dev/davinci_manager \
279
+ --device /dev/devmm_svm \
280
+ --device /dev/hisi_hdc \
281
+ -v /usr/local/dcmi:/usr/local/dcmi \
282
+ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
283
+ -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
284
+ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
285
+ -v /etc/ascend_install.info:/etc/ascend_install.info \
286
+ -v "$MODEL_CACHE:/root/.cache" \
287
+ -p 8000:8000 \
288
+ -it "$IMAGE" bash
289
+ ```
290
+
291
+ ##### Ascend A3:
292
+
293
+ ```bash
294
+ export IMAGE=quay.io/ascend/vllm-ascend:nightly-main-a3
295
+ docker pull "$IMAGE"
296
+
297
+ export DEVICE0=/dev/davinci0
298
+ export DEVICE1=/dev/davinci1
299
+ export MODEL_CACHE="${HOME}/.cache"
300
+
301
+ mkdir -p "$MODEL_CACHE"
302
+
303
+ docker run --rm \
304
+ --name vllm-ascend \
305
+ --shm-size=1g \
306
+ --device "$DEVICE0" \
307
+ --device "$DEVICE1" \
308
+ --device /dev/davinci_manager \
309
+ --device /dev/devmm_svm \
310
+ --device /dev/hisi_hdc \
311
+ -v /usr/local/dcmi:/usr/local/dcmi \
312
+ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
313
+ -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
314
+ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
315
+ -v /etc/ascend_install.info:/etc/ascend_install.info \
316
+ -v "$MODEL_CACHE:/root/.cache" \
317
+ -p 8000:8000 \
318
+ -it "$IMAGE" bash
319
+ ```
320
+
321
+ ##### Ascend 950DT:
322
+
323
+ ```bash
324
+ export IMAGE=quay.io/ascend/vllm-ascend:nightly-main-a5
325
+ docker pull "$IMAGE"
326
+
327
+ export MODEL_CACHE="${HOME}/.cache"
328
+
329
+ mkdir -p "$MODEL_CACHE"
330
+
331
+ docker run --rm \
332
+ --name vllm-ascend \
333
+ --net=host \
334
+ --shm-size=1g \
335
+ --device /dev/davinci0 \
336
+ --device /dev/davinci_manager \
337
+ --device /dev/devmm_svm \
338
+ --device /dev/hisi_hdc \
339
+ -v /usr/local/dcmi:/usr/local/dcmi \
340
+ -v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
341
+ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
342
+ -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
343
+ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
344
+ -v /etc/ascend_install.info:/etc/ascend_install.info \
345
+ -v "$MODEL_CACHE:/root/.cache" \
346
+ -it "$IMAGE" bash
347
+ ```
348
+
349
+ Install the Spark plugin inside the container:
350
+
351
+ ```bash
352
+ pip install uv
353
+ uv venv ~/spark2_5
354
+ source ~/spark2_5/bin/activate
355
+ git clone https://github.com/XHToken/Spark-plugin.git
356
+ cd ./Spark-plugin
357
+ uv pip install .
358
+ ```
359
+
360
+ #### Server
361
+
362
+ ```bash
363
+ vllm serve "/models/Spark-X2.5-1.7B" \
364
+ --port "30000" \
365
+ --trust-remote-code \
366
+ --served-model-name spark25 \
367
+ --tensor-parallel-size 1 \
368
+ --gpu-memory-utilization 0.7 \
369
+ --enable-prefix-caching \
370
+ --chat-template /models/Spark-X2.5-1.7B/chat_template.jinja
371
+ ```
372
+
373
+ #### Client
374
+
375
+ ```bash
376
+ curl -s http://127.0.0.1:30000/v1/chat/completions \
377
+ -H "Content-Type: application/json" \
378
+ -d '{
379
+ "model": "spark25",
380
+ "messages": [{"role": "user", "content": "What is the capital of Anhui Province?"}],
381
+ "temperature": 1.0,
382
+ "top_k": -1,
383
+ "top_p": 0.95
384
+ }'
385
+ ```
386
+
387
+ ### MLX
388
+ Spark-MLX-LLM runs the original Spark-X2.5 Hugging Face checkpoints locally. It supports Apple silicon GPU, Linux CPU, and NVIDIA CUDA on Linux. No GGUF conversion is required.
389
+
390
+ #### Installation
391
+
392
+ ```bash
393
+ git clone https://github.com/XHToken/Spark-MLX-LLM.git
394
+ cd Spark-MLX-LLM
395
+
396
+ python3 -m venv .venv
397
+ source .venv/bin/activate
398
+
399
+ # Apple silicon
400
+ python -m pip install -e .
401
+ # Linux CPU
402
+ python -m pip install -e '.[cpu]'
403
+ # Linux with CUDA 12
404
+ python -m pip install -e '.[cuda12]'
405
+ # Linux with CUDA 13
406
+ python -m pip install -e '.[cuda13]'
407
+ ```
408
+
409
+ #### Run Inference
410
+
411
+ ```bash
412
+ spark-mlx-generate \
413
+ --device gpu \
414
+ --dtype bfloat16 \
415
+ --model XHToken/Spark-X2.5-1.7B \
416
+ --prompt "What is the capital of Anhui Province?" \
417
+ --max-tokens 512 \
418
+ --temp 0
419
+ ```
420
+
421
+ ### Ollama
422
+
423
+ #### Build
424
+
425
+ ```bash
426
+ git clone https://github.com/XHToken/llama.cpp.git llama.cpp-spark
427
+ git clone https://github.com/ollama/ollama.git ollama-spark
428
+ cd ollama-spark
429
+ export OLLAMA_LLAMA_CPP_SOURCE="$(cd ../llama.cpp-spark && pwd)"
430
+ cmake -S . -B build
431
+ cmake --build build --parallel 8
432
+ ```
433
+
434
+ #### Create and Run
435
+
436
+ Create the model definition, then start the Ollama server in one terminal:
437
+
438
+ ```bash
439
+ printf 'FROM /absolute/path/to/your.gguf\n' > ./Modelfile.spark
440
+ ./ollama serve
441
+ ```
442
+
443
+ Create and run the model from another terminal:
444
+
445
+ ```bash
446
+ ./ollama create Spark-X2.5-1.7B -f ./Modelfile.spark
447
+ ./ollama run Spark-X2.5-1.7B
448
+ ```
449
+
450
+ ### LM Studio
451
+
452
+ #### Build
453
+
454
+ ```bash
455
+ git clone https://github.com/XHToken/llama.cpp.git llama.cpp-spark
456
+ cd llama.cpp-spark
457
+ cmake -S . -B build
458
+ cmake --build build --parallel 8
459
+ ```
460
+
461
+ #### Set Up LM Studio
462
+
463
+ 1. Close LM Studio.
464
+
465
+ 2. Back up the selected runtime directory:
466
+
467
+ ```text
468
+ <LM_STUDIO_HOME>/extensions/backends/<selected-runtime>/
469
+ ```
470
+
471
+ 3. Copy the `llama.cpp-spark` build output into the selected runtime directory, overwriting the existing files.
472
+
473
+ 4. Place the GGUF model in the following directory:
474
+
475
+ ```text
476
+ <LM_STUDIO_HOME>/models/<org>/<name>/
477
+ ```
478
+
479
+ Example runtime directory on macOS:
480
+
481
+ ```text
482
+ ./build/bin/* -> ~/.lmstudio/extensions/backends/llama.cpp-mac-arm64-apple-metal-advsimd-<version>/
483
+ ```
484
+
485
+ #### Run with LM Studio
486
+
487
+ Open My Models, select the Spark-X2.5 model, click Load, then start a new Chat.
488
+
489
+ #### Run with the lms CLI
490
+
491
+ ```bash
492
+ # Replace <model> with a model listed by lms ls.
493
+ lms load <model>
494
+ lms chat <model>
495
+ ```
496
+
497
+ ### Fine-Tuning
498
+
499
+ We recommend using [Llama-Factory](https://github.com/XHToken/LlamaFactory) to fine-tune the model.
500
+
501
+
502
+ ## License
503
+
504
+ The Spark-X2.5 model series is licensed under the [Apache 2.0 License](https://huggingface.co/XHToken/Spark-X2.5-1.7B/blob/main/LICENSE).
505
+
506
+ ## Citation
507
+ If you find our work helpful, feel free to give us a cite.
508
+
509
+ ```bibtex
510
+ @misc{sparkx2.5,
511
+ title = {Spark-X2.5 4B&1.7B: Pushing the Limits of Agentic Capabilities in On-Device Models},
512
+ author = {SparkLLM Team},
513
+ year = {2026}
514
+ }
515
+ ```