A new experimental streaming method for Hugging Face Transformers has enabled the local execution of large Mixture-of-Experts (MoE) models on consumer hardware with limited RAM. By streaming expert weights directly from SSD, the approach achieves token generation speeds within 6% of Strata, a dedicated inference engine, on a 32GB MacBook M5.
What Happened
The project, led by Tarek Ziade, focused on optimizing the inference of Qwen3.8-Flash-Next, a 180-billion parameter MoE model, on a MacBook M5 with 32GB of unified memory. Traditional offloading methods in frameworks like llama.cpp and vLLM often suffer from performance bottlenecks when model weights exceed available RAM. The new implementation, submitted as a pull request to the Transformers repository, introduces a mechanism to stream only the active experts required by the model's router during each token generation step.
The technique utilizes a slot pool—a preallocated device tensor shared across layers—to map expert IDs to memory slots. This allows the model to use standard grouped matrix multiplication kernels without custom C++ extensions. The experts are quantized to 3 bits and stored on disk, with a 12 GiB cache on the device. The dense layers are quantized to 8 bits, and the 51 GB n-gram embedding table is also streamed from disk. After several optimizations, including early GPU work commitment and custom Metal kernels for specific layers, the system achieved a decode speed of 13.9 tokens per second, compared to Strata's 14.8 tokens per second.
Why It Matters
This development demonstrates that high-performance inference of massive MoE models is becoming feasible on standard consumer laptops, reducing the barrier to entry for local AI experimentation. While dedicated engines like Strata previously held a significant lead in efficiency for offloaded models, the integration of similar streaming capabilities into the widely used Transformers library could democratize access to frontier-scale model weights for developers who cannot afford high-end workstations or cloud GPU costs.
However, the author notes that despite the narrowed performance gap, the resulting speed of approximately 14 tokens per second remains "too slow for how I use coding agents." Ziade explicitly states that his dedicated PC, named Orthrus, "keeps doing the real work," highlighting that while the laptop can run the model, it does not yet support the latency requirements of real-time agentic workflows. The work underscores that while software-level optimizations can push the limits of existing hardware constraints, practical utility for complex agent tasks may still require more powerful local compute or higher throughput than currently achievable on 32GB consumer devices.
The Bottom Line
Transformers' new expert streaming method allows a 180B parameter MoE model to run at near-dedicated-engine speeds on a 32GB MacBook. While the author finds the speed insufficient for his own real-time coding agent workflow—relying on a dedicated PC for actual work—the breakthrough proves that standard AI frameworks can effectively leverage SSDs to overcome RAM limitations, offering a viable path for local execution of large, sparse models.