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
Safetensors
Model size
0.3B params
Tensor type
BF16
·
U32
·
F32
·
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Ilides/Spartan-1.2-2B-MLX-8bit

Finetuned
Qwen/Qwen3.5-2B
Quantized
(151)
this model
Quantizations
2 models