MoE Model Optimization on Limited Hardware and Performance Comparisons
Experts in MoE models can be streamed from SSD to enable efficient inference on limited hardware, achieving performance within 6% of Strata on token generation.
MoE Model Optimization and Performance on Limited Hardware
MoE model optimization on limited hardware presents unique challenges, particularly when dealing with large-scale models like the 180B parameter model discussed in this article. According to the evidence, experts—comprising 90%+ of a MoE model's weights—can be streamed directly from SSD, enabling efficient inference on hardware with constrained memory. This approach achieved performance within 6% of Strata on token generation, as noted by the author, Tarek Ziadé. Further experiments on the Qwen3.6-35B-A3B model using an A10G GPU (24 GB) demonstrated that offloading only the experts significantly improved vLLM's speed, with FP8 quantization providing additional benefits by reducing memory usage per expert. These findings highlight the importance of hardware-specific optimizations and quantization strategies in making large MoE models viable on limited resources.
Implementation Details and Customization for MoE Inference
Implementation of MoE inference with large models like Qwen3.8-Flash-Next requires careful handling of memory and computational resources. A key customization involves offloading expert weights to disk, as demonstrated in the experts_offload configuration within the from_pretrained method. This approach allows the model to use a dense component on the GPU while keeping the majority of the experts stored on disk, reducing memory overhead. The snapshot_download function retrieves the necessary model files, including quantized experts and the n-gram table, from a specific repository. This method is still under discussion with the Transformers maintainers, indicating that the API may evolve before final adoption.
Performance Comparison Between Transformers and Strata
In a direct performance comparison between Transformers and Strata on an M5 chip, Strata demonstrated significant improvements in token processing speed. During decode operations with 200 tokens, Strata achieved 14.8 tokens per second, a 1.5x improvement over Transformers' 10.0 tok/s. For prefill operations with a 4K prompt, Strata reached 220 tok/s, compared to Transformers' 68 tok/s, representing a 3.2x speedup. Even in more complex scenarios, such as decoding after a 6K document, Strata maintained a 1.9x advantage with 13.7 tok/s versus Transformers' 7.3 tok/s. These results were achieved using Strata 0.1.60 with IQ3_XXS experts, as noted in the testing setup. While Transformers showed slight improvements in prefill speed after optimizations, Strata consistently outperformed in decode tasks, maintaining a 6% gap in short decode scenarios. The tests were conducted with greedy decoding, thinking enabled, and speculative drafts disabled, with 1,024-token prefill chunks.
Memory and Optimization Techniques for Large Models
Memory and optimization techniques play a crucial role in handling large models with extreme parameter counts, such as those exceeding 180 billion parameters. One challenge is managing memory usage during inference, particularly when dealing with models like Qwen3.8-Flash-Next, which cannot be run on 32 GB of RAM due to the need to keep n-gram tables in memory. To address this, switching to Strata's GGUF weights has proven effective, reducing dense weight traffic from 5.4 GB to 3.9 GB per token and decreasing individual expert size from 2.15 MB to 1.75 MB. Additionally, a separate cache pool for each expert size helps manage memory more efficiently. For long documents, attention is limited to the indexer's selected blocks, and a KV cache that grows in place instead of being copied at every token further optimizes memory usage.
Challenges and Limitations in Current MoE Inference
Current MoE inference faces significant challenges, particularly in optimizing performance on large models like those with 180B parameters. One limitation lies in the lack of native operations on PyTorch's MPS stream, which could lead to instability or hangs, as noted by developers who have not yet implemented such fixes. Additionally, while Transformers models have made progress, they have not yet outperformed alternatives like Strata. Closing the remaining performance gap would require deeper changes in the system stack, including better control over per-layer synchronization, which is currently not available in PyTorch. However, promising approaches have emerged, such as streaming only the routed experts, using a bounded cache for grouped_mm operations, and implementing targeted Metal kernels to improve efficiency.
Sources and reporting notes
Based on published source material. No independent hands-on testing is claimed.