Local Model Onboarding (the rig)
End-to-end workflow for taking a **candidate model → qualified member of the
on-device eval rotation**. This ties together the pieces that already exist
(model-manager for models.yml/API access, local-ollama-eval for running on
the rig) and adds the two things that were tribal knowledge: the **hardware
size/shape gate and the opencode+pi cross-harness registration**.
The rig: **Mac Studio M4 Max · 128 GB unified · 40-core GPU · ~546 GB/s memory
bandwidth.** One box, shared by every eval job via a mkdir mutex (rig lock).
Current State
- ollama: !'curl -s --max-time 3 http://localhost:11434/api/version >/dev/null 2>&1 && echo "✓ running" || echo "✗ not running — start it first"'
- Unified memory: !'echo "$(($(sysctl -n hw.memsize)/1024/1024/1024)) GB ($(sysctl -n machdep.cpu.brand_string 2>/dev/null || echo Apple Silicon))"'
- Models on disk: !'curl -s http://localhost:11434/api/tags 2>/dev/null | python3 -c "import sys,json;[print(\" \",m[\"name\"],\"%.1fGB\"%(m[\"size\"]/1e9)) for m in json.load(sys.stdin).get(\"models\",[])]" 2>/dev/null || echo " (ollama down)"'
- Currently resident (VRAM): !'curl -s http://localhost:11434/api/ps 2>/dev/null | python3 -c "import sys,json;d=json.load(sys.stdin);[print(\" \",m[\"name\"],\"%.1fGB\"%(m.get(\"size_vram\",0)/1e9)) for m in d.get(\"models\",[])] or print(\" (none loaded)\")" 2>/dev/null || echo " (ollama down)"'
- Rotation models: !'grep -E "OS_FILLER_MODELS|MODELS=" tools/launchd/os-rotation-filler.sh 2>/dev/null | head -1'
- Rig lock: !'ls "$HOME/.ailang/state/rig.lock.d" >/dev/null 2>&1 && echo "HELD — a job is running; do heavy pulls/probes around it" || echo "free"'
Use the state above. If ollama is down, start it before anything. If the rig
lock is held, a scheduled job is running —
ollama pullis fine (network/disk)
but defer GPU probes, or acquire the lock (see
tools/launchd/rig-lock.sh).
The hardware envelope (read this first)
Token generation on Apple Silicon is **memory-bandwidth-bound, not
compute-bound**. Two consequences drive every decision in this skill:
--parallel 1is the established default. All three rig jobs
(nightly-eval.sh, nightly-lang-eval.sh, os-rotation-filler.sh) hard-code
it. The documented rationale (tools/launchd/rig-lock.sh) is operational: the
box is a single GPU / bandwidth-bound, concurrent streams thrash the ~546 GB/s
bus, and an Ollama model reload mid-run silently kills a stream — all of which
bite hard in a multi-model rotation. **Evidence caveat (verify before
changing): there is no recorded p=1-vs-p=2 head-to-head**. The only
measured parallelism data is a p=2-vs-p=4 run on a single small model
(gemma4:26b) that favored p=2 over p=4 — a different question. So treat p=1 as
the safe operational default, not a benchmarked optimum. If you want to raise
it, run the head-to-head first (smoke set, p=1 vs p=2, compare wall-clock,
pass rate, and TTFT-timeout count) — don't just trust the old p=2 note in
local-ollama.md.
- Prefer MoE with a small active parameter count. Total params live
cheaply in unified memory (quality); only the active params compute per token
(speed). qwen3.5:35b-a3b = 35B total / 3B active is the canonical shape.
A dense model of the same size generates tokens far slower — avoid dense
above ~14B for the rotation.
Memory budget (single-stream, p=1):
| | GB |
|---|---|
| Unified total | 128 |
| Usable by Metal (~75% wired default) | ~96 |
| Reserve (OS + ailang server + opencode/pi subprocs + KV headroom) | ~22 |
| Safe ceiling for model resident | ~74 |
| Comfortable (slack at long context) | ≤ ~50 |
Rule of thumb: on-disk ≤ ~45 GB, total ≤ ~80B, active ≤ ~8B. Run
scripts/check_model_fit.sh to get a verdict (estimate pre-pull, or measure a
pulled model's real resident VRAM).
Workflow
1. Select a candidate (shape gate + generation check)
Do not pick from memory — fetch live. The assistant's training is months