GGUF
Chinese
English
spark-x2.5
llama.cpp
speculative-decoding
t4
cuda
colab
edge-deployment
conversational
Instructions to use gasschina/Spark-X2.5-4B-build-cpp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use gasschina/Spark-X2.5-4B-build-cpp with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: llama cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: llama cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Use Docker
docker model run hf.co/gasschina/Spark-X2.5-4B-build-cpp:Q8_0
- LM Studio
- Jan
- Ollama
How to use gasschina/Spark-X2.5-4B-build-cpp with Ollama:
ollama run hf.co/gasschina/Spark-X2.5-4B-build-cpp:Q8_0
- Unsloth Desktop
- Pi
How to use gasschina/Spark-X2.5-4B-build-cpp with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "gasschina/Spark-X2.5-4B-build-cpp:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use gasschina/Spark-X2.5-4B-build-cpp with Docker Model Runner:
docker model run hf.co/gasschina/Spark-X2.5-4B-build-cpp:Q8_0
- Lemonade
How to use gasschina/Spark-X2.5-4B-build-cpp with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Run and chat with the model
lemonade run user.Spark-X2.5-4B-build-cpp-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use gasschina/Spark-X2.5-4B-build-cpp with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
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 gasschina/Spark-X2.5-4B-build-cpp:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use gasschina/Spark-X2.5-4B-build-cpp with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf gasschina/Spark-X2.5-4B-build-cpp:Q8_0
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 "gasschina/Spark-X2.5-4B-build-cpp:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -20,19 +20,19 @@ tags:
|
|
| 20 |
|
| 21 |
Everything needed to run **iFlytek Spark-X2.5-4B** on an NVIDIA T4 (16GB) with llama.cpp:
|
| 22 |
a prebuilt CUDA binary (XHToken fork — the `spark2_5` architecture is **not** supported by mainline llama.cpp),
|
| 23 |
-
Q8_0 / Q4_K_M model weights, a **1.7B draft model
|
| 24 |
and battle-tested one-click scripts (256k-context OpenAI-compatible API + public tunnel).
|
| 25 |
|
| 26 |
-
> Verified end-to-end on 2026-09-06: streaming, native tool calling (`--jinja`),
|
| 27 |
-
>
|
| 28 |
|
| 29 |
## What's in this repo
|
| 30 |
|
| 31 |
| File | Size | Description |
|
| 32 |
|------|------|-------------|
|
| 33 |
| `llama.cpp-spark-build-t4-cuda.tar.gz` | 242MB | Prebuilt llama.cpp (XHToken fork) for CUDA / SM 7.5: `llama-server` + all runtime libs |
|
| 34 |
-
| `Spark-X2.5-4B-Q8_0.gguf` | 4.37GB | 8-bit quant (near-F16 quality) —
|
| 35 |
-
| `Spark-X2.5-4B-Q4_K_M.gguf` | 2.60GB | 4-bit quant
|
| 36 |
| `Spark-X2.5-1.7B-Q8_0.gguf` | 1.82GB | Draft model (same tokenizer, same `spark2_5` arch) for speculative decoding |
|
| 37 |
| `scripts/oneclick_start.sh` | – | One-click: checks → serve → tunnel → self-test |
|
| 38 |
| `scripts/spark_api.sh` | – | OpenAI-compatible API manager (start / stop / status / test) |
|
|
@@ -64,29 +64,31 @@ The launcher prints the local endpoint, public tunnel URL, and API key when done
|
|
| 64 |
Model weights live on Colab local disk (`/content/spark-t4-models`), never eating into the
|
| 65 |
15GB Drive quota; the build and scripts persist on Drive across sessions.
|
| 66 |
|
| 67 |
-
## Default config (
|
| 68 |
|
| 69 |
| Item | Value | Notes |
|
| 70 |
|------|-------|-------|
|
| 71 |
-
| Weights |
|
| 72 |
-
| Speculative decoding |
|
| 73 |
-
| Context | **262,144 (256k)** |
|
| 74 |
-
| KV quant | q4_0
|
| 75 |
-
| VRAM | **
|
| 76 |
-
| Throughput | **
|
| 77 |
-
|
|
| 78 |
| Auth | auto-generated key → Drive `.api_key` | `API_KEY=off` to disable |
|
| 79 |
-
| Thinking mode | on by default | see API section to disable |
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
|
| 84 |
```bash
|
| 85 |
-
|
| 86 |
-
|
|
|
|
| 87 |
```
|
| 88 |
|
| 89 |
> 1M context physically does not fit on a T4: 1M KV@q4_0 alone needs ~13GB before weights.
|
|
|
|
|
|
|
| 90 |
|
| 91 |
## Benchmarks (T4, greedy, 384-token generations, /completion timings)
|
| 92 |
|
|
@@ -94,14 +96,16 @@ DRAFT_MODEL= QUANT=Q4_K_M CTX=786432 bash oneclick_start.sh # 768k extreme:
|
|
| 94 |
|--------|---------|------|-----------|
|
| 95 |
| Q8_0, no draft (baseline) | 500k | 11.8GB | 37.1 tok/s |
|
| 96 |
| **Q8_0 + 1.7B-Q8_0 draft** | **256k** | **11.8GB** | **52.3 tok/s (+41%)** |
|
| 97 |
-
|
|
| 98 |
| Q4_K_M, no draft | 500k | 10.1GB | 51.7 tok/s |
|
|
|
|
| 99 |
| Q4_K_M + draft | 500k | OOM | draft compute buffer ~1.5GB |
|
| 100 |
| ngram-simple (self-speculation) | 500k | +0GB | 37.5 tok/s (no gain on prose) |
|
| 101 |
|
| 102 |
-
Takeaway: the T4 is memory-bandwidth-bound.
|
| 103 |
-
|
| 104 |
-
|
|
|
|
| 105 |
|
| 106 |
## MTP status (why classic drafting)
|
| 107 |
|
|
@@ -109,8 +113,8 @@ llama.cpp already ships `draft-mtp` / `draft-eagle3` / `draft-dspark` speculativ
|
|
| 109 |
require matching trained heads. Spark-X2.5-4B publishes no MTP/nextn/EAGLE weights
|
| 110 |
(`num_nextn_predict_layers` is absent from its config), and the fork's `spark2_5` backend has no
|
| 111 |
nextn implementation. Classic draft-model speculation with the official same-vocabulary (131,072)
|
| 112 |
-
1.7B sibling is the best available option
|
| 113 |
-
|
| 114 |
|
| 115 |
## API usage (OpenAI-compatible)
|
| 116 |
|
|
@@ -127,8 +131,8 @@ r = requests.post(f"{BASE}/v1/chat/completions",
|
|
| 127 |
print(r.json()["choices"][0]["message"]["content"])
|
| 128 |
```
|
| 129 |
|
| 130 |
-
- **Streaming**: add `"stream": true` (SSE)
|
| 131 |
-
- **
|
| 132 |
- **Tool calling**: pass a standard OpenAI `tools` array (`--jinja` enables native function calling)
|
| 133 |
|
| 134 |
## Why this build exists
|
|
@@ -140,4 +144,4 @@ community i1 quant; the 1.7B draft quantized in-house (Q8_0) from the official F
|
|
| 140 |
|
| 141 |
## 中文速览
|
| 142 |
|
| 143 |
-
讯飞星火 Spark-X2.5-4B 在 Colab T4 上的完整 llama.cpp 运行包
|
|
|
|
| 20 |
|
| 21 |
Everything needed to run **iFlytek Spark-X2.5-4B** on an NVIDIA T4 (16GB) with llama.cpp:
|
| 22 |
a prebuilt CUDA binary (XHToken fork — the `spark2_5` architecture is **not** supported by mainline llama.cpp),
|
| 23 |
+
Q8_0 / Q4_K_M model weights, a **1.7B draft model** (boosts the Q8_0 config by +41%, 0.89 acceptance),
|
| 24 |
and battle-tested one-click scripts (256k-context OpenAI-compatible API + public tunnel).
|
| 25 |
|
| 26 |
+
> Verified end-to-end on 2026-09-06: streaming, native tool calling (`--jinja`), and a real agent
|
| 27 |
+
> workload (84-tool zagent, 12 consecutive tool calls, 240k prompt tokens, zero failures).
|
| 28 |
|
| 29 |
## What's in this repo
|
| 30 |
|
| 31 |
| File | Size | Description |
|
| 32 |
|------|------|-------------|
|
| 33 |
| `llama.cpp-spark-build-t4-cuda.tar.gz` | 242MB | Prebuilt llama.cpp (XHToken fork) for CUDA / SM 7.5: `llama-server` + all runtime libs |
|
| 34 |
+
| `Spark-X2.5-4B-Q8_0.gguf` | 4.37GB | 8-bit quant (near-F16 quality) — pairs best with the draft model |
|
| 35 |
+
| `Spark-X2.5-4B-Q4_K_M.gguf` | 2.60GB | 4-bit quant — **default**: fastest, most VRAM headroom |
|
| 36 |
| `Spark-X2.5-1.7B-Q8_0.gguf` | 1.82GB | Draft model (same tokenizer, same `spark2_5` arch) for speculative decoding |
|
| 37 |
| `scripts/oneclick_start.sh` | – | One-click: checks → serve → tunnel → self-test |
|
| 38 |
| `scripts/spark_api.sh` | – | OpenAI-compatible API manager (start / stop / status / test) |
|
|
|
|
| 64 |
Model weights live on Colab local disk (`/content/spark-t4-models`), never eating into the
|
| 65 |
15GB Drive quota; the build and scripts persist on Drive across sessions.
|
| 66 |
|
| 67 |
+
## Default config (v5): Q4_K_M bare @ 256k, tuned for agent platforms
|
| 68 |
|
| 69 |
| Item | Value | Notes |
|
| 70 |
|------|-------|-------|
|
| 71 |
+
| Weights | Q4_K_M (2.60GB) | 4-bit — fastest, most headroom |
|
| 72 |
+
| Speculative decoding | **off** | ⚠️ 4-bit quantization noise drops draft acceptance 0.89 → 0.37-0.61; measured **27 tok/s (slower than bare!)**. Drafting only pays off on Q8_0 |
|
| 73 |
+
| Context | **262,144 (256k)** | 500k available at the same speed (51.7 tok/s / 10.1GB) |
|
| 74 |
+
| KV quant | q4_0 | via `-ctk/-ctv` |
|
| 75 |
+
| VRAM | **6.6GB / 15.36GB** | 8.8GB headroom |
|
| 76 |
+
| Throughput | **48.75 tok/s** | prefill 790 tok/s; Q8_0+draft does 52.3 tok/s |
|
| 77 |
+
| Thinking mode | **server-side off by default** | ⚠️ the aitun tunnel hard-kills silent non-streaming requests at **120s → 504**; thinking adds 30–90s of silence. Re-enable per request with `"chat_template_kwargs": {"enable_thinking": true}` |
|
| 78 |
| Auth | auto-generated key → Drive `.api_key` | `API_KEY=off` to disable |
|
|
|
|
| 79 |
|
| 80 |
+
Draft policy is automatic by quant tier: `QUANT=Q8_0` attaches the 1.7B draft (acceptance 0.89,
|
| 81 |
+
**52.3 tok/s, 11.8GB**); 4-bit runs bare. Override with `SPEC_TYPE=draft-simple` / `SPEC_TYPE=none`.
|
| 82 |
|
| 83 |
```bash
|
| 84 |
+
QUANT=Q8_0 bash oneclick_start.sh # quality + draft: 52.3 tok/s, 11.8GB
|
| 85 |
+
CTX=500000 bash oneclick_start.sh # 500k long-context, same speed, 10.1GB
|
| 86 |
+
QUANT=Q4_K_M CTX=786432 bash oneclick_start.sh # 768k extreme, 14.3GB
|
| 87 |
```
|
| 88 |
|
| 89 |
> 1M context physically does not fit on a T4: 1M KV@q4_0 alone needs ~13GB before weights.
|
| 90 |
+
> Single slot (`-np 1`): concurrent requests queue behind long agent replies. On agent platforms
|
| 91 |
+
> (aicq.me etc.) prefer streaming and keep `max_tokens` ≤ 2000.
|
| 92 |
|
| 93 |
## Benchmarks (T4, greedy, 384-token generations, /completion timings)
|
| 94 |
|
|
|
|
| 96 |
|--------|---------|------|-----------|
|
| 97 |
| Q8_0, no draft (baseline) | 500k | 11.8GB | 37.1 tok/s |
|
| 98 |
| **Q8_0 + 1.7B-Q8_0 draft** | **256k** | **11.8GB** | **52.3 tok/s (+41%)** |
|
| 99 |
+
| Q4_K_M, no draft (v5 default) | 256k | 6.6GB | 48.75 tok/s |
|
| 100 |
| Q4_K_M, no draft | 500k | 10.1GB | 51.7 tok/s |
|
| 101 |
+
| Q4_K_M + draft | 256k | ~10.1GB | **27.2 tok/s (anti-optimization! acceptance 0.37-0.61)** |
|
| 102 |
| Q4_K_M + draft | 500k | OOM | draft compute buffer ~1.5GB |
|
| 103 |
| ngram-simple (self-speculation) | 500k | +0GB | 37.5 tok/s (no gain on prose) |
|
| 104 |
|
| 105 |
+
Takeaway: the T4 is memory-bandwidth-bound. Drafting is a *distribution-matching* game — with a
|
| 106 |
+
near-lossless Q8_0 target the 1.7B sibling hits 0.89 acceptance (+41%), but a 4-bit target's
|
| 107 |
+
argmax flips too often and drafting goes net-negative. Gateway note: the free aitun tunnel
|
| 108 |
+
terminates non-streaming requests at exactly **120s** (reproduced); streaming is immune.
|
| 109 |
|
| 110 |
## MTP status (why classic drafting)
|
| 111 |
|
|
|
|
| 113 |
require matching trained heads. Spark-X2.5-4B publishes no MTP/nextn/EAGLE weights
|
| 114 |
(`num_nextn_predict_layers` is absent from its config), and the fork's `spark2_5` backend has no
|
| 115 |
nextn implementation. Classic draft-model speculation with the official same-vocabulary (131,072)
|
| 116 |
+
1.7B sibling is the best available option: **0.891 acceptance, mean accepted length 8.13 tokens**
|
| 117 |
+
on the Q8_0 target.
|
| 118 |
|
| 119 |
## API usage (OpenAI-compatible)
|
| 120 |
|
|
|
|
| 131 |
print(r.json()["choices"][0]["message"]["content"])
|
| 132 |
```
|
| 133 |
|
| 134 |
+
- **Streaming**: add `"stream": true` (SSE) — strongly recommended behind tunnels/gateways
|
| 135 |
+
- **Thinking mode** (server-side off by default): add `"chat_template_kwargs": {"enable_thinking": true}`
|
| 136 |
- **Tool calling**: pass a standard OpenAI `tools` array (`--jinja` enables native function calling)
|
| 137 |
|
| 138 |
## Why this build exists
|
|
|
|
| 144 |
|
| 145 |
## 中文速览
|
| 146 |
|
| 147 |
+
讯飞星火 Spark-X2.5-4B 在 Colab T4 上的完整 llama.cpp 运行包。**默认配置 v5 = Q4_K_M 裸跑 @256k 上下文 + 思考默认关**(实测 48.75 tok/s,显存仅 6.6GB)——为 aicq.me 等智能体平台调优:aitun 隧道对非流式请求有 120s 硬超时(开思考必 504),故思考默认关闭、单请求可传 `enable_thinking:true` 恢复;草稿投机解码只对 Q8_0 有正收益(+41%,接受率 0.89),`QUANT=Q8_0` 时自动挂载,4bit 档实测反而慢一半已自动关闭。API 为 OpenAI 兼容格式,模型名 `spark-x2.5-4b`,智能体平台建议开流式、max_tokens ≤2000。
|