Efficient CPU-GPU Collaborative Inference for MoE-based LLMs on Memory-Limited Systems

En-Ming Huang, Liwei Lin, Chun‐Yi Lee

TL;DR

This paper introduces a novel CPU-GPU collaborative inference framework for Mixture-of-Experts (MoE) Large Language Models (LLMs) on memory-constrained consumer hardware. By intelligently caching frequently used "expert" model weights on the GPU and offloading computations for uncached experts to the CPU, the framework significantly accelerates inference speed and improves hardware utilization without sacrificing accuracy.

What Problem Does This Paper Address?

Large Language Models (LLMs) are computationally intensive, making them challenging to deploy on consumer-grade hardware. Mixture-of-Experts (MoE) architectures offer a solution by activating only a subset of model parameters, reducing computational load. However, even MoE models can exceed the memory capacity of typical GPUs. Existing methods for offloading model weights to CPU memory or SSDs to free up GPU memory often introduce significant latency due to data transfer bottlenecks, hindering real-time inference. This paper tackles the problem of achieving efficient MoE LLM inference on memory-limited consumer systems by optimizing the interplay between CPU and GPU resources.

Methods

The core of the proposed solution is a CPU-GPU collaborative inference framework that leverages an expert caching mechanism on the GPU. Here's how it works:

  • GPU Expert Caching: A portion of the GPU's memory is dedicated to caching frequently used MoE expert weights. This cache uses a Least Recently Used (LRU) eviction policy, informed by the observation that experts tend to be reused across consecutive tokens.
  • Cache Hit Scenario: If a required expert is found in the GPU cache, computation proceeds directly on the GPU, minimizing latency.
  • Cache Miss Scenario: When an expert is not found in the cache (a "cache miss"), the framework offloads the intermediate computation (e.g., the output from the attention layer) to the CPU. The CPU, with its multithreading capabilities (leveraging OpenMP), handles these computations efficiently.
  • Asynchronous Data Transfer: While the CPU computes for a cache miss, the missing expert weights are asynchronously transferred from the CPU to the GPU in the background. This "post-fetching" updates the GPU cache for future use, overlapping data transfer with computation.
  • CPU-GPU Dual-Copy Engine: The framework utilizes NVIDIA's dual-copy engine capability with two independent CUDA streams to enable concurrent data transfers, further reducing serialization and bottlenecks.
  • No Model Modification: A key advantage is that the framework requires no modifications to the LLM architecture, quantization, or extensive offline profiling, making it broadly applicable.

Datasets

The paper evaluates its framework on the following MoE LLM models:

  • Mixtral 8x7B [6]
  • Phi-3.5-MoE [7]

The evaluation uses the MMLU dataset for analyzing expert selection patterns.

Key Insights and Ideas

  • CPU is Not Just for Storage: The research highlights that CPUs, often relegated to storing weights in offloading strategies, possess significant parallel computation capabilities that can be actively utilized for MoE expert computations, especially during cache misses.
  • Consecutive Tokens Pattern is Key: The observation that specific experts are frequently reused across consecutive tokens (not just consecutive layers) is crucial. This "Consecutive Tokens Pattern" justifies the use of an LRU cache and enables effective expert caching on the GPU.
  • Asynchronous Transfer is Crucial for Overlap: Simply prefetching or on-demand fetching isn't enough. The asynchronous nature of data transfer, happening in the background while the CPU computes, is vital for achieving true computation-communication overlap and minimizing latency.
  • Cache Configuration Matters: The optimal cache configuration (number of indexes vs. number of ways) depends on the number of CPU cores. With fewer cores, maximizing expert reuse (more indexes, fewer ways) is beneficial. With more cores, reducing cache misses (fewer indexes, more ways) becomes more important to avoid communication bottlenecks.

Key Results

The proposed CPU-GPU collaborative inference framework demonstrates significant performance improvements:

  • Speedup: Achieves up to 4.8 tokens/second for Mixtral 8x7B and 10.4 tokens/second for Phi3.5-MoE in single-request scenarios. This represents a speedup of up to 4.4× compared to prior prefetching-based approaches.
  • Performance Gains: Outperforms on-demand fetching, prefetching strategies (like Pre-gated MoE), and Fiddler by a substantial margin, especially with full CPU core utilization.
  • Efficiency: Achieves approximately 15%–35% and 50%–250% performance improvements over CPU-only setups for Mixtral 8x7B and Phi3.5-MoE, respectively, when using the GPU expert cache.
  • Energy Efficiency: Demonstrates significant energy savings, consuming only 29.9% of the energy required by prefetching methods for Mixtral 8x7B and 27.8% for Phi3.5-MoE with 24 CPU cores.
  • No Accuracy Loss: The framework achieves these performance gains without any trade-offs in model accuracy.

Limitations and Future Work

  • Limitations:
    • The framework's performance is influenced by the available GPU memory for the expert cache. Layers beyond the cache coverage rely solely on CPU computation.
  • The effectiveness of the cache configuration is dependent on the number of CPU cores.
  • Future Work:
    • The paper suggests further exploration of cache eviction policies and dynamic cache resizing based on workload characteristics.
  • Investigating more sophisticated CPU-GPU coordination strategies for even greater efficiency.
  • Extending the framework to support multi-request scenarios and distributed inference.

Summary updated

BibTeX
@misc{huang2025efficient,
  author = {En-Ming Huang and Liwei Lin and Chun‐Yi Lee},
  title = {{Efficient CPU-GPU Collaborative Inference for MoE-based LLMs on Memory-Limited Systems}},
  year = {2025},
  eprint = {2512.16473},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.16473},
}
Figure