CoolFace
Modelpublic

miifanboy/Spark-X2.5-4B-i1-GGUF

sourceHugging Faceapache-2.0updated 25d agoView on Hugging Face
4likes7.3kdownloads
Model Card
Most of this README.md and the plots are generated by the Spark-X2.5-4B-IQ4_XS quant.

Spark-X2.5-4B — IMatrix Quantized GGUF Variants

Overview

This repository provides the imatrix quantized variants of Spark-X2.5-4B, a compact, general-purpose language model designed for conversation, writing, translation, reasoning, coding, tool use, and agentic workflows. The model uses a hybrid attention architecture, supports a native context length of up to 1M tokens, and covers more than 200 languages. The quantized variants in this repository were created following the imatrix methodology, preserving high quality while offering flexible deployment across a range of precision levels.

<img src="plots/SameTop-1.png" width="100%" /> <img src="plots/MedianKLD.png" width="100%" />

Quantized Variants

The table below lists each quantized variant, its file size, and its recommendation status.

QuantFile Size (GB)Recommendation
IQ3_XXS1.68Not Recommended, need detailed system prompts.
Q3KS1.77Not Recommended, need detailed system prompts.
IQ3_M1.90Not Recommended, need detailed system prompts.
Q3KM2.02Not Recommended, need detailed system prompts.
IQ4_XS2.21Recommended, if VRAM constrained.
Q4KS2.26Recommended for CPU, otherwise use IQ4_XS.
IQ4_NL2.31Not Recommended, use Q4KM instead.
Q4KM2.42Highly Recommended but use Q5KS if you have memory.
Q5KS2.68Highly Recommended
Q5KM2.77Highly Recommended
Q6_K3.15Highly Recommended
Q8_04.07Overkill
Note: Recommendations are written by Mii Fanboy.

Recommended Quants (w/ KV Cache Q80/Q80) For Different Use Cases

Use Case4 GB8 GB12+ GB
Classification (16k-32k)Q5KSQ6_KQ6_K
Summarization (16k-32k)Q5KSQ6_KQ6_K
Agentic Coding (64k-128k)Q3KMQ6_KQ8_0
Agentic Coding (128k-200k)N/AQ5KSQ8_0
Agentic Coding (Max ctx)Q3KM (72k)IQ4_XS (235k)IQ4_XS (332k)
Note: If you are using CPU, stick with Q quants. IQ quants would be much slower on CPU.

KLD Benchmark Summary

The table below reproduces the KLD benchmark results for all quantized variants. It aggregates the evaluation measurements across KLD, perplexity, and accuracy metrics for every variant.

QuantizationMean PPL(Q)Mean KLDMedian KLD95.0% KLD99.0% KLD99.9% KLDMax KLDSame Top-1 %StdErr KLDMean PPL(base)
IQ3_XXS9.585010.3798120.1743141.4060483.0125237.91174720.63521676.1150.002948.627627
Q3KS11.3300440.4512570.1952981.7514333.6862948.06255318.68670174.550.003358.627627
IQ3_M9.2607180.2423640.1019960.8896322.1640455.67211617.10600581.0110.0021418.627627
Q3KM9.3828120.2136870.0800690.8297391.9986385.21888720.48662982.2270.0020078.627627
IQ4_XS8.8444030.1165130.0381280.4496861.1621224.32838921.46340286.8770.001498.627627
Q4KS8.8248780.1085770.0365290.3944791.017884.60487119.59564287.5030.00158.627627
IQ4_NL8.9220960.109080.0367190.4137821.0406383.8200219.50444887.1140.0013718.627627
Q4KM8.7234860.0955760.03160.3484880.9007924.24561318.72791988.160.0013438.627627
Q5KS8.7362020.0390460.0111890.1356880.382772.07436219.15254892.4820.0008528.627627
Q5KM8.7306760.031150.0092670.1056850.2971421.61320821.26257193.1410.000778.627627
Q6_K8.6244430.0128140.002920.039260.1308320.93440213.41736795.8670.0004818.627627
Q8_08.6200910.003040.0005670.007570.0271350.2465434.11872298.0750.0001798.627627

Methodology

Imatrix Quantization Method

The imatrix quants were created by converting the base Spark-X2.5-4B model into a range of quantized variants, including the IQ3, Q3, IQ4, Q4, Q5, Q6, and Q8 series. Each quantized model is evaluated to verify its accuracy, quality, and overall performance before being included in this collection.

Dataset Creation

We used the bartowski-imatrix-v5-semantic calibration dataset as the input data. The dataset was split into two parts: a 70% imatrix calibration portion and a 30% KLD evaluation portion, using a fixed seed to ensure reproducibility. The 70% portion is used for imatrix quantization calibration, while the 30% portion is reserved for KL divergence evaluation.

KLD Measurement Method

For KLD measurements, we first generated the baseline logits from the original base Spark-X2.5-4B model and saved them as the reference. Then, for each quantized model, we computed the KL divergence between the model's outputs and the baseline logits using the perplexity tool. The KLD measurements were performed with a context length (ctx) of 4096, a batch of 2048, and an ub of 512. The evaluation results, including Mean KLD, Median KLD, and accuracy metrics such as Mean PPL and Same Top-1 %, were aggregated and saved into the kldbenchmarksummary table.

Local Deployment

The GGUF file can be used for local inference with Ollama and LM Studio. Spark-X2.5 support is provided by XHToken/llama.cpp, so the Quick Starts below use this compatible implementation.

Ollama Quick Start

Build

bash
git clone https://github.com/XHToken/llama.cpp.git llama.cpp-spark
git clone https://github.com/ollama/ollama.git ollama-spark
cd ollama-spark
export OLLAMA_LLAMA_CPP_SOURCE="$(cd ../llama.cpp-spark && pwd)"
cmake -S . -B build
cmake --build build --parallel 8

Import the GGUF

Replace the model path below with the absolute path to the downloaded GGUF file:

bash
printf 'FROM /absolute/path/to/Spark-X2.5-4B.gguf\n' > ./Modelfile.spark

Create and Run

Start the Ollama server in the first terminal:

bash
./ollama serve

Open a second terminal in the same ollama-spark directory:

bash
./ollama create Spark-X2.5-4B -f ./Modelfile.spark
./ollama run Spark-X2.5-4B --think=false

--think=false disables thinking mode for faster, direct responses.

LM Studio Quick Start

Build the Compatible llama.cpp Runtime

bash
git clone https://github.com/XHToken/llama.cpp.git llama.cpp-spark
cd llama.cpp-spark
cmake -S . -B build
cmake --build build --parallel 8

Configure LM Studio

  1. 1.Close LM Studio.
  2. 2.Back up the selected LM Studio runtime directory:
text
   <LM_STUDIO_HOME>/extensions/backends/<selected-runtime>/
  1. 1.Copy the llama.cpp-spark build output into the selected runtime directory, replacing the existing runtime files.
  2. 2.Place Spark-X2.5-4B.gguf in:
text
   <LM_STUDIO_HOME>/models/<org>/<name>/

Example runtime directory on Apple Silicon:

text
./build/bin/* -> ~/.lmstudio/extensions/backends/llama.cpp-mac-arm64-apple-metal-advsimd-<version>/

Run

Open LM Studio, select the model under My Models, click Load, and start a new chat.

You can also use the lms CLI:

bash
lms ls
lms load <model>
lms chat <model>

License

Released under the Apache License 2.0.