open-source

MoE Expert Streaming Runs 180B-Parameter AI Models on Consumer Hardware

Summarized by AI from reporting by Hugging Face Blog, published under our editorial policy.

A new technique called MoE expert streaming enables running massive 180B-parameter Mixture of Experts models on consumer hardware with 32GB of RAM by dynamically loading only the needed experts from SSD, achieving within 6% of the specialized Strata inference engine's performance.

A MacBook M5 running an AI model, illustrating MoE streaming technology.

Key takeaways

  • MoE expert streaming enables running 180B-parameter models on consumer hardware with 32GB of RAM by dynamically loading only the needed experts from SSD.
  • The slot pool technique achieves 34.6 tok/s on OLMoE-1B-7B, within 6% of vanilla Transformers' 38.1 tok/s.
  • If experts fit in RAM, llama.cpp is the best option; if not, streaming only what the router picks through a bounded cache is optimal.
  • Offloading only the experts doubles vLLM's speed, and FP8 quantization further improves performance by halving bytes per expert.
  • The code is available in a Hugging Face Space (tarekziade/moe-expert-streaming) and a Transformers PR (huggingface/transformers#50717).

A developer has demonstrated a method to run massive AI models with 180 billion parameters on consumer hardware using Mixture of Experts (MoE) streaming. This approach allows efficient inference on devices with limited memory, like a MacBook with 32GB of unified memory, by dynamically loading only the necessary expert weights from the SSD. The work, detailed in a Hugging Face blog post, could make powerful AI models accessible to a wider range of users without requiring expensive, high-end hardware.

How MoE Expert Streaming Works

MoE streaming is a technique that enables the execution of large AI models by loading only the parts of the model (experts) that are activated by the router for each token. In Mixture of Experts architectures, different experts handle different types of input, and typically only a small subset of experts are used per token. The key innovation is turning the cache into a slot pool: one preallocated device tensor shared by all layers, plus a per-layer table mapping expert IDs to slots. This allows the router's expert IDs to be remapped to slots so the pool looks like a regular expert bank, enabling grouped_mm (a batched matrix multiplication kernel) to run on it as-is without a custom expert matmul.

The project was built with AI assistance, including the Transformers PR, the model-specific package, and the Metal kernels. The developer's role was choosing what to try, reading the profiles, and deciding what to keep. All code is available in a Hugging Face Space: tarekziade/moe-expert-streaming.

Performance Benchmarks and Comparisons

The developer tested the approach on a MacBook M5 with 32GB of unified memory, running the Qwen3.8-Flash-Next model. While Strata, a specialized inference engine for MoE models, achieved 13.5 tokens per second on a similar setup, the developer's Transformers-based approach was too slow for their coding agent workflow. However, the method got within 6% of Strata's performance on token generation.

The developer compared different offloading methods including llama.cpp, vLLM, and Transformers. Key findings include: - If experts fit in RAM, llama.cpp is hard to beat. - If they don't fit, streaming only what the router picks through a bounded cache is the best approach. - Offloading only the experts doubles vLLM's speed, and FP8 helps further by halving the bytes per expert. - Transformers' default Accelerate offloading copies every expert of every offloaded layer, even though only 8-10 are used per token.

Initial experiments with OLMoE-1B-7B showed the slot pool approach achieved 34.6 tok/s versus 38.1 tok/s for vanilla Transformers, demonstrating the technique's efficiency.

Why It Matters for Everyday Users

This development is significant for users who want to run large AI models locally without relying on cloud-based solutions. By using MoE streaming, users can benefit from powerful AI models on personal devices with faster response times and enhanced privacy. The method reduces dependency on cloud services, which can be expensive and raise privacy concerns. For sensitive applications like healthcare and finance, running models locally gives users more control over their data.

The developer's motivation was practical: they wanted to run bigger models locally on a PC with two RTX 4090s and a MacBook M5 with 32GB of unified memory, moving between different rooms while working. The fixed desktop tower setup wasn't suitable for their workflow.

How to Try It Today

To try MoE streaming, users can: 1. Install the Transformers library from the provided PR (huggingface/transformers#50717). 2. Use the model-specific package and Metal kernels from the project's repository. 3. Run the Qwen3.8-Flash-Next model on a MacBook with 32GB of RAM.

The developer notes that Strata was already too slow for their laptop use case, and Transformers wasn't going to beat it anytime soon. However, the Accelerate path was so far off that they wanted to try fixing offloading in Transformers itself, with the big model on their laptop as the target, knowing it would probably stay too slow for how they work.

Frequently asked

What hardware do I need to run MoE expert streaming?
The developer demonstrated it on a MacBook M5 with 32GB of unified memory, but the technique works on any system where the model doesn't fit entirely in GPU memory, including PCs with RTX 4090s.
How fast is MoE expert streaming compared to running the model entirely in memory?
On OLMoE-1B-7B, the slot pool approach achieved 34.6 tok/s versus 38.1 tok/s for vanilla Transformers with the model fully in memory, a difference of about 9%.
Can I use MoE expert streaming with any AI model?
The technique is designed for Mixture of Experts (MoE) models. The developer tested it with Qwen3.8-Flash-Next and OLMoE-1B-7B, and it can be adapted for other MoE-based models.
Is MoE expert streaming faster than Strata?
No, Strata is faster. The developer notes Strata was already too slow for their use case, and the Transformers-based approach is not going to beat it. However, MoE streaming gets within 6% of Strata's token generation performance.