MoE-Lightning: High-Throughput MoE Inference on Memory-constrained GPUs

Shiyi Cao, Shu Liu, Tyler Griggs, Peter Schafhalter, Xiaoxuan Liu, Ying Sheng, Joseph E. Gonzalez, Matei Zaharia, Ion Stoica

TL;DR

MoE-Lightning is a high-throughput inference system designed to run massive Mixture-of-Experts (MoE) models on memory-constrained GPUs (like the NVIDIA T4). By combining a new hierarchical performance model with a clever pipelining schedule that offloads attention to the CPU, it achieves up to 10.3x higher throughput than current state-of-the-art offloading systems.

What Problem Does This Paper Address?

Large Language Models (LLMs) using the Mixture-of-Experts (MoE) architecture—such as Mixtral 8x22B or DBRX—are incredibly powerful but have a massive footprint. While they are computationally efficient (only activating a fraction of their parameters per token), their total parameter count often exceeds 100GB or even 200GB.

For researchers and developers without access to H100 clusters, the only option is offloading: storing weights in system RAM (CPU memory) and swapping them onto the GPU layer-by-layer. However, existing offloading systems (like FlexGen) often suffer from "pipeline bubbles" where the GPU sits idle waiting for weights, or the CPU sits idle waiting for intermediate results. This leads to poor resource utilization and agonizingly slow throughput for batch processing tasks like model evaluation or synthetic data generation.

Methods

The authors introduce two core components to solve the utilization gap:

  1. Hierarchical Roofline Model (HRM): The authors extend the classic "Roofline Model" (which relates peak compute to memory bandwidth) to account for multiple memory tiers (GPU HBM, CPU DRAM) and the interconnects between them. This allows the system to mathematically find the "balance point"—the optimal batch size and device placement—to maximize throughput for any given hardware setup.
  2. CGOPipe (CPU-GPU-I/O Pipelining): This is a novel scheduling strategy. Its most surprising feature is CPU Attention. The authors realized that for large batches, the time spent moving the "KV cache" (memory of previous tokens) to the GPU is often longer than simply performing the attention calculation on the CPU.
  3. Weights Paging: Instead of moving entire layers, MoE-Lightning treats weights as "pages." This allows the system to interleave weight transfers with the transfer of intermediate hidden states, effectively hiding I/O latency and keeping both the CPU and GPU busy.

Datasets

The system was evaluated using three distinct workloads to test different prompt and generation lengths:

  • MTBench: A benchmark of 80 high-quality multi-turn questions, replicated to simulate thousands of concurrent requests.
  • Synthetic Reasoning (from HELM): Used to test performance on tasks with shorter prompts.
  • Summarization (from HELM): Used to test performance on tasks with long prompts (up to 2k tokens), which puts heavy pressure on the KV cache.

Key Insights and Ideas

  • The I/O Bottleneck Shift: In memory-constrained settings, the bottleneck isn't just "compute vs. memory"; it's the interconnect bandwidth. The paper proves that for certain batch sizes, the CPU is actually a more efficient place for attention mechanisms because it eliminates the need to move the KV cache across the PCIe bus.
  • Super-linear Scaling: When using multiple low-cost GPUs (e.g., 4x T4s), MoE-Lightning demonstrates super-linear scaling. Because adding GPUs increases the total available VRAM, the system can use much larger batch sizes, which amortizes the cost of weight loading more effectively.
  • Policy Search vs. Heuristics: Rather than using hard-coded rules, MoE-Lightning uses its HRM to search for the best execution policy. This makes the system portable across different hardware (e.g., switching from a T4 to an L4 GPU).

Key Results

  • Massive Speedups: On a single NVIDIA T4 (16GB), MoE-Lightning achieved 10.3x higher throughput than FlexGen for the Mixtral 8x7B model.
  • Efficiency: When the system is bounded by GPU memory, MoE-Lightning reaches the theoretical throughput upper bound while using 2–3x less CPU memory than existing solutions.
  • Accessibility: The system successfully ran the DBRX (132B parameter) model on just two or four low-cost T4 GPUs, a feat previously difficult to achieve with high efficiency.
  • Variable Length Support: Unlike some baselines that require padding all requests to a maximum length (wasting computation), MoE-Lightning handles variable-length requests efficiently through a custom request batching algorithm.

Limitations and Future Work

  • Single-Node Focus: The current HRM and CGOPipe implementation is optimized for single-node setups (one machine with one or more GPUs). It does not yet account for the complexities of multi-node distributed inference.
  • Disk Offloading: The current work assumes the model can at least fit in system RAM (CPU memory). If the model is larger than system RAM, disk offloading would be required, which the authors have not yet integrated into their pipeline.
  • Hardware Support: While tested on NVIDIA GPUs, the authors note that extending support to other accelerators like TPUs is a promising future direction.

Summary updated

BibTeX
@inproceedings{cao2025moe,
  author = {Shiyi Cao and Shu Liu and Tyler Griggs and Peter Schafhalter and Xiaoxuan Liu and Ying Sheng and Joseph E. Gonzalez and Matei Zaharia and Ion Stoica},
  title = {{MoE-Lightning: High-Throughput MoE Inference on Memory-constrained GPUs}},
  booktitle = {ASPLOS},
  year = {2025},
  doi = {10.1145/3669940.3707267},
}
Figure