Breaking the GPU Memory Bottleneck: Latent Cache Offloading and Prefetching for Sparse Large Models

    As long-context inference becomes standard for production LLM applications, GPU memory capacity is increasingly limiting Decode throughput. This article analyzes the bottleneck in PD-separated architectures and presents Baidu AI Cloud’s AIAK team’s Expanded Sparse Server (ESS), which uses asynchronous Latent Cache offloading and prefetching to decouple storage from computation. It also reviews high-fidelity simulations across 32K and 128K context windows and examines how ESS works with Multi-Token Prediction (MTP).

    1. The System Bottleneck: Latent Cache Memory Pressure During Decode

    As large language models (LLMs) continue to improve, long-context processing has become a standard requirement for production applications. In recent years, sparse large models have reduced inference latency in long-context scenarios by introducing sparse Attention computation. However, in architectures that separate Prefill and Decode (PD), the throughput of the Decode stage becomes increasingly constrained as sequence lengths grow.

    During Decode, the model generates tokens incrementally. The contextual state required for computation is typically stored in GPU memory as a Latent Cache, including the KV Cache and related intermediate activation states. The central challenge is that the size of this cache grows linearly with sequence length.

    With limited GPU memory, increasing the context window from several thousand tokens to tens of thousands or even 100K tokens causes per-batch memory consumption to rise sharply. As a result, the maximum supported Batch Size decreases significantly.

    Decode is relatively compute-light compared with other stages. When Batch Size cannot be increased, GPU compute resources are not fully utilized, which limits Decode throughput and increases the inference cost per request. Sparse Attention reduces the cost of each computation, but it does not change the linear growth of memory usage. GPU memory capacity therefore remains a fundamental physical bottleneck to further throughput improvements.

    2. ESS: Decoupling Storage from Computation

    To address this limitation, the core objective is to move Latent Cache data to CPU memory through an Offload mechanism while maintaining strict latency requirements. This allows sparse large-model inference systems to increase Decode throughput and reduce cost. To achieve this, the Baidu AI Cloud AIAK team proposed the Expanded Sparse Server (ESS) architecture.

    2.1 Asynchronous Offload and Prefetch

    ESS decouples the storage path of Latent Cache data from the computation path. Instead of requiring all active Cache data to remain in GPU memory, the system offloads data to CPU memory or slower storage tiers when appropriate. When a compute node needs the Cache for a specific layer, an efficient Prefetch mechanism transfers it back to GPU memory in advance.

    To avoid increasing latency, ESS uses fine-grained pipeline scheduling. Computation and data transfers overlap: while the GPU processes the current layer, the Cache required by the next layer is already being transferred—or is in the process of being transferred—over the system interconnect.

    1. # Pseudocode: asynchronous Offload and Prefetch pipeline
    2. def decode_step(layer_idx, current_token):
    3. # 1. Asynchronously prefetch the Latent Cache for the next layer
    4. prefetch_async(layer_idx + 1, target_gpu_device)
    5. # 2. Execute sparse Attention for the current layer on the GPU
    6. output = sparse_attention_compute(
    7. query=current_token,
    8. kv_cache=gpu_kv_cache[layer_idx]
    9. )
    10. # 3. Offload the current Cache to CPU memory after computation
    11. # if it is no longer frequently accessed
    12. if is_offload_required(layer_idx):
    13. offload_async(layer_idx, target_cpu_memory)
    14. return output

    2.2 Compatibility and System-Level Integration

    In production deployments, isolated optimizations often cannot deliver their full value. ESS is designed as a system-level enhancement that integrates with existing inference stacks. It can work alongside mainstream optimization strategies such as Multi-Token Prediction (MTP) and Two-Batch Overlap.

    MTP improves decoding efficiency by predicting multiple tokens in a single forward pass. ESS, meanwhile, frees GPU memory and enables a larger Batch Size. These optimizations complement each other, increasing the system’s overall throughput ceiling.

    3. High-Fidelity Simulation and Performance Evaluation

    Before implementing ESS in a production system, the team built a high-fidelity simulator to evaluate its feasibility and performance boundaries. This approach helps avoid costly engineering iterations and enables faster design refinement.

    3.1 Simulator Design

    The simulator models:

    • Sparse computation time in large models
    • GPU-to-CPU communication latency
    • PCIe and NVLink bandwidth constraints
    • The overhead introduced by the Offload-Prefetch mechanism

    Developers can configure different hardware topologies, context lengths, and scheduling strategies to obtain performance estimates. This “simulate before implementation” methodology reduces engineering validation costs and accelerates iteration.

    3.2 Evaluation with a 32K Context Window

    In the 32K-context scenario, the simulation focused on the combined effects of MTP and ESS. When MTP increased from 2 to 4, the overall system achieved a 123.4% throughput improvement.

    Performance attribution showed that 53.1% of the improvement came directly from the MTP optimization, while the remaining 70.2% was attributed to ESS and its Offload-Prefetch mechanism. These results indicate that ESS did not undermine MTP performance. Instead, by expanding the available memory pool, ESS allowed MTP to benefit from a larger Batch Size and stronger concurrency.

    3.3 Evaluation with a 128K Context Window

    The GPU memory bottleneck becomes even more severe with extremely long contexts. Under the demanding conditions of MTP = 2 and a 128K context window, the original architecture could barely maintain a practical Batch Size.

    After ESS was introduced, its Offload-Prefetch mechanism delivered a throughput improvement of up to 123%. This result demonstrates the potential of ESS to overcome physical GPU memory constraints and make better use of available compute capacity for long-context inference.

    4. Conclusion and Outlook

    As PD-separated architectures and long-context workloads become increasingly common, GPU memory capacity has emerged as a primary physical constraint on LLM inference throughput.

    The Latent Cache Offload-Prefetch approach provides a practical way to address this limitation. The ESS solution proposed by Baidu AI Cloud’s AIAK team defines the performance trade-offs of offloading in sparse Attention architectures and validates its benefits through high-fidelity simulation in both 32K and 128K long-context scenarios.

    As hardware-software co-design continues to advance, cross-tier storage and scheduling mechanisms of this kind are likely to become an important capability for production-scale LLM deployment. They can provide a stronger foundation for AI applications that process increasingly complex and lengthy inputs.