Skip to content

The 80B Qwen3-Coder-Next on a 16 GB Mac, about 13 tok/s, fully offline. A mixture-of-experts inference engine for Apple silicon.

Rust
4.2 KB
Raw Blame

Coachwhip 0.4.0

Mac mini M4, 16 GB, measured; your Mac and your prompt will move the numbers. Method and every figure's conditions: docs/MODELS.md.

New model

  • Qwen3.5-122B-A10B (qwen35moe), the biggest model Coachwhip runs on 16 GB, after a squeeze of 5 to 9 minutes on your own Mac: coachwhip-prepare takes the publisher's Q3_K_M file and writes a second file beside it with each expert's gate and up matrices at Q2_K (done on the GPU) and its down matrix at Q3_K; everything else is copied as it is. 45 GB written in 5 to 9 minutes on an M4; about 105 GB free is needed while the download and the squeezed file both exist. The squeeze is deterministic: the same download gave the same bytes on two runs on the Mac we tested. Nothing is downloaded from us.
  • Two modes. Exact mode uses the model's own 8 experts per word. Fast mode, --experts 4 --parallel, asks the router for its top 4 and lets the GPU run ahead of the CPU: about twice the speed, and the answers can differ from the full model's. Fast mode is a choice, never the default; the README says so where the command is.
  • Numbers on the squeezed file at bank 40, in docs/MODELS.md: the tester's run.

Faster

  • The parallel path, --parallel. The GPU waits on a shared event for a layer's experts instead of the CPU re-queuing each layer; the CPU never waits for the GPU inside a word. Off by default; answers identical with it on or off on the 80B and the 35B.
  • --experts N asks the router for N experts per word instead of the model's own number. Fewer experts means fewer bytes per word and faster writing; the answers change, so the quality check is beside the speed on the models page.

Fits in memory

  • Wrangler. Coachwhip now watches its own memory so a 16 GB Mac is not pushed over. At start it reads the GPU limit macOS gives it and the model's own sizes, and lowers the bank if a long chat would not fit, saying so. The 122B is tested to a 12,000-token prompt. After every answer it warns if macOS memory pressure is high.
  • The bank is allocated at its exact size. Buffers were rounded up to a power of two, which wasted over 1 GB on the 122B; the room now goes to more expert slots.
  • The word table stays packed. It used to be unpacked in full at load (a 12 GB peak on the 122B); now each word unpacks only its own row. About 1 GB less memory, no change to the answers.

Fixed

  • Fast mode could compute a word with the wrong expert, rarely and silently: a stale pick could pass the CPU's check. Each pick now carries its word's stamp.
  • The expert banks are no longer built while a prompt is being read. On a long first prompt that could push the GPU out of memory.

Structure

  • New crate crates/prepare: the squeeze, streaming, so the whole model never sits in memory.
  • crates/engine/src/requant.rs: Metal kernels that squeeze a Q3_K, Q4_K or Q5_K expert to Q2_K on the GPU, one thread per 256-weight block; the prepare step uses them.
  • Vendored candle-metal-kernels with the Q2_K matvec fix (the upstream kernel read 4 rows per group where the shader covered 8) and the shared-event wait the parallel path needs.
  • Lab switches behind COACHWHIP_* environment variables are off and inert; they are not part of the product.

Not tested

  • 0.4.0 is measured on the 122B and the 80B. The 35B is unchanged in code but was not re-measured on this build.
  • The 122B beyond a 12,000-token prompt.
  • Exact mode at 6,000 tokens; exact mode is measured at 12K (2.2 tok/s).
  • The 122B's sampled answers beyond 300 words.
  • prepare on a Mac without a Metal GPU falls back to the CPU and takes about 12 minutes; not timed on this release.
  • If the disk fills during prepare, the half-written file stays behind (it will not load; delete it by hand). Fix planned for 0.4.1.

Risk

  • Fast mode is a different model in practice: 4 experts where the model expects 8. On six agent coding tasks through Aider (Python, TypeScript, Rust, hidden tests), fast mode passed 5; the sixth, which had a built-in contradiction, it argued with itself until it ran out of room, and exact mode solved it in one go. The README and the chat label it; the quality numbers on the models page are the measure of what it costs.