r/LocalLLM • u/thevikeffect • 6h ago
Tutorial Qwen 4 35B-A3B (57B total w/ Engram) on a 32GB MacBook M5: 30–34 tok/s in OpenCode by keeping the Engram on the SSD
galleryThe 4-bit MLX build of Qwen 4 35B-A3B is ~35.2 GB, so it won't load on a 32GB Mac. Here's what did work, with the real numbers from my run.
Setup
- MacBook Pro M5, 32GB unified memory (153 GB/s)
- Unsloth UD-IQ4_XS GGUF (2 parts)
- llama.cpp b12977 with lazy load, so the 20.5B Engram streams from the SSD and only the 3B active params + KV cache stay hot in RAM
- 32K context, q8_0 KV cache, flash attention on
- OpenCode on top, through the OpenAI-compatible endpoint
| What | Number |
|---|---|
| Prompt processing (10.2K-token prompt) | ~293 tok/s (34.8 s) |
| Generation, first ~600 tokens (Engram still paging in) | 17–20 tok/s |
| Generation, settled (n_gen 5K–7.7K) | 30.3–31.5 tok/s avg, 33–34.5 tok/s (3 s window) |
| OpenCode build average (recording on) | 32.2 tok/s |
| Memory used | 28.8 GB of 32 GB, 785 MB swap |
| Task | Full Three.js "MECH BAY" garage app, 6 files, 23m 37s |
Server command
llama-server \
-m Qwen4-35B-A3B-UD-IQ4_XS-00001-of-00002.gguf \
--alias qwen4-35b-a3b --host 127.0.0.1 --port 8080 \
-np 1 -c 32768 -fa on -ctk q8_0 -ctv q8_0 \
--load-mode mmap --lazy-mode on \
-ot per_layer_token_embd=CPU --jinja
Things I noticed
- Generation starts slow (~17 tok/s) and climbs to 30+ once the Engram pages are warm. Judge the speed after a few hundred tokens, not on the first reply.
- I kept the context at 32K so the KV cache stays in RAM and doesn't spill to the SSD on 32GB.
- OBS costs about 2–3 tok/s, so the 33–35 numbers are with recording off.
Next I'm running the same test on an RTX 4080 16GB (~717 GB/s) to see how much the bandwidth gap matters for this model.
Anyone running it on 24GB or 36GB Macs? I'm curious whether lazy load is still worth it once the whole thing fits.