TLDR: ExpertFlow is a new system for Mixture-of-Experts (MoE) large language models that dramatically reduces inference latency and memory bottlenecks. It achieves this by dynamically predicting which specialized “experts” are needed, prefetching them into GPU memory, and intelligently managing memory and task scheduling. This adaptive approach, which considers hardware capabilities and workload characteristics, significantly cuts down waiting times and cache misses, making MoE models much faster and more efficient.
Large language models (LLMs) are becoming increasingly powerful, but their growth is often held back by the limited memory available on modern GPUs. To tackle this, a special type of architecture called Mixture-of-Experts (MoE) has emerged. MoE models are designed to activate only a small portion of their vast parameters during operation, which significantly reduces both memory needs and computational effort. However, traditional MoE systems have a drawback: they often suffer from high latency, which is essentially a delay, because they frequently need to transfer data between the main computer memory (host) and the GPU memory. This happens because they select which “experts” (specialized subnetworks) to activate independently at each layer of the model.
Furthermore, existing methods for predicting which experts will be needed in future layers often use a fixed number of steps. This approach isn’t flexible enough to adapt to different hardware setups or varying workloads, making it less robust and effective in real-world scenarios.
Introducing ExpertFlow: A Smarter Approach to MoE Inference
To overcome these challenges, researchers have developed ExpertFlow, a new runtime system designed specifically for MoE inference. ExpertFlow combines two key innovations: adaptive expert prefetching and cache-aware routing. Imagine a system that can intelligently anticipate which experts will be needed next and load them into the GPU’s fast memory before they are actually required. That’s what ExpertFlow aims to do.
ExpertFlow continuously adjusts how far in advance it predicts expert activations. It does this by looking at real-time information like how fast data can be transferred (bandwidth), the size of the model parameters, and feedback from the model itself. It also uses a clever hybrid prediction method that combines initial “pre-gating” information with ongoing computational states to accurately guess future expert needs. By constantly refining its prefetching decisions and matching them with actual usage, ExpertFlow significantly reduces “cache misses” (when needed data isn’t in fast memory) and eliminates the delays caused by waiting for experts to load.
How ExpertFlow Works Under the Hood
At its core, ExpertFlow dynamically determines an optimal “step size” (S), which dictates how many layers ahead it should predict expert activations. Unlike static systems, ExpertFlow’s S is not fixed. It’s calculated based on factors like the number of experts to activate, their size, the available communication bandwidth, and the time it takes to compute each layer. This step size is then refined in real-time based on how accurate its predictions are and whether there are delays or unnecessary prefetching.
For more accurate predictions, ExpertFlow uses a pre-trained model that learns from past expert activations. This model takes into account the current layer’s initial expert predictions, the specific input tokens being processed, and the history of expert activations from previous layers. This rich context helps it make much more reliable predictions, reducing the chances of loading the wrong experts.
Memory management is also crucial. ExpertFlow employs a sophisticated two-level caching system. Instead of a single list of experts to evict, it maintains two distinct lists: one for “high-reuse” experts (those frequently accessed or predicted for imminent use) and another for “low-reuse” experts. When memory needs to be freed, experts from the low-reuse list are prioritized for removal, ensuring that the most critical experts remain in the GPU’s fast memory. This dynamic system adapts as the model runs, keeping memory utilization near optimal.
Finally, ExpertFlow features “cache-aware routing.” This means it can intelligently schedule tasks to hide latency. If an expert isn’t immediately available (a cache miss), ExpertFlow starts loading it in the background while other computations that don’t require that expert continue. It also prioritizes tokens whose required experts are already in memory, deferring those that would cause further delays. This proactive approach ensures smoother execution and higher throughput.
Also Read:
- Optimizing LLM Memory for Extended Text Processing
- Sparsity and Specialization: Making Sense of Mixture of Experts Models
Impressive Performance Gains
The evaluation of ExpertFlow demonstrated significant improvements. It managed to reduce model stall time—the time the model spends waiting—to less than 0.1% of the baseline, showcasing its ability to optimize MoE inference even under strict memory limitations. Across various MoE models like DeepSeek, Qwen1.5, and Qwen2.0, ExpertFlow achieved an average reduction of 98.5% in combined waiting and cache-miss latency, with Qwen1.5 seeing over a 99.9% reduction. The prediction accuracy for expert activation also saw a notable boost, improving by an average of 21.79% compared to traditional pre-gating methods.
These results highlight ExpertFlow’s capability to make MoE models run much more efficiently, adapting to different hardware and workloads, and paving the way for more scalable and responsive large language model deployments.


