Manuscript Offprint

arXiv:2610.23006

Efficient CPU-GPU collaborative MoE inference via Adaptive Expert Assignment

Wenhui Lv, Yunming Liao, Hongli Xu, Yang Xu, Junhao Cheng

Abstract

Mixture-of-Experts (MoE) models reduce inference computation through sparse expert activation, but their large expert memory footprint often exceeds GPU capacity, making expert offloading necessary for memory-constrained inference. However, existing systems typically handle GPU-missed experts by either transferring them to the GPU, incurring substantial PCIe transfer latency, or executing them on the CPU, making the slower CPU computation the bottleneck. To address these limitations, we present Apex, a CPU-GPU collaborative MoE inference system that adaptively assigns these missed experts to the CPU or GPU for efficient execution. By exploiting differences in expert token-loads, Apex selectively transfers high-load experts to the GPU while executing low-load experts on the CPU. To minimize inference latency, Apex adaptively adjusts expert assignments to balance the CPU computation path against the GPU transfer-and-computation path, allowing both execution paths to complete as early as possible. Extensive experiments on three representative MoE LLMs show that Apex improves prefill speed by up to 51.9% and decode throughput by up to 39.5% over the strongest baseline across the evaluated batch sizes, with consistent gains under different GPU-memory budgets.

1 Introduction

Mixture-of-Experts (MoE) [8, 12, 18, 28, 39] architectures have emerged as an effective way to scale the capacity of Large Language Models (LLMs) [3, 27, 38, 40, 46] without proportionally increasing inference computation. Instead of applying the same dense feed-forward network to every token, an MoE module contains many specialized expert networks and routes each token to only a small subset of them [4]. Despite this computational advantage, MoE models still impose a substantial memory footprint [36, 42]. Sparse activation cannot reduce storage requirements, as all expert parameters must remain accessible during inference [32]. Consequently, storing the entire model in limited and expensive GPU memory poses difficulties for private and on-premises deployment [6, 25, 26, 34]. Expert offloading [17, 35, 48] provides a practical solution by storing expert weights in high-capacity CPU host memory. In this context, some activated experts are inevitably absent from GPU memory at runtime, referred to as GPU-missed experts. A fundamental question for off-loaded MoE inference is therefore how to process these missed experts.

One option is to execute GPU-missed experts on the GPU, where the missed experts must first be transferred from host memory over PCI Express (PCIe) before execution. However, GPU misses occur frequently, and each miss incurs an expensive expert transfer that is much slower than GPU execution. Even with half of the experts retained on the GPU, over 50% of the required experts frequently miss GPU residency [9, 43]. Prior work [36] shows that on-demand expert transfers slow inference by more than 17×. Existing systems commonly employ speculative prefetching [9] to hide part of this cost. They predict the experts required by the next layer from the current layer's hidden states and transfer the predicted experts in parallel with ongoing computation. However, the available overlap is bounded by approximately one Transformer layer of computation. Our preliminary experiments in Sec. 2.3 show that transferring the required experts takes at least 5.2× as long as GPU computation, leaving most of the transfer latency exposed even with prefetching. Pure GPU execution therefore remains transfer-bound.

The other option is to execute GPU-missed experts on the CPU. Instead of transferring the expert weights, the GPU sends the much smaller expert inputs to the CPU, which computes the missed experts using weights already in host memory and returns their outputs to the GPU. Meanwhile, the GPU computes its resident experts and then merges the outputs from both devices. This approach transfers only the much smaller inputs and outputs rather than entire experts. However, CPUs provide far lower expert-computation throughput than GPUs, commonly delivering more than 10× lower bfloat16 compute throughput [20, 24, 29]. The GPU must wait for CPU results at each layer, placing CPU execution on the critical path. This bottleneck becomes more severe at the larger batch sizes as the CPU processes a growing expert workload. Existing systems attempt to reduce GPU misses and thereby limit the workload assigned to the CPU. For example, they profile expert popularity offline and keep globally popular experts resident in GPU memory [19], or transfer GPU-missed experts after each inference step to improve subsequent GPU hit rates [15]. Nevertheless, GPU memory remains limited, and the activated experts vary across inference requests, so the CPU inevitably processes part of the expert workload. Its much longer execution time (e.g., more than 5.4× the GPU time in our preliminary study in Sec. 2.3) continues to slow down overall inference latency.

We argue that the key challenge lies in deciding where to execute GPU-missed experts. Executing them on the GPU incurs transfer latency, whereas executing them on the CPU incurs computation latency. To this end, we propose Apex, an efficient CPU-GPU collaborative MoE inference system

Figure

Figure 1. MoE stage latency under different inference paradigms. Dashed-outlined experts are transferred from the CPU to the GPU for execution.

with adaptive expert assignment. Rather than treating all GPU-missed experts uniformly, Apex adaptively determines which experts should be transferred to the GPU for execution and which should remain on the CPU. We observe that tokens processed together in a serving batch are routed independently, producing highly variable numbers of tokens, i.e., token-loads, across activated experts. An expert's token-load determines its computation cost, whereas the amount of expert weights that must be transferred remains unchanged. Consequently, transferring a high-load expert to the GPU is more worthwhile because the faster GPU computation offsets the transfer cost, whereas transferring a low-load expert introduces more transfer overhead than the computation time it saves. Apex exploits this insight by transferring high-load experts to the GPU for faster execution while directly executing low-load experts on the CPU to avoid unnecessary weight transfers. Through this adaptive execution assignment, Apex substantially reduces the CPU workload while keeping GPU-side transfer latency under control. As illustrated in Figure 1, it avoids both excessive transfer latency and prolonged CPU computation, minimizing pipeline bubbles and reducing end-to-end inference latency.

However, realizing this adaptive assignment poses a significant challenge. Under CPU-GPU collaborative execution, overall latency is determined by the slower of two concurrent paths. The CPU path consists of computing the experts assigned to the CPU, whereas the GPU path includes both transferring selected experts and executing all GPU-assigned experts. The number of transferred experts directly shapes both paths. Transferring too many experts exposes excessive transfer latency and makes the GPU path the bottleneck. Transferring too few leaves the CPU with excessive computation, making the CPU path the bottleneck. An effective assignment must therefore reduce enough CPU work to shorten the CPU path without introducing excessive transfer overhead on the GPU path. The goal is to minimize the maximum latency of the two concurrent paths. In summary, this paper makes the following contributions:

  • We propose Apex, a CPU-GPU collaborative MoE inference system that adaptively assigns GPU-missed experts between CPU and GPU execution to balance the two paths and reduce inference latency.

  • To minimize inference latency, Apex combines speculative and exact assignment. Speculative assignment predicts high-load experts one layer ahead and starts their transfers early, extending the transfer window. Exact assignment uses an online, rate-driven algorithm to determine the remaining CPU/GPU assignments that minimize the layer latency.

  • We implement Apex and evaluate it on three representative MoE models across different batch sizes and GPU memory budgets. Compared with the strongest baselines, Apex improves prefill speed by up to 51.9% and decode throughput by up to 39.5%, with average gains of 31.2% and 31.1%, respectively.

References (31)