180B Parameters, 32GB of RAM: Pushing MoE Inference to the Limit with Transformers

AI-generated summary of reporting by Huggingface Blog. Read the original for the full story.

Why it matters

A Hugging Face PR lets huge mixture-of-experts models stream experts from disk, so a 180B-parameter model can run on a 32GB Mac within 6% of the fastest engine.

Read this as

A Hugging Face engineer figured out how to run a very large AI model (Qwen3.8-Flash-Next, 180 billion parameters) on an ordinary laptop with only 32GB of memory. Large 'mixture-of-experts' models are mostly made of pieces called experts, and only a few are needed per word generated. Instead of keeping everything in memory, his code fetches just the needed experts from the laptop's disk as required. It reaches about 14 tokens per second, only 6% slower than the best specialized tool, and the work is being added to the popular Transformers library.

Running large open models locally usually means buying expensive hardware or accepting slow speeds. This engineer's work, submitted as a Transformers pull request (huggingface/transformers#50717), streams a 180B model's experts from a 32GB Mac's disk at ~14 tok/s, within 6% of the Strata inference engine. It needed model-specific 3-bit expert quantization (~5 hours conversion) and Metal kernels, so it is not turnkey yet. Teams wanting local AI on consumer hardware should watch the API discussion, but Strata and MLX remain faster or simpler options today.

The author benchmarked MoE offloading in llama.cpp (mmap, CPU compute, page-cache thrash when experts exceed RAM), vLLM (--cpu-offload-gb, 2x faster when offloading experts only), and Transformers' per-module Accelerate hooks, then built expert streaming: a preallocated slot-pool tensor keyed by a per-layer expert-id-to-slot table so grouped_mm runs unmodified, plus 8 I/O threads, next-layer router prefetch, 3-bit quantized experts (49GB on disk, 12GiB cached), 8-bit dense weights, and Metal kernels for Gated DeltaNet and hyper-connections. Result on M5: ~14 tok/s decode, 228 tok/s prefill, ~6% behind Strata; bottleneck is ~10ms/token host round trips PyTorch MPS cannot hide.

Questions this answers

The article above answers these:

  • How do I run a 180B MoE model on a 32GB Mac?
  • How much slower is Transformers expert streaming than Strata?
  • How do llama.cpp, vLLM and Transformers handle MoE offloading differently?

Read the original

This summary exists to save you time, not to replace the source.

Key terms

Hugging Face Strata Transformers llama.cpp vLLM PyTorch Apple M5

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading