Instructions to use hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw 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("hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw") 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 hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw"
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": "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw 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 "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw"
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 hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw"
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 "hermitdave/Spark-X2.6-4B-MLX-MACaQ-Hadamard-4.25bpw" \ --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 — MLX MACaQ Hadamard W4A16
A 32-block Hadamard-rotated MACaQ quantization of
XHToken/Spark-X2.6-4B at 4.25 bpw. Unlike Spark-X2.6-1.7B, the rotated
path measurably helps this checkpoint: it is the best 4-bit variant we tested
on both zero-shot tasks and WikiText-2 perplexity.
This checkpoint ships a model_file shim. Load it with
trust_remote_code=True, including in oMLX.
Validation
Perplexity
Pinned WikiText-2 test corpus (199,902 tokens, context 2048):
| Model | PPL ↓ |
|---|---|
| BF16 | 23.14 |
| MACaQ Hadamard 4.25 | 25.73 |
| MACaQ weight-only 4.25 | 25.78 |
| RCO 4.5 nominal | 27.71 |
| MXFP4 RTN 4.25 | 129.63 |
Throughput
M3 Max (64 GB), natural WikiText-2 prompt (~988 tokens), 256 generated tokens,
mlx_lm.generate:
| Model | Prompt TPS | Decode TPS | Peak memory |
|---|---|---|---|
| BF16 | 1292.7 | 41.3 | 8.98 GB |
| MACaQ Hadamard 4.25 | 1171.3 | 96.0 | 3.71 GB |
| MACaQ weight-only 4.25 | 1274.0 | 122.2 | 3.24 GB |
| RCO 4.5 nominal | 1272.0 | 104.6 | 3.85 GB |
The weight-only variant is the faster fallback; Hadamard is the quality choice.
Zero-shot evaluation
model-eval, 400 items per task, Wilson 95% confidence intervals:
| Task | BF16 | MACaQ Hadamard | Δ | p (McNemar) | MACaQ weight-only | RCO 4.5 |
|---|---|---|---|---|---|---|
| ARC-Challenge | 0.3475 [0.303, 0.395] | 0.3550 [0.310, 0.403] | +0.0075 | 0.7359 | 0.3025 [0.260, 0.349] | 0.3000 [0.257, 0.347] |
| ARC-Easy | 0.5775 [0.529, 0.625] | 0.5775 [0.529, 0.625] | 0.0000 | 1.0000 | 0.5175 [0.469, 0.566] | 0.5225 [0.474, 0.571] |
| HellaSwag | 0.4000 [0.353, 0.449] | 0.3800 [0.334, 0.429] | −0.0200 | 0.0386 | 0.4000 [0.353, 0.449] | 0.3800 [0.334, 0.429] |
| WinoGrande | 0.5350 [0.486, 0.583] | 0.5575 [0.509, 0.605] | +0.0225 | 0.3425 | 0.5200 [0.471, 0.569] | 0.5175 [0.469, 0.566] |
| MMLU | 0.3225 [0.279, 0.370] | 0.3050 [0.262, 0.352] | −0.0175 | 0.3240 | 0.2825 [0.241, 0.329] | 0.2700 [0.229, 0.316] |
Δ and p compare Hadamard against BF16 on the same items (exact two-sided McNemar). Statistically lossless verdict: yes under Bonferroni correction across five tasks (α = 0.01): no task has a significant degradation. HellaSwag is nominally p = 0.0386 but does not survive correction; under an uncorrected α = 0.05 rule it would fail.
Other paired comparisons:
- Hadamard vs weight-only: ARC-Challenge p = 0.0046 and ARC-Easy p = 0.0079 favour Hadamard.
- Hadamard vs RCO: ARC-Challenge p = 0.0038 and ARC-Easy p = 0.0103 favour Hadamard (ARC-Easy is borderline after correction).
Full tables, paired statistics and the RCO recipe are in
macaq-mlx/docs/SPARK26_4B_EVAL.md. Raw results are in validation/.
Method
For each quantized linear: apply the per-channel scale t, rotate into a
32-block Walsh-Hadamard basis, screen exponents under the diagonal Hessian,
then Flip-Refinement under the full rotated Hessian. Weights are stored as
MLX-native MXFP4 E8M0 codes; activations are rotated online by the shipped
macaq_model.py.
Calibration: 65,536 WikiText tokens, 512-token sequences, ridge 1.0,
alpha 1.0, 256 flip sweeps. The fused flip kernel from macaq_refine.py
was used during quantization.
Attribution
MACaQ algorithm: Huawei CSL MACaQ (Apache-2.0). Fused flip kernel adapted from rgarcia-fx/macaq-mlx (Apache-2.0). This port and validation were developed with Hermes Agent. Base model © XHToken/SparkLLM, Apache-2.0.
- Downloads last month
- 265
Quantized