Instructions to use xunlinkx/Spark-X2.5-4B-oQ6e-fp16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use xunlinkx/Spark-X2.5-4B-oQ6e-fp16 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("xunlinkx/Spark-X2.5-4B-oQ6e-fp16") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use xunlinkx/Spark-X2.5-4B-oQ6e-fp16 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "xunlinkx/Spark-X2.5-4B-oQ6e-fp16"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "xunlinkx/Spark-X2.5-4B-oQ6e-fp16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use xunlinkx/Spark-X2.5-4B-oQ6e-fp16 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "xunlinkx/Spark-X2.5-4B-oQ6e-fp16"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "xunlinkx/Spark-X2.5-4B-oQ6e-fp16" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xunlinkx/Spark-X2.5-4B-oQ6e-fp16", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use xunlinkx/Spark-X2.5-4B-oQ6e-fp16 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "xunlinkx/Spark-X2.5-4B-oQ6e-fp16"
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 xunlinkx/Spark-X2.5-4B-oQ6e-fp16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use xunlinkx/Spark-X2.5-4B-oQ6e-fp16 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "xunlinkx/Spark-X2.5-4B-oQ6e-fp16"
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 "xunlinkx/Spark-X2.5-4B-oQ6e-fp16" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Spark-X2.5-4B — MLX oQ6e (fp16 source)
Model Details
Model Description
oQ6e-quantized MLX build (created by xunlinkx with the omlx pipeline) of XHToken/Spark-X2.5-4B for first-class, all-local serving on Apple Silicon via omlx (the MLX OpenAI-compatible server) and mlx-lm.
Attribution chain: XHToken/Spark-X2.5-4B (official base, Apache-2.0) → xunlinkx's oQ6e quantization (this repo).
This is not a new model — it is a quantization of the existing checkpoint,
produced with omlx's quantize_oq_streaming(..., oq_level=6, enhanced=True)
pipeline (128×512-block imatrix calibration). The -fp16 suffix records that
the quantizer consumed full-precision float16 source weights
(best-fidelity input), as opposed to bf16 or already-quantized sources. The
mixed-bit per-layer layout is embedded in config.json (quantization /
quantization_config) so it is restored automatically on load.
- Developed by: xunlinkx (oQ6e quantization + MLX build, using omlx)
- Base model by: XHToken (Spark-X2.5-4B)
- Shared by: xunlinkx
- Model type:
spark2_5text-generation decoder (MLX quantized,model_type: spark2_5) - Language(s) (NLP): multilingual (base model; Spark-X2.5 pretraining, including English/Chinese coverage)
- License: Apache 2.0 (inherits the base checkpoint license)
Compatibility — Spark support required (patch it yourself until mainline)
model_type: spark2_5 loads only where native support exists. Native support is still converging (as of 2026-09-15): mlx-lm has not merged
#1891, and omlx main carries a vendored patch (#3606) that no tagged release
includes yet. Until then:
- mlx-lm users: checkout
ml-explore/mlx-lm#1891
(
gh pr checkout 1891inside a mlx-lm clone, orpip install "mlx-lm @ git+https://github.com/xunlinkx/mlx-lm@spark2_5-native"; ab1806e-era alternative for omlx-scheduler compatibility:.../xunlinkx/mlx-lm@spark2_5-backport). - omlx users: spark support is on main since
jundot/omlx#3606 (2026-09-14,
vendored patch, self-disabling once the native module is present) — but no
tagged release includes it yet (latest stable v0.6.4 and the 0.7.0.dev
pre-releases all predate it). Run omlx from source main, or apply
jundot/omlx#3671 for the oQ
rules + mlx-lm pin (
gh pr checkout 3671).
Loading this checkpoint with an mlx-lm that predates spark2_5 support fails
with an unsupported-model-type error. No other requirements: standard MLX
safetensors + config.json, no custom code needed once support is present.
Quantization detail (exact, from config.json)
- 7.013 weight-bits per parameter average (group_size 64, affine). Embeddings and norms stay fp16; per-group scales add ~0.25 bpw on disk.
- Layout: 6-bit base; sigmoid head gates (
self_attn.g_proj) at 8-bit on 22 of 36 layers (6-bit elsewhere); attention/MLP projections lifted to 8-bit on a handful of sensitive layers each. - Sibling levels in this family: oQ4e (5.178 bpw), oQ5e (6.098 bpw),
oQ8e (8.653 bpw) — see
xunlinkx/Spark-X2.5-4B-oQ{e}-fp16.
Sampling (official, per the XHToken model card)
- temperature 1.0, top_p 0.95, top_k −1 (disabled); thinking mode default. (Early third-party guides suggesting 0.6–0.7 do not match the official card.)
Usage
mlx_lm.generate --model xunlinkx/Spark-X2.5-4B-oQ6e-fp16 \
-p "The secret to baking a good cake is" -m 1024 \
--temp 1.0 --top-p 0.95
omlx serve --host 127.0.0.1 --port 8005
# model id: Spark-X2.5-4B-oQ6e-fp16 (OpenAI-compatible /v1/chat/completions)
License
Apache-2.0, inherited from XHToken/Spark-X2.5-4B.
- Downloads last month
- 124
6-bit