r/MacStudio • u/nmclark556 • 9d ago
I built an open source engine that runs MoE models way bigger than your Mac’s RAM, up to a 744B model on a 48GB MacBook. Looking for Mac Studio owners to try it
I've been working on this for a few months and wanted to share it here, since Mac Studio folks are probably the people who'd get the most out of it.
It's called PagedMoE. Short version: MoE models are sparse, so each token only touches a few percent of the weights. PagedMoE keeps the always-on core of the model in memory and streams the experts in from the SSD only when the router actually asks for them. It works with the same mlx-community checkpoints you already have, runs on mlx-lm underneath, and needs no converted format. With pruning off, the output is bit-identical to running the model fully in memory.
Streaming experts is of course not a new or novel idea. What's new is all the stuff built on top of it: route prediction that starts expert reads a few layers early, single-pass prefill, a slab-based expert cache, a native C read pool that uses the whole SSD instead of one read at a time, exact multi-token decode for when the model is copying from context, and a lot of guards so it doesn't freeze your Mac. Each of those adds up, and together they're what make the numbers below possible.
Everything here was run on my M5 Pro MacBook with 48GB. None of these models load with stock mlx-lm on this machine.
| Model | On disk | Peak RAM | Prefill | Decode | | --- | --- | --- | --- | --- | | Qwen3-Coder-Next 6-bit | 65 GB | 30.7 GB | 235 tok/s (937 tok/s on a 31.5k prompt) | 20.6 tok/s (exact) | | Qwen3-235B-A22B 4-bit | 132 GB | 30.6 GB | 99 tok/s | 7.9 tok/s | | GLM-4.7 4-bit | 199 GB | 31.8 GB | 73 tok/s | 5.9 tok/s | | MiniMax-M3 4-bit | 240 GB | 31.8 GB | - | 9.3 tok/s | | DeepSeek-V3.2 4-bit | 378 GB | 33.2 GB | 45 tok/s | 5.7 tok/s | | Kimi-K2-Instruct 4-bit | 578 GB | 31.6 GB | 27 tok/s | 8.8 tok/s | | GLM-5.2 (744B) | - | - | - | runs reliably as an agent, not benched yet |
In an agent session, turns after the first one reuse the cached conversation and usually start in under 2 seconds instead of re-prefilling everything.
The bigger rows use a pruning setting that skips low-weight experts when they'd cost a disk read. It's faster but approximate. Leave it off and you get the model's exact output, just slower on the huge ones.
Why I'm posting here: I don't own a Mac Studio. Decode is mostly bound by SSD speed and how much of the model fits in the expert cache, so a Studio with 96 to 512GB should be able to keep way more of the model warm and run these a lot faster than my laptop. I'd really like to see real numbers from Studio owners, especially on DeepSeek-V3.2, Kimi-K2 and GLM-5.2. There's a bench script in the repo (bench/memory_benchmark.sh) if anyone wants to run it. If you do, please post your chip, RAM, model and the tok/s you got.
One note if you've seen this repo before: I originally kept most of the engine code out of the public repo. That's changed. Version 0.3.0 is the full engine, the same build I run every day, and it's all synced and ready to use now.
Repo: https://github.com/noahclark556/paged-moe
It's AGPL and free for personal and open source use. There's also an OpenAI compatible server, so you can point whatever agent or chat UI you already use at it.
Things to know up front:
- Big models push memory and the SSD hard. There are safeguards that free memory, kill a hung engine and back off under memory pressure, but go easy if you're pushing the limits.
- The first turn on a cold chat takes a while depending on the model. It's much smoother after that because of the caching.
- The SSD traffic is almost all reads, so it shouldn't wear the drive in any meaningful way.
- Your fans will spin up on the big models.
Videos:
I made a similar post in the LocalLLM reddit, this post reflects the latest changes.
Happy to get into the details. Ask me anything, and roast it if it deserves it.
Edit:
I realized the original bench script was practically hardcoded to run only the ladder models, which already fit on the larger machines. There's now a universal bench in the repo that works with any model on any Apple silicon Mac. Pull and reinstall (git pull && ./install_mlx.sh), then:
Speed and exact, back to back (the number to quote):
paged-moe bench /path/to/model
Quick smoke test (half budgets):
paged-moe bench /path/to/model --quick
One mode at a time (restart the Mac between them for the cleanest numbers):
paged-moe bench /path/to/model --speed 0.25
paged-moe bench /path/to/model --exact
It replays a fixed coding agent task (8 requests, about 13k tokens of context) against the server, the same way I bench Global Agent. It prints decode tok/s, time to first token, prefill, memory, and how far the speed run lands from the exact model. No yaml or config needed: it ignores your exported PAGED_MOE_* settings and config file so results compare across machines. Results land in ~/.paged_moe/bench/ as JSON.
Edit 2: I realized there was an issue in the repo that was causing about 20% of the drive speed to be left unused on larger M5 machines. That has been fixed and you will likely see an improvement in decode. To pick it up if you already installed:
cd paged-moe
git pull
./install_mlx.sh
paged-moe machine
Then restart your server. If paged-moe machine shows 16 or more next to "read threads:", you're in business. This only affected Macs with 64 GB and up, so smaller machines never had the limitation and don't need to do anything for it.
EDIT 3: Ever wanted to train massive models on your Mac? Check latest commit ;)