Instructions to use OsaurusAI/Spark-X2.5-4B-JANG_6M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OsaurusAI/Spark-X2.5-4B-JANG_6M 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("OsaurusAI/Spark-X2.5-4B-JANG_6M") 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 OsaurusAI/Spark-X2.5-4B-JANG_6M with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OsaurusAI/Spark-X2.5-4B-JANG_6M"
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": "OsaurusAI/Spark-X2.5-4B-JANG_6M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use OsaurusAI/Spark-X2.5-4B-JANG_6M with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "OsaurusAI/Spark-X2.5-4B-JANG_6M"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "OsaurusAI/Spark-X2.5-4B-JANG_6M" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OsaurusAI/Spark-X2.5-4B-JANG_6M", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use OsaurusAI/Spark-X2.5-4B-JANG_6M 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 "OsaurusAI/Spark-X2.5-4B-JANG_6M"
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 OsaurusAI/Spark-X2.5-4B-JANG_6M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use OsaurusAI/Spark-X2.5-4B-JANG_6M with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OsaurusAI/Spark-X2.5-4B-JANG_6M"
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 "OsaurusAI/Spark-X2.5-4B-JANG_6M" \ --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"
OsaurusAI/Spark-X2.5-4B-JANG_6M
Spark-X2.5-4B at 3.41 GiB — the size-first bundle. Fastest of the pair, and the one to run if you want headroom.
A JANG bundle of XHToken/Spark-X2.5-4B — a 4.112B dense reasoning + tool-use model — quantized for Apple Silicon / MLX. Attention and the tied embedding stay at 8-bit; the MLP carries the 6-bit budget. Every group scale is bfloat16, and the per-head attention gate and all norms are kept in full precision.
Sibling bundle: JANGQ-AI/Spark-X2.5-4B-JANG_8M — higher fidelity at 4.07 GiB.
Quality — measured, not estimated
15,839 teacher-forced positions on held-out prompts, versus the bf16 source. Calibration and evaluation prompts come from disjoint corpora, asserted at eval time.
| Bundle | Size | bits/weight | median KL ↓ | mean KL ↓ | top-1 ↑ | decode |
|---|---|---|---|---|---|---|
| Spark-X2.5-4B-JANG_6M | 3.41 GiB | 7.126 | 0.0048 | 0.0143 | 97.69% | 104.7 tok/s |
| Spark-X2.5-4B-JANG_8M | 4.07 GiB | 8.503 | 0.0017 | 0.0057 | 98.72% | 91.6 tok/s |
Decode measured as the median of 4 probes at a fixed condition (512-token prompt, 128 generated), first probe discarded, on an M5 Max. Prefill 5046 tok/s.
There is no stock-MLX comparison row, and that is not an omission. mlx-lm has no spark2_5 architecture — not in any release, not on main — so no stock MLX quantization of this model can be loaded or scored. The MLX runtime ships with these bundles.
Calibration
1,759,492 calibration tokens spanning code, agentic/tool-call transcripts, academic multiple-choice, general chat, Chinese, long-context, science and security prompts. One capture drives all three of activation-aware scaling, per-channel importance, and the error-corrected weight fit; every one of the 36 layers is covered.
Running it in Osaurus
Built for the Osaurus harness. Point Osaurus at the repo and it serves with the sampling, reasoning and tool-call contract below already declared in the bundle — jang_config.json carries the parser names, the dialect and the delimiters, so the harness wires itself with no per-model configuration.
spark2_5 is a new architecture and is not in released mlx-lm, so a bare mlx_lm.load will not resolve it — the runtime ships with the harness.
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler
model, tok = load("OsaurusAI/Spark-X2.5-4B-JANG_6M")
prompt = tok.apply_chat_template(
[{"role": "user", "content": "What is 84 * 3 / 2?"}],
add_generation_prompt=True,
)
print(generate(model, tok, prompt=prompt, max_tokens=512,
sampler=make_sampler(temp=1.0, top_p=0.95)))
Serving contract
- Sampling:
temperature=1.0, top_p=0.95, top_k=-1(-1= no truncation). Vendor defaults; declared identically ingeneration_config.jsonandjang_config.json. - Thinking is ON by default. The chat template opens the rail in the prompt: the generation prompt ends with
<|Bot|><think>. Withchat_template_kwargs={"enable_thinking": false}it ends<|Bot|></think>instead. A reasoning parser that waits for a literal<think>in the output stream will never see one — usereasoning_parser: qwen3, declared in the bundle. - Tools render into the first system block (
## Tools+ a<tools>JSON list), so adding or removing a tool rewrites the prompt prefix and forces a full re-prefill. Calls come back as<tool_call>NAME<arg_key>k</arg_key><arg_value>v</arg_value></tool_call>with no newlines;tool_parser: spark25is declared in the bundle. - EOS
1· BOS0· context 131,072 (1M positions native) · text only. generation_config.jsoncarries upstream's non-standardmax_tokenskey verbatim and has nomax_new_tokens. Pass your own generation cap.
What's in the bundle
- 181 quantized tensors, each with an explicit per-module
quantizationentry inconfig.json— nothing falls back to a top-level default. - 109 full-precision passthrough tensors: the per-head attention gate and all norms.
- bfloat16 group scales throughout.
- Zero misaligned tensor payloads (652/652 verified), so no realigning copy at load.
- No
auto_mapand no remote-code.pyfiles — the runtime comes from the harness, so loading never stops on atrust_remote_codeprompt.
Quantized and verified by Jinho Jang — eric@osaurus.ai. Base model © XHToken, Apache-2.0 (inherited).
- Downloads last month
- -
Quantized
