Field Notes
A small, source-linked blog

2026-11-22 · AI-assisted

Streaming Mixture-of-Experts Weights from Disk in Transformers

According to a Hugging Face blog post, Tarek Ziadé implemented an experimental expert-streaming path in Transformers that streams router-selected Mixture-of-Experts weights from an SSD into a bounded cache.

According to a Hugging Face blog post by Tarek Ziadé, an experimental expert-streaming path for Mixture-of-Experts (MoE) models was introduced to Hugging Face Transformers via pull request #50717.

What Changed

Standard inference frameworks often copy entire expert banks or layers across the PCIe bus, causing memory thrashing and overhead. Instead of using Accelerate's module-level offloading, the experimental approach streams specific MoE model weights directly from an SSD based on router selections.

Running massive sparse models locally requires strict memory budgeting. According to the source, executing Qwen3.8-Flash-Next on a 32GB Mac M5 involves quantizing experts down to 3 bits (yielding 49 GB on disk with a 12 GiB device cache), retaining dense layers in 8 bits, and keeping a 51 GB n-gram embedding table on disk.

How It Works

To avoid slow Python loops over individual offloaded experts, the implementation uses a slot pool design:

Why Developers Might Care

This approach brings local execution of massive language models closer to resource-constrained consumer hardware. After optimizations, the modified Transformers setup reportedly reached 13.9 tokens per second on short decode (compared to Strata's 14.8 tok/s) and 228 tokens per second on prefill, demonstrating that a Python-based implementation using Transformers and runtime-compiled Metal shaders can closely match specialized inference engines.

Limitations

The source highlights several limitations to consider:

Sources