Inkling 2 Mini on a 16 GB MacBook with Memory-Sparse MoE (MS-MoE): about 2x more memory-efficient

#42
by Sadanie - opened

Hi Thinking Machines team, and thank you for releasing Inkling 2 Mini.

While running it, I noticed that all the experts have to be in memory, even though only a small subset is used at any time. So I tried Memory-Sparse MoE (MS-MoE): a small prediction model picks the experts a question needs, and only those are loaded.

It's about 2x more memory-efficient (17.3 GB → 9 GB), which made it possible to run the model on my 16 GB MacBook at about 10 tokens per second.

The model does need a little fine-tuning to reach similar performance this way, but not much: a few hours for the router and a small attention LoRA, with the expert weights unchanged.

Test Full model MS-MoE (ours) REAP pruning
MBPP 91.4% 89.1% 35.0%
GSM8K 95.4% 94.8% 89.0%
MMLU 78.0% 76.0% 53.9%

I was wondering if you think it would make sense to train models like this from the start? I'd love to hear what you think, and thanks again for making the model open.

Sadanie changed discussion title from Inkling 2 Mini on a 16 GB M1 MacBook: 9 GB, ~10 tok/s, with half of the experts in memory (Memory-Sparse MoE) to Inkling 2 Mini on a 16 GB MacBook with Memory-Sparse MoE (MS-MoE): about 2x more memory-efficient

There are solutions that can stream experts from an SSD drive, predicting which experts would be needed ahead of time. E.g. see the openbmb/MiniCPM-V-4.7-35B-A3B model or the https://github.com/ggml-org/llama.cpp/discussions/27149 discussion.

Thanks for the pointers! The main difference: those approaches keep the model's normal routing and fetch whatever the router picks from the SSD during generation. MS-MoE fine-tunes the model to work with a fixed subset of experts, chosen once per query, so nothing is read from disk while it answers. On a 16 GB M1 that runs at about 10 tokens per second, while the streaming prototype in that llama.cpp thread reports 2 to 4.5 tokens per second on the same machine. The two can be combined, using streaming only for the rare expert outside the subset.

Sign up or log in to comment