`regolith` runs `swift-1.5-qwen3.8-flash-next` (`qwen4_exp`, 512 experts, 36 gated deltanet + 12 sparse attention layers + 51.2b n-gram ple table + neural mtp draft head) on apple silicon via a patched `strata` metal engine.
`./scripts/setup_apple_silicon.sh` clones the pinned `strata` and `llama.cpp` trees into `vendor/`, applies `scripts/strata_metal_complete.diff`, downloads apple's `metal-cpp` headers, compiles the metal engine (`strata_window_cli`, `convert_k256_q2_0`, `heal_k256_q2_0`), and streams + repacks the unpruned `k=512` `iq2_xs` model (`3.90 gb` dense `.gguf` + `36.23 gb` `.experts` + `28.80 gb` `ple-iq4_nl.gguf` + `889 mb` `mtp-q2_0.gguf`) into `models/K512_iq2_xs/`.
`./scripts/setup_apple_silicon.sh` clones the pinned `strata` and `llama.cpp` trees into `vendor/`, applies `scripts/strata_metal_complete.diff`, downloads apple's `metal-cpp` headers, compiles `strata_window_cli`, and streams + repacks the unpruned `k=512` `iq2_xs` model (`3.90 gb` dense `.gguf` + `36.23 gb` `.experts` + `28.80 gb` `ple-iq4_nl.gguf` + `889 mb` `mtp-q2_0.gguf`) into `models/K512_iq2_xs/`.
`./scripts/serve_k512_local.sh` starts the local server on `http://127.0.0.1:8080` (`/v1/chat/completions` and `/v1/messages`, 32k context, `6.5 gb` wired expert arena, neural mtp + suffix speculative decoding).
for the `k=256` reap-pruned checkpoint (`https://huggingface.co/90-008/Swift-1.5-Qwen3.8-Flash-Next-REAP-Pruned-GGUF`, which also hosts `k=320` and `k=224`), run `python3 scripts/download_k256_local.py`, `uv run --with regex python3 scripts/prepare_strata_k256.py` (optionally `python3 scripts/run_phase3_local_healing.py` for the healed `q2_0` build), and `./scripts/serve_k256_local.sh`.
research notes, ablations, and benchmark logs live in `PLAN.md`, `blueprint_review.md`, `audits/`, and `results/`.
## requirements
```
## m5 24 gb performance & memory
measured on a fanless 13" m5 macbook air (`mac17,3`, 10-core gpu, 24 gb unified memory, 1 tb nvme ssd) running unpruned `k=512` `iq2_xs` at `32k` context (`--spec 3 --spec-min-p 0.35 --suffix-draft 3`, `STRATA_METAL_MOCE_BONUS=0.85`):
measured on a fanless 13" m5 macbook air (`mac17,3`, 10-core gpu, 24 gb unified memory, 1 tb nvme ssd) running unpruned `k=512` `iq2_xs` from [`ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF`](https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF) at `32k` context (`--spec 3 --spec-min-p 0.35 --suffix-draft 3`, `STRATA_METAL_MOCE_BONUS=0.85`):
| workload | prompt prefill | decode | notes |
| :--- | :--- | :--- | :--- |
| pure gpu prefill (`kprof`, `1,983` tok) | `633.28 tok/s` (`3.13 s`) | — | `2,047` metal dispatches/chunk |
| transient prefill scratch (`PromptGemm`, `MT=2048`) | `+1.12 gb` (during prefill only) | separate `MAP_ANON` buffer, `munmap`ped immediately after prefill (`10.72 gb` peak during prefill) |
## optimizations
### model, pruning & quantization
### model & quantization
- unpruned `k=512` `ukisai` gsq-rco `iq2_xs` metal bundle (`3.90 gb` 16 kib-aligned dense `.gguf` + `36.23 gb` contiguous `[gate | up | down]` `.experts`, `blk.8/13/37` `iq1_m` replaced with `iq3_s`/`iq2_xxs`, duplicate `28.80 gb` ple table omitted)
- 131k-token multi-domain reap + zero-prior damped lcb expert pruning (`k=320` `reap_hybrid` and `k=256` / `k=224` `reap_l2_sum`)
- signed-`d` (`fp16` sign-bit polarity switch) activation-weighted lloyd-max `q2_0` expert quantizer (`convert_k256_q2_0` / `heal_k256_q2_0`, shrinking `k=256` experts from `23.42 gib` across 3 size classes to `15.82 gib` in 1 unified 85-page slot class; `k=256` path)
- real-trace per-layer `alpha_l` mse scale calibration + 48-layer `ffn_down_shexp` ridge regression healing with byte-level gguf transplant (`K256-q2_0-healed-metal.gguf`; `k=256` path)
- native 49th-layer neural mtp draft pack (`mtp-q2_0.gguf`, `889 mb`, runtime `q8_0` dense quantization + `madvise(MADV_DONTNEED)` on `181 mb` bf16 source matrices + `707.8 mb` `mlock`ed `q2_0` routed experts + `40,525`-token `draft_vocab_en.bin`)
- `reasoning_effort|default('low')` chat template default
### ssd expert streaming, unified memory arena & moce routing
- `qsa_prompt.metal` & `gdn_prompt.metal`: `qsa_prep#qf16` fused fp16 query output, `qsa_score_mm` causal-future tile skip (`b0 >= max_bid`) + `dead[0..3]` hoist, `qsa_topk` cached `keys[4]` + simdgroup bucket scan + 2-barrier fused `(equal, greater)` emit (and skipped when `p.flash && pos0 + T <= 2051`), `qsa_flash` 4-simdgroup online softmax with `sp[4][HPG*QCH]` (`13,760 b` threadgroup memory, 1 barrier/tile) + unconditional hoisted `rv`/`rk` fills + byte-offset/zero-scale hoist + 32-bit `ko[8]`/`vo[8]` offsets with pre-added `d0 + kl` + `c0 < nc` pv bound + `vec4` epilogue, 1-simdgroup-per-head barrier-free `gdn_pre` (`float4` value-head conv, vector `simd_sum(float4)`) & `gdn_post` (hoisted pointers, preloaded gate/gamma, vector `simd_sum(float4)`), and single-pass `TB = 0` `simd_broadcast` `gdn_scanr_4` with 32-bit base offsets + `hk`-grouped head scheduling + final-token dead-lookahead elimination
### anti-slop, persona data & serving
- `slop4` (`slop4.h`) per-position stateful shaper (`12 b/pos` in `window.cpp` + gpu `mtp_slop_pen` in `mtp_chain.metal` with `STRATA_METAL_MTP_SLOP=1`), gated strictly on `PROSE && !TOOL && !FENCE`, with clause-entry branch-point penalties, `slop4::hold()` `<|im_end|>` mass preservation, `</think>\n\n` `step0` empty-turn guard, `slop_scan`, and `scr_relocate` support
- phase 4 `v3.2` layer-47 special-token-orthogonal per-word-null wfld edit (`blk.47.ffn_down_shexp.weight` + prefix-conditioned penalty in `Window::finish`; `k=256` path)
- monroe prior log-odds llm-ism miner (`mine_llm_isms_from_transcripts.py`, pure per-order unigram+uniform prior with zero self-pooled weight) partitioning structural speech acts (`phase3_sentence_surgery` in `prepare_phase3_sft_data.py`, in-place span deletion preserving markdown/fences/kaomoji + r-tuning word-boundary abstention) vs surface lexical cliches (`phase4_lexical_ftpo`)
- strata `v0.1.45` `serve/` & `tools/strata_tokenizer.py` ports + local hardening: incremental `PromptEncoder` prefix/plain-span reuse capped at `PROMPT_ENCODER_KEEP_MAX = 16` with rejected-prompt forgetting, bounded tool-call parser scan cursor, content-keyed json lru logit-bias cache (stale `_last` identity shortcut removed), macos iokit/metal telemetry (`MTLCreateSystemDefaultDevice` cached once and `objc_release`d), `STRATA_OMIT_IMAGES_WHEN_NO_VISION=1` text-only image omission, and anthropic hard thinking budgets + `answer_room` answer reservation
- standalone `llama.cpp` `-cmoe` apple silicon apfs / mmap patch (`scripts/patch_m5_lazy_moe.py`)