Abstract
As Large Language Models (LLMs) scale toward million-token context windows, the KVCache memory requirement has become a critical bottleneck, often exceeding the capacity of standard GPUs. Existing offloading solutions that move the KVCache to CPU RAM are frequently limited by high CPU management overhead, PCIe underutilization, and synchronization stalls. We present CLO (CPU-Light Offloading), a novel inference system that utilizes an algorithm-system co-design to minimize CPU involvement. By employing head-level approximate caching based on query similarity and a zero-copy transfer engine, CLO achieves up to a 66% boost in decoding throughput while maintaining model accuracy within 0.42% of full-attention baselines.
Introduction
The demand for "infinite" context windows (1M+ tokens) has shifted the primary bottleneck of LLM inference from computation to memory. For a model like Qwen2.5-14B, a 512K sequence requires nearly 94 GB of KVCache, far surpassing the 24GB or 48GB capacity of typical GPUs. While offloading to CPU RAM is a logical solution, traditional systems hit three "CPU-side" walls: excessive management overhead from fine-grained cache policies (like LRU), PCIe bandwidth underutilization due to data gathering delays, and synchronization bubbles where the GPU idles while waiting for CPU task launches.
System Architecture and Methods
CLO addresses these bottlenecks by shifting the heavy lifting away from the CPU through several co-designed innovations that optimize the end-to-end data flow.
As illustrated in Figure 1, the system optimizes the interaction between the GPU and CPU:
- Query Similarity-based Approximate Cache: Instead of tracking every data block, CLO operates at the head level. It leverages the observation that similar query vectors in consecutive decoding steps often attend to the same "Top-K" keys, allowing the system to skip expensive cache updates for many heads.
- Head Importance Awareness: Using "Duo-Attention" profiling, CLO assigns stricter caching thresholds to critical heads while being more relaxed with others, ensuring accuracy is preserved where it matters most.
- Zero-Copy Transfer Engine: Built on
GDRCopy, this engine allows the CPU to write data directly into GPU memory via the PCIe BAR, bypassing redundant data copies and saturating PCIe 4.0 bandwidth with minimal CPU threads. - GPU-Centric Synchronization: CLO moves the "handshake" between the CPU and GPU into shared memory, allowing the GPU to proceed with computation as soon as data arrives without waiting for slow CPU interrupts.
Key Insights: Temporal Redundancy in Attention
A fundamental discovery driving CLO's efficiency is the high temporal redundancy in attention mechanisms. Query vectors in adjacent decoding steps exhibit very high cosine similarity, meaning the set of relevant keys remains relatively stable over short intervals.
As shown in Figure 5, this similarity is pervasive across different models and layers. By managing the cache at the coarse-grained head level rather than the block level, CLO reduces the metadata the CPU must track by orders of magnitude. This allows the system to prioritize PCIe saturation over perfect cache hit rates, as the performance gains from faster data movement far outweigh the minor algorithmic inaccuracies of approximate caching.
Evaluation and Results
CLO was evaluated using two state-of-the-art long-context LLMs: Llama3-8B-Instruct-1048K and Qwen2.5-14B-Instruct-1M, using benchmarks like RULER and LongBench.
- Throughput Boost: CLO improved decoding throughput by 9.3% to 66.6% compared to state-of-the-art baselines like RetroInfer and InfiniGen.
- Efficiency: In per-layer breakdowns, CLO achieved a 2.1x–5.2x speedup on Llama3 and 1.6x–4.2x on Qwen2.5.
- Accuracy Preservation: Despite using approximate caching, CLO maintained accuracy within 0.42% of the full-attention baseline across all benchmarks.
- Hardware Saturation: The zero-copy engine reached a stable transfer speed of 21.21 GB/s, nearly the theoretical peak of PCIe 4.0 x16, using only 4 CPU threads.
Conclusion and Future Work
CLO demonstrates that an algorithm-system co-design can effectively overcome the CPU-side bottlenecks of KVCache offloading. By simplifying cache management and maximizing hardware utilization, it enables efficient million-token inference on limited GPU hardware. Future work will focus on automating hyperparameter tuning and extending the system to multi-GPU distributed environments.
Summary updated