Instructions to use Jakevin/spark-x2.6-4b-mixed-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Jakevin/spark-x2.6-4b-mixed-mlx 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("Jakevin/spark-x2.6-4b-mixed-mlx") 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 Jakevin/spark-x2.6-4b-mixed-mlx with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Jakevin/spark-x2.6-4b-mixed-mlx"
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": "Jakevin/spark-x2.6-4b-mixed-mlx" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use Jakevin/spark-x2.6-4b-mixed-mlx with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Jakevin/spark-x2.6-4b-mixed-mlx"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Jakevin/spark-x2.6-4b-mixed-mlx" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jakevin/spark-x2.6-4b-mixed-mlx", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use Jakevin/spark-x2.6-4b-mixed-mlx 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 "Jakevin/spark-x2.6-4b-mixed-mlx"
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 Jakevin/spark-x2.6-4b-mixed-mlx
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Jakevin/spark-x2.6-4b-mixed-mlx with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Jakevin/spark-x2.6-4b-mixed-mlx"
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 "Jakevin/spark-x2.6-4b-mixed-mlx" \ --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.6-4B mixed48 (MLX, 4-bit GPTQ + 8-bit sensitive layers)
MLX quantization of XHToken/Spark-X2.6-4B for Apple Silicon.
- All 180 linear layers quantized with GPTQ: 167 at 4-bit, 13 most sensitive projections at 8-bit (group size 64). Embedding / tied LM head: 4-bit. Norms and per-head attention output gates: bf16.
- File size 2.48 GB (bf16 original: 8.22 GB). About 4.85 bits per weight as stored by MLX.
Results (measured on an M4 Pro Mac mini, 64 GB)
| Model | Size | Mean KL vs bf16 (nats/token) | Top-1 agree | MMLU-Pro (700-question holdout) | Decode tok/s |
|---|---|---|---|---|---|
| bf16 original | 8.22 GB | 0 | 100% | 36.4% | 27.5 |
| MLX 4-bit RTN (standard) | 2.31 GB | 0.212 | 82.7% | 34.7% | 85.6 |
| this model (mixed48) | 2.48 GB | 0.050 | 88.1% | 37.1% | 81.1 |
- KL / top-1: 16 held-out sequences, 4,617 tokens.
- MMLU-Pro: a fixed 700-question subset (questions 300–999 of our 1,000-question sample) not used for any build decision; 10-choice, single run, no confidence interval reported. Accuracy is within noise of bf16, but only 81.6% of the questions bf16 answers correctly are still answered correctly (answers shift on low-confidence questions), so per-question behaviour is not identical to bf16.
- Peak memory during generation: 3.96 GB.
Usage
spark2_5 is a custom architecture not yet in mlx-lm, so this repo ships the MLX model file spark2_5.py.
pip install mlx-lm
hf download Jakevin/spark-x2.6-4b-mixed-mlx --local-dir spark-mixed48
python spark-mixed48/run_mlx.py "Hello"
run_mlx.py registers spark2_5.py with mlx-lm and calls mlx_lm.load / generate. The original modeling_spark.py is kept for reference (PyTorch, trust_remote_code).
Limitations
- Evaluated only on MMLU-Pro subsets and KL on short text; no long-context, coding, or chat-quality evaluation.
- The holdout has 700 questions, fewer than the 1,000 we originally targeted.
- Sliding-window (512) + full attention 3:1 layout is reproduced in
spark2_5.py; greedy outputs of the bf16 MLX port matched the reference transformers implementation token-for-token on 5 short prompts.
License
Apache-2.0, same as the base model (see LICENSE).
Comparison chart (all MLX builds of this base model)
| Revision | GiB | KL DIV | PPL | MMLU-Pro (700) | Decode tok/s |
|---|---|---|---|---|---|
| bf16 | 7.66 | 0.0000 | 12.43 | 36.4% | 27.5 |
| MLX 4-bit RTN | 2.15 | 0.2125 | 14.23 | 34.7% | 85.6 |
| GPTQ 4-bit | 2.16 | 0.0509 | 12.51 | 37.7% | 85.2 |
| mixed48 | 2.31 | 0.0496 | 12.80 | 37.1% | 81.1 |
| tern48 (unreleased) | 2.31 | 0.1416 | 13.30 | 37.1% | 79.5 |
| mixed 3 bpw (unreleased) | 1.50 | 1.3204 | 31.22 | — | 99.4 |
| ternary 3 bpw (unreleased) | 1.50 | 1.0873 | 29.29 | — | 96.7 |
KL and PPL: 16 held-out sequences (4,601 predicted positions, full vocabulary) against the MLX bf16 model. These numbers are not comparable with KL/PPL reported by other tools (llama.cpp, exllamav3), which use different chunking and reference text.
For reference, on the same 700 MMLU-Pro questions with the same prompt and scoring, llama.cpp GGUF Q4_K_M builds scored 34.1–35.4% (XHToken official 34.1%, bartowski 35.4%) and GGUF bf16 scored 36.6%. With 700 questions the standard error of a single score is roughly ±1.8 points, so these MMLU-Pro differences are within noise; no paired significance test was run.
- Downloads last month
- 79
4-bit
