Built with mlx-optiq, the MLX-native toolkit to quantize, fine-tune, and serve LLMs locally on Apple Silicon, no PyTorch and no cloud. Try the Lab · All OptiQ quants · Docs
A mixed-precision MLX quant of XHToken/Spark-X2.6-4B, the on-device agent model that follows Spark-X2.5 with improved post-training for coding, tool use, long context and reasoning. 2.8 GB on disk, down from 7.7 GB bf16. See the original card for what the model is trained to do and how XHToken evaluates it.
Spark is a new architecture for MLX, and mlx-optiq adds support for it, so import optiq before mlx_lm.load: stock mlx-lm does not know the spark2_5 model type.
The per-layer allocation was not measured on this model. It was transferred from mlx-community/Spark-X2.5-4B-OptiQ-4bit, whose allocation came from a KL-divergence sensitivity sweep over a six-domain calibration mix. Spark-X2.6 keeps exactly the same architecture and modeling code as X2.5, and all 217 tensors matched with none unmatched.
The one miss is bare mental arithmetic with thinking off, where the quant answers in a single token with no working; the Spark-X2.5 quant makes the same slip. With thinking on, the default, it gets it right.
Thinking is on by default. The chat template takes reasoning_effort of high (the default) or low to set how much it thinks, or enable_thinking: false to turn it off; pass them as chat_template_kwargs at the endpoint or as keywords to apply_chat_template. Through optiq serve, the standard reasoning_effort: "none" also turns it off. XHToken's sampling defaults, temperature 1.0 and top_p 0.95, are bundled in generation_config.json.
import os
os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com"
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("mlx-community/Spark-X2.6-4B-OptiQ-4bit", revision="6d83e911abefcbbb9c7c595e6517264f36db03dd")
model = AutoModelForCausalLM.from_pretrained("mlx-community/Spark-X2.6-4B-OptiQ-4bit", revision="6d83e911abefcbbb9c7c595e6517264f36db03dd", device_map="auto")