TLDR: This paper analyzes Mixture of Experts (MoE) offloading, identifying limitations in LRU caching due to expert imbalance. It proposes LFU caching, which significantly improves inference speed by prioritizing frequently used experts. Additionally, it implements and demonstrates the high potential of speculative expert pre-fetching for further performance gains, offering insights into MoE architecture and future optimization strategies.
Mixture of Experts (MoE) models have become a cornerstone in advanced AI, powering some of the most sophisticated language models today. However, their unique architecture, which involves a multitude of specialized “experts,” demands significantly more memory than traditional models. This memory requirement poses a major hurdle for deploying these powerful AI systems, especially in environments with limited resources like edge devices.
To tackle this challenge, a technique called MoE offloading has emerged. This method involves storing the vast majority of the model’s parameters in main memory and only loading the necessary “experts” onto the GPU as they are needed during inference. While offloading helps manage memory, the frequent transfer of expert parameters between main memory and the GPU can introduce substantial latency, slowing down the AI’s response time. The core problem then becomes how to minimize this waiting time for expert loading.
This is where caching comes into play. By temporarily storing frequently used experts on the GPU, the system can avoid repeatedly fetching them from slower main memory. Previous work explored this with a caching strategy called Least Recently Used (LRU), which evicts the experts that haven’t been accessed in the longest time. However, this approach often led to many “cache misses” (needed experts not being in the cache) and “miscached” experts (cached experts not being used).
A recent research paper, available for an in-depth read here, delves into these issues, offering a detailed analysis of expert activation and LRU caching behavior. The authors, Shuning Lin, Yifan He, and Yitong Chen, found that expert activation is often imbalanced, meaning some experts are used far more frequently than others. This observation inspired their proposal for an optimized caching algorithm: Least Frequently Used (LFU).
LFU Caching: A Smarter Approach
Unlike LRU, which prioritizes recency, LFU caching evicts the experts that have been accessed the least number of times. By focusing on frequency, LFU aims to keep the most popular experts readily available in the cache. Experiments conducted on various hardware, including NVIDIA A100 and A6000 GPUs, demonstrated that LFU significantly outperforms LRU in terms of token generation speed. For instance, on an A6000 GPU, LFU was shown to be 84.6% faster than LRU, indicating its effectiveness in leveraging the uneven distribution of expert usage.
Speculative Expert Pre-fetching: Anticipating Needs
Beyond caching, the paper also explores the immense potential of speculative expert pre-fetching. This technique involves predicting which experts will be needed by the next layer of the model and pre-loading them into the cache. The idea is that since transformer layers build upon previous hidden states, an accurate guess of the next layer’s experts can be made by applying the next layer’s gating function to the current layer’s hidden states. While the original work only proposed this concept, the authors of this paper implemented and experimented with it, achieving a remarkable 84.6% precision and recall in their predictions. This high accuracy suggests a huge potential for speeding up inference by proactively loading experts, although deploying it fully involves complex challenges like managing increased data transfer and overlapping operations.
Also Read:
- LLMServingSim2.0: A Unified Platform for Simulating LLM Infrastructure with Diverse Hardware and Serving Strategies
- PuzzleMoE: Compressing Large AI Models for Better Performance and Efficiency
Key Insights and Future Directions
The research provides several key takeaways. While temporal locality (tokens next to each other selecting the same experts) exists, expert imbalance is a much stronger factor. This suggests that future caching strategies could combine popularity and recency for even better performance. The high accuracy of speculative pre-loading also raises questions about MoE architecture itself, hinting that some layers might be less critical than others, potentially inspiring new pruning methods. The authors emphasize the importance of considering “overlapping” data transfer with computation for any pre-fetching technique to truly yield positive effects.
This in-depth analysis not only offers practical improvements for MoE offloading through LFU caching and speculative pre-fetching but also provides valuable insights into the fundamental behavior of MoE architectures, paving the way for future innovations in model interpretation, optimization, and deployment in resource-constrained environments.


