Fine-tune mixture-of-experts models on a Mac

Mixture-of-experts models are some of the best open models out there, and some of the hardest to fine-tune locally. Each token only uses a few experts, but all of them have to be somewhere. Qwen3-235B is about 132 GB at 4-bit. Qwen3-Coder-480B is 270 GB.

Paged Trainer keeps the shared backbone in memory and pages the experts from the SSD through a budgeted cache, the same way the PagedMoE engine runs them for inference. Steps run layer by layer for the whole batch, so the expert weights are read about twice per step instead of once per row. Only the experts the router picks are computed, and the gradients match a fully loaded run.

Measured on one 48 GB Mac

Apple M5 Pro, 48 GB. SFT, QLoRA r16 on all linear layers, seq 2048, streamed. Epoch is 1,000 rows of 2,048 tokens.
ModelQuantSize on diskTokens/sPeak memoryOne epoch
Qwen3-Coder-Next6-bit64.7 GB12329.9 GB4h 37m
Qwen3-235B-A22B4-bit132.2 GB6331.5 GB9h 06m
Qwen3.8-Flash-Next6-bit148.0 GB6129.3 GB9h 20m
GLM-4.74-bit198.6 GB2431.4 GB23h 59m
Qwen3-Coder-480B4-bit270.1 GB2433.9 GB1d 0h

Download - Paged Trainer

FAQ

Why are MoE models hard to fine-tune on a Mac?

The total weights are huge even though each token only uses a few experts. A 235B MoE is about 132 GB at 4-bit, far past what most Macs have in memory.

How does Paged Trainer handle that?

It keeps the shared backbone in memory and pages the experts from the SSD through a budgeted cache. Steps run layer by layer for the whole batch, and only the experts the router picks are computed.

Does streaming change the result?

No. Prefetch and caching only change timing. The router picks the experts and the gradients are the same as a fully loaded run.

Related

© QWERTY Code LLC. Paged Trainer is a product of QWERTY Code LLC.