Spark-X2.5-4B — EXL3 6.00 bpw, for 8 / 12 / 16 GB GPUs (262k context, served with vLLM) — EXPERIMENTAL
Install from this card, not from generic snippets. This is an EXL3 checkpoint of a model that vLLM does not support natively: vLLM loads it only together with exllamav3, the OrcaSAQ2 plugin and our
spark_vllmplugin (inplugin/). Follow Requirements & install and Quick start; a plainpip install vllm, Transformers or SGLang cannot load it.
An unofficial community EXL3 quantization of XHToken/Spark-X2.5-4B made with
exllamav3: 6.00 bits per weight on the decoder layers (6.013 achieved), a 6-bit lm_head and BF16 token
embeddings. Spark-X2.5-4B is a 4B reasoning model with a hybrid sliding-window / full attention stack (512-token window on 27 of 36 layers) and a
documented 1M-token position range; it has no MTP head and no vision tower.
It is served with vLLM (continuous batching) through our vllm-quantpack plugin, which also adds the model to vLLM. At this
rate the quantization is close to lossless (KL divergence 0.0017–0.0020 against BF16 on three traces), and the full 262,144-token context fits
on a 12 GB GPU (two concurrent full-context sessions on 16 GB, a 106,496-token context on 8 GB).
License: Apache-2.0, inherited from XHToken/Spark-X2.5-4B. This is not an official release of XHToken.
Tested setup: NVIDIA A40 (48 GB, Ampere) for the test battery, NVIDIA L40S (48 GB, Ada) for capacity per GPU size, the loop test and speculative decoding, NVIDIA RTX PRO 6000 Blackwell Server Edition (96 GB, power limit 300 W) for the BF16 comparisons; vLLM 0.31.0 + exllamav3 1.5.1 + the OrcaSAQ2 plugin (commit
7ddffb12, with the patch inpatches/) + ourspark_vllm0.1.0 plugin (2026-10-25). The 8 / 12 / 16 GB sizes were measured on the 48 GB L40S with the KV cache sized for each size and the VRAM peak checked against it (see Capacity per GPU size). Only this setup has been tested.
EXPERIMENTAL. Not a stock
vllm servemodel: vLLM has no Spark-X2.5 implementation and the checkpoint's remote code (written for Transformers 4.57) cannot run through vLLM's Transformers backend, so ourspark_vllmplugin provides a native implementation. Serve it without--trust-remote-code.
Highlights (measured on 2026-10-25; details in Results):
- KLD against BF16 0.0020 on our sysadmin trace, 0.0019 on the opencode trace and 0.0017 on turboderp's public trace.
- 262,144 tokens in one session on a 12 GB GPU, two concurrent 262,144-token sessions on 16 GB, 106,496 tokens on 8 GB; at least 321 MiB of VRAM really free at peak.
- Tool calls with the real opencode request 60/60 (and 30/30 in the battery); opencode agent tasks 17/30 (10 sysadmin tasks × 3 runs).
- Reasoning 24/48 with 155,989 reasoning tokens; 19 answers were cut by the token limit (the BF16 original: 26/48, 20 cut — see Known model behaviour).
- Decode 144 / 267 / 520 / 995 tok/s with 1 / 2 / 4 / 8 requests on an L40S; needle 8/8 at 64k, 6/8 at 128k, 7/8 at 241k.
Our focus. We quantize and evaluate models for one use case: a local Linux system-administration agent (opencode with tool calling) for a university IT department, used in Spanish. Our calibration traces include real sysadmin/agent conversations in Spanish, and our quality checks (tool calls with the real opencode request, agent tasks with real command execution, long-context retrieval, long answers in Spanish) reflect that use. KL divergence is also reported on turboderp's public trace, so it can be compared and reproduced. Numbers for other domains or languages may differ.
What is in this repository
Which one to use
One checkpoint (6.00 bpw) for every size; the size only changes the KV cache in the Quick start.
| GPU size | Context per session | Real concurrent full-context sessions | KV cache | Speculative decoding |
|---|---|---|---|---|
| 8 GB | 106,496 | 1 | fp8, 2,222,645,575 B | none |
| 12 GB | 262,144 | 1 | fp8, 6,462,373,888 B | none |
| 16 GB | 262,144 | 2 | fp8, 10,762,374,348 B | none |
Variants / revisions
| Revision | Decoder layers (achieved) | lm_head |
Embeddings | Size | KLD (sysadmin / opencode / public) |
|---|---|---|---|---|---|
main |
6.00 bpw (6.013) | 6 bits | BF16 | 3.6 GB | 0.0020 / 0.0019 / 0.0017 |
Files and reproducibility
model.safetensors,config.json(quantization_config:exl3, 6.00 bits, head 6),quantization_config.json(per-tensor storage), tokenizer files (tokenizer.json,tokenizer_config.json,vocab.json,merges.txt,special_tokens_map.json),chat_template.jinjaandgeneration_config.json(our recommended sampling, see Sampling and repetition loops).configuration_spark.py,modeling_spark.py: the original remote code, kept for reference; vLLM does not use them (do not pass--trust-remote-code).plugin/spark_vllm/: our vLLM plugin (a Transformers-5 config class forspark2_5and a native vLLM model: paged attention, the 512-token sliding window, head-wise sigmoid output gate, the two RoPE settings, EXL3 linear layers through OrcaSAQ2).patches/orcasaq2-7ddffb12.diff: the changes our tested OrcaSAQ2 has on top of commit7ddffb12(release of the checkpoint's host-RAM copy; the multimodal prefix fix used by our other repos is harmless here).setup.sh: the install below as one script.LICENSE(Apache-2.0, from the base model),SHA256SUMS.- Not included: the BF16 original, exllamav3, vLLM and OrcaSAQ2 (installed from their repositories), our calibration and evaluation traces.
Results
Quantization quality
KL divergence and perplexity against the BF16 original with exllamav3's qbench (2026-10-25). Traces: our own Spanish sysadmin trace, a trace built from
real opencode sessions, and turboderp's public qbench_prompts_gen.json (re-tokenized for Spark's 131k-token vocabulary).
| Trace | KLD mean | KLD median | KLD p90 | PPL BF16 | PPL EXL3 6.00 |
|---|---|---|---|---|---|
| Our sysadmin trace | 0.0020 | 0.0007 | 0.0052 | 2.7278 | 2.7348 |
| opencode sessions | 0.0019 | 0.0006 | 0.0052 | 3.4374 | 3.4429 |
| turboderp's public trace | 0.0017 | 0.0003 | 0.0050 | 2.2203 | 2.2239 |
Capacity per GPU size
Measured on an L40S (48 GB) with the KV cache sized for each GPU size; the VRAM limit of each size assumes the 460 MiB a real GPU of that size reserves
for the driver. "Real concurrent sessions" = sessions of 90 % of the context sent at once whose peak of vllm:num_requests_running equals the number of
sessions, with no preemption; "pool" is the GPU KV cache size vLLM reports at start-up. KV fp8.
| GPU size | --max-model-len |
--kv-cache-memory-bytes |
KV pool (tokens) | Real concurrent sessions | VRAM peak | Really free at peak |
|---|---|---|---|---|---|---|
| 8 GB | 106,496 | 2,222,645,575 | 106,680 | 1 | 7,411 MiB | 321 MiB |
| 12 GB | 262,144 | 6,462,373,888 | 332,971 | 1 | 11,457 MiB | 371 MiB |
| 16 GB | 262,144 | 10,762,374,348 | 554,542 | 2 | 15,557 MiB | 367 MiB |
Test battery
A40 (48 GB), 262,144-token context, KV fp8 10,382,454,292 B, --max-num-seqs 4, no speculative decoding, 2026-10-25.
| Test | Result |
|---|---|
| Smoke (short answer; 4 long Spanish answers, 8,000-token limit) | short answer OK; the 4 long answers reached the 8,000-token limit while reasoning; one had 20 CJK characters (22 in total) |
| Speed (decode, 1 / 2 / 4 / 8 requests) | 108.2 / 202.4 / 398.3 / 398.8 tok/s (8 = 4 because of --max-num-seqs 4) |
| Tool calls, real opencode request | battery 30/30; replay 60/60 (3 cases × 20, all valid and correct) |
Reasoning (48 problems, xhigh requested) |
24/48 correct, 155,989 reasoning tokens (median 3,379), 19 cut by the limit |
| Needle (8 facts) | 64k 8/8 · 128k 6/8 · 241k 7/8 |
| Concurrent sessions (8 × 30k) | 3 of 8 sessions returned all 8 facts; aggregate prefill 6,367 tok/s |
| Agent tasks (opencode, 10 sysadmin tasks × 3 runs, temperature 1.0) | 4/10 · 7/10 · 6/10 = 17/30 |
| Games | 34/48 points, 3 of 4 run |
Speculative decoding
L40S, 262,144-token context, --max-num-seqs 8. None is recommended: n-gram verification costs more than it saves on a 4B model.
| Variant | 1 / 2 / 4 / 8 requests (tok/s) | Acceptance length | Same output at temperature 0 |
|---|---|---|---|
| none (Quick start) | 144.0 / 266.5 / 519.5 / 994.7 | — | — |
| n-gram, 4 tokens | 96.2 / 179.0 / 355.0 / 629.0 | 2.44 | no |
| n-gram, 8 tokens | 112.3 / 200.8 / 365.7 / 613.5 | 2.04 | no |
Sampling and repetition loops
L40S, KV fp8, --max-num-seqs 8, 2026-10-25: 5 long Spanish sysadmin prompts × 6 runs per temperature, up to 16,000 tokens, top_p 0.95 and top_k 20;
a loop = more than 30 % repeated word 8-grams; an empty answer = the reasoning used the whole budget.
| Temperature | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0 |
|---|---|---|---|---|---|---|
| Loops / 30 | 3 | 3 | 2 | 1 | 0 | 0 |
| Answers that finished before 16,000 tokens / 30 | 23 | 22 | 24 | 21 | 26 | 21 |
| Empty answers / 30 | 5 | 6 | 5 | 7 | 4 | 8 |
Use temperature 0.9 (no loops, most finished answers): it is this repo's default in generation_config.json, with top_p 0.95 and top_k 20.
The model reasons at length (mean answers of 9,100–11,085 tokens in this test): give it an output budget of at least 16,000 tokens. Its chat template has
no reasoning-effort setting (only enable_thinking), so reasoning_effort does not shorten the reasoning; answers with thinking disabled were not measured.
Known model behaviour and discarded options
Long reasoning comes from the model, not from the quantization. Same tests on the BF16 original (RTX PRO 6000, vLLM, 65,536-token context):
Test BF16 EXL3 6.00 Reasoning, 48 problems 26/48, 20 cut 24/48, 19 cut Smoke, 3 long answers without sampling settings 3 of 3 reached 8,000 tokens 3 of 3 reached 8,000 tokens CJK test (50 long answers, 6,000-token limit): answers with CJK 0/50 1/50 (one character) CJK test: reasoning with CJK, client sends no sampling settings 5/20 2/20 CJK test: reasoning with CJK, temperature 0.6 / top_p 0.95 / top_k 20 0/30 0/30 CJK test: answers cut at 6,000 tokens 42/50 42/50 The 20 CJK characters of the battery's smoke test were one unlucky sample: send sampling settings from the client (opencode needs
"temperature": true).Discarded: n-gram speculative decoding (slower at every concurrency, table above).
Requirements & install
Before you install (checked on a clean Ubuntu 24.04 host with an A40, 2026-10-28):
- An NVIDIA driver that supports CUDA 13.2 (tested with 595.84) and uv.
- The Python 3.12 headers and a C compiler.
uv venv --python 3.12uses the system Python 3.12 when there is one, and Triton compiles a small C helper every time vLLM starts; without the headers everyvllm servestops withfatal error: Python.h: No such file or directory. On Debian/Ubuntu:sudo apt-get update && sudo apt-get install -y python3.12-dev build-essential. - No CUDA toolkit is needed: the FlashInfer line below installs prebuilt kernels (without it, vLLM looks for
nvccat start and fails withCould not find nvcc and default cuda_home='/usr/local/cuda' doesn't exist). - Disk: about 20 GB for the venv, as much again for uv's cache (
uv cache cleanfrees it), plus the model.
EXL3 is not a native vLLM format and Spark-X2.5 is not a native vLLM model. One plugin is loaded through vLLM's vllm.general_plugins entry point:
- vllm-quantpack (ours, on PyPI): EXL3 linear, embedding and MoE layers through exllamav3's kernels, plus the Spark-X2.5 model.
- exllamav3 1.5.1 (the serving runtime; the checkpoint was converted with 1.6.4) and Python 3.12 (the exllamav3 wheels are cp312).
uv venv --python 3.12 venv
uv pip install --python venv/bin/python vllm==0.31.0 --torch-backend=auto # torch 2.13.0
uv pip install --python venv/bin/python flashinfer-cubin==0.7.0.post1 flashinfer-jit-cache==0.7.0.post1+cu130 \
--extra-index-url https://flashinfer.ai/whl/ --extra-index-url https://flashinfer.ai/whl/cu130/ --index-strategy unsafe-best-match # FlashInfer kernels
W=exllamav3-1.5.1+cu132.torch2.13.0-cp312-cp312-linux_x86_64.whl
curl -L -o /tmp/$W "https://github.com/turboderp-org/exllamav3/releases/download/v1.5.1/${W/+/%2B}"
uv pip install --python venv/bin/python /tmp/$W vllm-quantpack
venv/bin/python -c "import torch; from exllamav3.ext import exllamav3_ext; import spark_vllm; print(torch.__version__, torch.cuda.get_device_name(0))"
Plugin (2026-10-28): vllm-quantpack (
pip install vllm-quantpack) replaces the OrcaSAQ2 +qwen38_exl3_visionplugins +spark_vllm. The measurements in this card were made with the previous stack (OrcaSAQ2 + our plugins); this checkpoint was then served again with vllm-quantpack 0.1.0 following this card on a clean install (text, image and tool calls checked). The previous files stay inplugin/andpatches/for reference.
Quick start
12 GB GPU, 262,144-token context, one full-context session (or several shorter ones sharing the pool):
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
vllm serve JRamirez-UAB/Spark-X2.5-4B-EXL3-6.00bpw-8-16GB \
--served-model-name spark-x2.5-4b \
--max-model-len 262144 \
--kv-cache-dtype fp8_e4m3 \
--kv-cache-memory-bytes 6462373888 \
--max-num-batched-tokens 2048 \
--max-num-seqs 4 \
--enable-prefix-caching \
--reasoning-parser qwen3 \
--enable-auto-tool-choice --tool-call-parser glm47
- 16 GB:
--kv-cache-memory-bytes 10762374348(two concurrent 262,144-token sessions). - 8 GB:
--max-model-len 106496 --kv-cache-memory-bytes 2222645575. --tool-call-parser glm47matches the checkpoint's chat template (<tool_call>with<arg_key>/<arg_value>).
Using it with opencode (how we tested)
Tested with opencode 1.18.35. Tool calling was measured with the real opencode request (its long system prompt and 11 tools, captured and replayed against
vLLM) and with opencode run agent tasks; context, speed and memory tests were run directly against the vLLM API.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"local-vllm": {
"npm": "@ai-sdk/openai-compatible",
"name": "local vLLM",
"options": { "baseURL": "http://127.0.0.1:8000/v1" },
"models": {
"spark-x2.5-4b": {
"name": "Spark-X2.5-4B EXL3 (local)",
"tool_call": true,
"temperature": true,
"limit": { "context": 262144, "output": 16000 }
}
}
}
},
"agent": {
"build": { "model": "local-vllm/spark-x2.5-4b", "temperature": 0.9 },
"plan": { "model": "local-vllm/spark-x2.5-4b", "temperature": 0.9 }
}
}
- Declare
"temperature": truein the model, otherwise opencode sends no temperature to a custom model. limit.context=--max-model-len(106496 on 8 GB). The agent tasks in Results ran at temperature 1.0, before the loop test set 0.9.
Important notes
- Memory. Size the KV cache with
--kv-cache-memory-bytes, not--gpu-memory-utilization. Read the real headroom withnvidia-smi --query-gpu=memory.used,memory.free --format=csv; a desktop session on the same GPU eats the margin in the capacity table. - Hugging Face page warnings: the "Model size" Hugging Face shows counts packed storage elements (EXL3 packs several weights into each
int16), not parameters. The Configuration Parsing Warning "quantization_config.bitsmust be an integer" is expected: for EXL3bitsis an average. - Use
--reasoning-parser qwen3(<think>blocks) and--tool-call-parser glm47.
Quantization recipe
| Step | What we did |
|---|---|
| Conversion | exllamav3 1.6.4 convert_model: 6.00 bpw (-b 6), lm_head 6 bits, embeddings BF16, codebook mul1 |
| Calibration | exllamav3's built-in calibration set, 250 rows × 2,048 tokens |
| Bit allocation | uniform target rate (no SC per-tensor optimisation) |
| Hardware | one GPU; about 20 minutes |
Tokenizer, chat template and remote code unchanged; generation_config.json changed to our recommended sampling (temperature 0.9, top_p 0.95, top_k 20).
Integrity and validation
Artifact integrity
- Every file is checked against our local copy with SHA-256 (
SHA256SUMS); the checkpoint was downloaded back from this repo and served with the Quick start.
Quantization
- Fidelity: KL divergence against BF16 with exllamav3's
qbenchon three traces (table above).
Chat template
- Unchanged from the base model; tool calls parse with
glm47(60/60 in the replay of the real opencode request).
Runtime
- Load, needle, tool calls, agent tasks, concurrency, VRAM and the loop test: see Results; engine errors during the runs: 0.
Scope: results apply to this revision, the stack above (vLLM 0.31.0 + exllamav3 1.5.1 + OrcaSAQ2 7ddffb12 with our patch + spark_vllm 0.1.0), the
A40 / L40S / RTX PRO 6000 GPUs and the settings stated above; other setups are not tested.
Limitations
- Review the commands before they run. As an agent, the model proposes shell commands and opencode can execute them: give it a non-privileged account and a test machine.
- Needs our
vllm-quantpackplugin; it will not load with stock vLLM, Transformers or SGLang. - Long reasoning: with a small output budget many answers end inside the reasoning (see Known model behaviour). Answers with thinking disabled were not measured.
- Agent tasks: 17/30, clearly below the 27B models we publish; use it where memory is the constraint.
- The 8 / 12 / 16 GB rows were measured on a 48 GB GPU with the KV cache and VRAM sized for each size, not on physical 8 / 12 / 16 GB cards.
- Quality was not evaluated with standard benchmarks. All numbers come from one software stack.
Feedback welcome
I would be grateful for reports of installations of this checkpoint, both working and failed ones, especially on real 8 / 12 / 16 GB GPUs. Please open a discussion in the Community tab with your GPU, driver, vLLM / exllamav3 / plugin versions, the full command line and the result.
Credits & license
- Base model: XHToken/Spark-X2.5-4B (Apache-2.0).
- exllamav3 and the EXL3 format by turboderp (MIT), including
qbenchand the public evaluation trace; EXL3 is based on QTIP (Tseng et al.). - vLLM integration: the OrcaSAQ2 plugin by Continuum AI Corp; vLLM.
- Our code:
plugin/spark_vllm/,patches/,setup.sh(Apache-2.0).
Apache-2.0, same as the base model. This is a community quantization, not an official XHToken release. exllamav3, vLLM and OrcaSAQ2 are not redistributed here; install them from their repositories under their own licenses.