Manuscript Offprint

arXiv:2611.01393

Layer-wise CPU-GPU Scheduling for LLM Inference on Memory-Limited Consumer GPUs

Naoto Sugiura, Yuta Tokusashi, Hiroki Matsutani

Naoto Sugiura¹, Yuta Tokusashi², and Hiroki Matsutani¹

¹ Keio University, 3-14-1, Hiyoshi, Yokohama, Japan 223-8522 {nsugiura, matutani}@arc.ics.keio.ac.jp ² SoftBank Corp., 1-7-1 Kaigan, Minato-ku, Tokyo, Japan, 105-7529 yuta.tokusashi@g.softbank.co.jp

Abstract. As large language model inference environments expand toward consumer devices, it remains challenging to efficiently run models that exceed GPU memory capacity in single-GPU settings. The latency of transferring weights that do not fit in GPU memory accounts for about 98% of inference time and remains a major obstacle. In this paper, we focus on the fact that during the decode phase, layer computation time on the CPU can be shorter than weight transfer time, presenting an opportunity to hide weight transfers by utilizing this computation time. Therefore, we propose a method to hide transfer latency by executing certain layers on the CPU during the decode phase while asynchronously transferring the next layer's weights to the GPU in the background of that computation. To realize this scheduling, we formulate the placement of CPU/GPU computation and weight transfers as a latency minimization problem and perform optimization using an approximation model with relaxed temporal constraints. Evaluation results confirm that in a consumer desktop environment, our approach accelerates OPT-30B inference by 3.5× compared to HuggingFace Accelerate and 6.3× compared to DeepSpeed Zero-Inference.

Keywords: Large language model · GPU · Scheduling.

1 Introduction

As the social implementation of large language models (LLMs) accelerates, the environment for their inference is expanding from traditional, resource-rich cloud infrastructures to resource-constrained consumer devices, such as smartphones and personal computers (PCs). Market forecasts indicate that AI-powered PCs will account for 54.7% of the PC market by 2026, while AI-powered desktops are expected to reach a 42.1% share in the same year [2]. The growth of local execution on PCs enables reduced response times and power consumption while decreasing cloud dependency and enhancing data protection [2, 14]. Moreover, another forecast suggests that the adoption of on-device AI, which does not rely entirely on the cloud, will be driven primarily by privacy concerns [1]. Beyond consumer PCs, LLMs are also anticipated to be integrated into fields such as

N. Sugirua et al.

robotics [16] and autonomous driving [15]. Against this backdrop, LLM inference on edge and consumer devices is becoming increasingly important.

LLMs are utilized in a wide range of applications, including document generation, summarization, translation, and coding assistance. In particular, local inference on consumer devices is frequently employed for interactive applications, such as chatbots, which generate responses by sequentially producing tokens for each request. While some operational strategies aim for high throughput via batching [8, 7], this paper primarily assumes a local interactive setting with low concurrency. Key characteristics of this setting are that the effective batch size tends to be 1 and that minimizing latency, which directly affects user experience, is crucial [18].

However, LLM inference demands substantial computational resources and memory capacity, presenting significant barriers to execution on resource-constrained consumer devices. For instance, the OPT-30B [17] model requires over 60 GiB of memory in FP16 format, which far exceeds the 32 GiB capacity of the RTX 5090, a state-of-the-art consumer-grade GPU. When LLM weights cannot fit within the GPU memory in a single-GPU environment, frameworks such as HuggingFace Accelerate [3] typically place weights in host memory and transfer them to the GPU sequentially during computation. However, in this approach, weight transfer time dominates the total latency. For example, when using OPT-30B, transfer overhead accounts for approximately 98% of the total execution time during the decoding phase, creating a severe performance bottleneck.

One direction for addressing this problem is model compression, such as quantization [13]. However, some models still remain too large to fit in GPU memory, and aggressive compression can degrade accuracy. Another direction is offloaded inference, where weights and KV caches are placed on the host side. Prior work has proposed methods that reduce transfer stalls through scheduling that reuses weights across batches [8], as well as through overlapping data transfers with computation and coordinating execution with the CPU [18, 7, 6]. FlexGen is based on a simple overlap between GPU computation and data transfer, with only limited use of CPU computation [8]. As a result, prior work reports that exposed PCIe transfer time still accounts for approximately 96–98% of the total execution time [6]. Reducing latency in offloaded inference therefore hinges on how effectively transfer time can be hidden. Park and Egger [7] hide transfers by executing part of the intra-layer weights on the CPU and thereby accelerate throughput-oriented inference, whereas our paper differs in that it targets the reduction of exposed transfers during batch-size-1 decoding under offloading. HeteGen exploits CPU-side computation through CPU-GPU tensor parallelism, but its effectiveness depends on CPU computational capability. FlexInfer [6] presents a framework that uses an estimator to select different execution policies for prefill and decode, but its choices are limited to CPU-only execution, GPU execution with transfers from host memory, and a static split called SplitGen, in which only the portion of weights that fits on the GPU is executed on the GPU and the remainder is executed on the CPU. It does not address the direction of hiding transfers behind CPU computation.

In this paper, we propose layer placement and scheduling techniques to minimize exposed transfer time for offload inference in a single-GPU environment, specifically targeting decoding with a batch size of 1. Our key observation is that the per-layer computation time on the CPU may be shorter than the weight transfer time during the decoding process. In this case, CPU computation is not merely an alternative execution target but can serve as a planned computation window for hiding transfers. Based on this observation, we assign each layer to one of three modes: execution on the CPU, residency on the GPU, or placement in host memory with transfer to the GPU at execution time followed by GPU computation, which we call the stream mode. We then construct a latency model based on the computation time and transfer time of each mode. We further introduce an approximation model that relaxes the temporal constraints of transfers and reduce the complex scheduling optimization to a ratio determination problem, thereby synthesizing an execution plan from offline measurements, namely per-layer computation time and transfer time. At runtime, transfer for stream execution blocks is hidden behind CPU computation blocks, thereby minimizing inference latency.

In summary, this work offers the following contributions:

  • We conduct an extensive analysis of LLM inference in consumer-grade desktop environments and quantitatively characterize the workload properties.
  • We formulate the latency minimization problem for LLM inference in single-GPU environments as an optimization problem involving the placement of GPU residency, CPU computation, and stream computation.
  • To accelerate LLM inference on consumer desktops, we propose a method that minimizes latency by efficiently overlapping CPU computation with weight transfers.
  • Our evaluation demonstrates that for OPT-30B, the proposed method achieves an inference speedup of 3.5× compared to Hugging Face Accelerate [3] and 6.3× compared to DeepSpeed ZeRO-Inference [4].

References (15)