Instructions to use Ilides/Spartan-1.2-2B-MLX-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Ilides/Spartan-1.2-2B-MLX-8bit 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("Ilides/Spartan-1.2-2B-MLX-8bit") 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 Ilides/Spartan-1.2-2B-MLX-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Ilides/Spartan-1.2-2B-MLX-8bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Ilides/Spartan-1.2-2B-MLX-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use Ilides/Spartan-1.2-2B-MLX-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Ilides/Spartan-1.2-2B-MLX-8bit"
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 "Ilides/Spartan-1.2-2B-MLX-8bit" \ --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"
- MLX LM
How to use Ilides/Spartan-1.2-2B-MLX-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Ilides/Spartan-1.2-2B-MLX-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Ilides/Spartan-1.2-2B-MLX-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ilides/Spartan-1.2-2B-MLX-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use Ilides/Spartan-1.2-2B-MLX-8bit 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 "Ilides/Spartan-1.2-2B-MLX-8bit"
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 Ilides/Spartan-1.2-2B-MLX-8bit
Run Hermes
hermes
Spartan 1.2 2B (MLX 4-bit)
Fine-tuned Qwen3.5-2B by Ilides for agentic coding in VS Code, Kilo Code, Jarvis and LM Studio on Apple Silicon.
Spartan 1.2 adds an anti-loop patch on top of Spartan 1.1: fewer repeated cd/bash calls, better tool-call formatting, workspace-relative paths.
For the latest MLX build with stronger workspace-path enforcement, see Spartan 1.3.
For llama.cpp / Ollama, see Spartan 1.2 GGUF.
Model specs
| Property | Value |
|---|---|
| Architecture | Qwen3_5ForConditionalGeneration |
| Parameters | 1,881,824,512 (~1.88B) |
| Layers | 24 (18× linear attention + 6× full attention, every 4th layer) |
| Hidden size | 2048 |
| Attention heads | 8 (KV heads: 2) |
| FFN size | 6144 |
| Vocab | 248,320 |
| Max context | 262,144 tokens (model config) |
| Quantization | 4-bit affine, group_size 64 (~4.5 bpw) |
| On-disk weights | model.safetensors — 1.01 GB |
| Format | MLX (Apple Silicon) |
| Dtype (base) | bfloat16 |
Training
| Property | Value |
|---|---|
| Base model | Spartan 1.1 (LoRA on Qwen3.5-2B) |
| Method | LoRA (rank 8, 6 layers, 2.08M trainable params = 0.11%) |
| Iterations | 200 |
| Learning rate | 3.0e-6 |
| Final val loss | 0.709 |
| Final train loss | 0.844 |
| Peak memory | 15.3 GB |
| Training data | 862 train / 95 valid samples |
| Data mix | 5% chat, 10% coding, 85% agentic |
| Curated agentic | 30 samples (spartan_agentic_v11.jsonl) |
What 1.2 fixes vs 1.1: anti-loop behavior (no repeated cd/bash), tool-call JSON format, fewer absolute-path writes.
Functional tests (real, 2026-08-03)
Run locally:
git clone https://github.com/ilides/cortex # or use local repo
cd "cortex ai"
source .venv/bin/activate
python scripts/validate_spartan.py --model ../cortex/models/Spartan-1.2-2B-MLX-8bit
Results on Apple Silicon (5 cases, max_tokens=256):
| Test | Category | Result | Speed |
|---|---|---|---|
| Explain async/await | chat | ✅ pass | 48 tok/s |
| Binary search in Rust | coding | ❌ fail* | 45 tok/s |
| Create Amazon-style HTML | agentic | ❌ fail** | 27 tok/s |
| Find TODO in src/ | agentic | ✅ pass | 23 tok/s |
| Write styles.css dark theme | agentic | ❌ fail** | 28 tok/s |
Summary: 2/5 passed · avg 34.3 tok/s
* Rust code was generated inside a fenced block but regex missed fn due to thinking preamble.
** Model outputs prose/CSS in code blocks instead of [Tool: Write] calls for file-creation prompts. Path safety checks (no /Users/, no /Desktop/) did pass.
Intended use
- Agentic coding assistants (Kilo Code, Jarvis, Cortex)
- LM Studio on Mac (MLX backend)
- Short coding tasks, tool routing, grep/read/bash patterns
- Spanish and English prompts
Not recommended for: long autonomous chains, production HTML generation, tasks requiring 100% reliable tool-call syntax.
System prompt
Use the agentic_v11 prompt (workspace-relative paths, anti-loop):
python scripts/print_system_prompt.py agentic_v11
Or for Kilo Code:
python scripts/print_system_prompt.py kilo_code
Inference settings (from project config):
| Setting | Value |
|---|---|
| temperature | 0.4 |
| max_tokens | 4096 |
| context (LM Studio) | 8192 |
| thinking | OFF (disable in host UI) |
Load
pip install mlx-lm
python -m mlx_lm.generate --model Ilides/Spartan-1.2-2B-MLX-8bit \
--system "You are Spartan 1.2..." --prompt "Hello"
Or in Python:
from mlx_lm import load, generate
model, tokenizer = load("Ilides/Spartan-1.2-2B-MLX-8bit")
Known limitations
- 2B size: limited reasoning depth; may narrate instead of calling tools on file-creation tasks
- Thinking tags: Qwen3.5 may emit `` blocks — disable thinking in the host app
- HTML quality: basic output; not suitable for polished frontends
- Tool format: expects
[Tool: Name] {"arg": "value"}— host must parse this - Chat template: patched to avoid crash when conversation ends with tool messages (Jarvis/Kilo)
Lineage
Qwen3.5-2B → Spartan 2B (900 iters, val 1.05)
→ Spartan 1.1 (450 iters, val 0.829)
→ Spartan 1.2 (200 iters, val 0.709) ← this model
→ Spartan 1.3 (workspace patch)
License
Apache 2.0 (inherits from Qwen3.5-2B base).
- Downloads last month
- 31
4-bit