This repository holds Strata's inference engine for Apple Silicon, built from audited source and tuned for the M1 Max and M2 Max with 64 GB (Apple GPU families 7 and 8: one target). It serves Qwen3.8-Flash-Next at IQ3_XXS as an OpenAI-compatible API on 127.0.0.1:8000.
Nothing else is in here: no CUDA, no AMD, no Intel, no Windows, no Docker, no Nix, no updaters, no prebuilt binaries. Everything runs offline once the downloads are done.
Measured on an M2 Max 64 GB
| Original MLX 3.3-bit | Stock Strata | This setup | |
|---|---|---|---|
| Writing code / prose / edits (tok/s) | 39.8 / 32.6 / 60.3 | 34.3 / 35.7 / 32.6 | 44.8 / 44.5 / 47.7 |
| Reading the prompt (tok/s) | - | 270-290 | 280-307, flat to 78K tokens |
| Longest chat | ~74K | 131K | 131K (120K tested) |
| Back to an older chat | - | 60-75 s | ~5 s |
| SQL test (5 tries) | 2/5 | 0/3 | 5/5 |
| Next-word match vs the original | 78.8% | 78.6% | 78.6% |
Greedy answers are bit-identical to stock Strata for a fixed drafting setup.
- A Mac with an M1 Max or M2 Max and 64 GB of memory.
- macOS 15 or newer (built and measured on macOS 26) and the Xcode command line tools (Apple clang).
- Homebrew
cmakeandpython@3.14. - Disk for the model: the two shards are 47.0 GB and 28.8 GB, plus the expert pack, the MTP draft layer and up to 20480 MiB of SSD cache.
- Network only for steps 2, 4 and 5 below.
Each step is one script. The full walk-through, with what every command does, is docs/GUIDE.md.
- Prepare the machine:
scripts/gpu-limit.shraises the GPU memory limit (sudo sysctl iogpu.wired_limit_mb=58000). It resets on every reboot. Stop anything else that holds GPU memory first. - Fetch the build dependencies:
scripts/fetch-deps.shdownloads Apple's metal-cpp_26.zip (SHA-256 checked) and fetches llama.cpp at commit 3cf03257f219afbe7334045ff7c6a06ac68c627d (a shallow fetch of that one commit) intothird_party/. Both stay out of git. - Build:
scripts/build.shruns cmake onmetal/and makes thestratabinary inbuild-metal/. The GPU kernels are compiled at run time from this tree's.metalfiles, so keep the tree where it was built. - Python:
scripts/python-env.shmakes.venvfrom Homebrew python 3.14 and installs the server, pack tools' dependencies (including numpy) and their build backends from source archives inrequirements-mac.txt. Each archive is pinned by its SHA-256. Build isolation and automatic dependency installation are disabled. - Download the model:
scripts/download-model.shfetches the two IQ3_XXS shards of ISTA-DASLab's Qwen3.8-Flash-Next-GSQ-RCO-GGUF at the pinned revision into~/strata-models/IQ3_XXS/and checks their SHA-256, then fetches and verifies the MTP draft layer. - Prepare the model:
scripts/prepare-model.shbuilds the expert pack (tools/iq_pack.py) and the MTP pack (tools/mtp_pack.py). The Python setup includes numpy. The pack is tied to the exact GGUF: rebuild it if the model file changes. - Make the run config:
scripts/make-config.pywritesstrata-cached.jsonwith the tuned settings. - Run:
scripts/start.shstarts the server on port 8000. Model id:qwen3.8-flash-next-iq3_xxs. - Verify:
scripts/check.shasks the server whether the model isloaded(the same ascurl -s 127.0.0.1:8000/v1/models), and the engine log showswrapped (47.0 GB),root slot: ... reservedandssd cache: ....
chat.py is a small terminal chat for the running server: .venv/bin/python chat.py.
STRATA_METAL_STREAM=0 keeps the model resident. --spec 8 --mtp-max-t 2: the MTP draft layer guesses 2 words
ahead (3 or more was 13-28% slower) and prompt lookup drafts up to 8 for edits. --max-context 131072 --kv int8:
131K of context. --root-slot-tokens 16384 and --ssd-cache-mib 20480: the system prompt is read once and
kept, also across restarts, and a side request or a chat switch no longer re-reads the whole chat. Thinking at
reasoning_effort medium with an 8000-token budget: the default overthinks and often never answers. Why each
setting, and what was measured: docs/TUNING.md.
- No prebuilt executables. Upstream's installer downloads a ready-made engine and a ready-made Python; its updaters pull new code. None of that is here: the installer, the updaters and the PC build files are removed, and the engine is compiled from source that was read first.
- Python packages only as source archives, pinned by SHA-256 in
requirements-mac.txtand verified before any build runs. No automatic build-dependency downloads. - The server listens on 127.0.0.1 only, never fetches a URL and starts no MCP servers. See SECURITY.md.
- One engine on the GPU at a time: the model is 47 GB resident.
8-bit dense weights (5% slower, same quality); wide GEMV decoders (no gain); prompt QSA flash and experts v3
(no gain); PROMPT_CHUNK 4096 (slower); PROMPT_WIDE, MOE_STAGE 1/2, MOE_GU/DN tiles (no gain or changed
answers); --spec 3+ (slower). Prompt reading is bound by the expert matmuls, so the only lever left is new
prompt MoE kernels for these chips.
Based on Strata by Niko1221 (MIT), upstream commit 296b59d (v0.1.44.1): https://github.com/Niko1221/Strata. The changes on top of it are by PiMatyja and are listed in CHANGES.md. Three of them were offered upstream and closed there; their ideas live on here: #2475 (gguf hardening), #2609 (faster decode GEMVs on M1 / M2) and #2631 (conversation cache across a side request). License: MIT, see LICENSE and NOTICE.md.