Cross-Datacenter KV Cache Transfer for Prefill-Decode Disaggregated LLM Inference

    This article explains how hybrid attention architectures make cross-datacenter KV cache transfer practical. Smaller KV caches allow long-context Prefill to be offloaded to a remote high-compute cluster and returned over standard Ethernet. The approach depends on selective offloading, bandwidth-aware scheduling, and reliable transfer design. The article also reviews the reported gains and the added complexity and limitations.

    1. The Benefits and Constraints of PD Disaggregation

    LLM inference naturally splits into two stages. Prefill processes all input tokens in parallel and is compute-intensive, so it depends heavily on compute capacity. Decode generates output one token at a time and is memory-bandwidth-intensive, so it is sensitive to latency. Because the two stages have very different resource profiles, splitting them into separate deployments (PD disaggregation) has become the standard approach for large-scale inference systems. Each stage can run on the hardware best suited to it and scale independently, which improves resource utilization.

    PD disaggregation, however, has an unavoidable physical constraint. The KV cache produced during Prefill must be fully transferred to the Decode nodes. In traditional dense attention models, the full Key and Value tensors must be kept for every layer and every token. For example, with a 32K-token input on a typical large dense model, a single inference instance can produce KV cache at a rate of tens of Gbps.

    We can define a key metric, KV throughput Φkv, as the amount of KV cache produced by Prefill per unit of time:

    1. Φkv = (request rate × context length × KV bytes per token) / transfer window

    When Φkv reaches tens of Gbps, Prefill and Decode must share a high-speed, RDMA-class network. This creates three linked problems:

    1. Geographic lock-in: Prefill and Decode clusters must be deployed in the same data center and network domain, so cross-datacenter deployment is not feasible.
    2. Heterogeneity challenges: Accelerators of different generations and models are forced into one tightly coupled cluster, which sharply increases operational complexity.
    3. Fixed ratios: The hardware ratio between Prefill and Decode is locked when the cluster is built. It cannot adjust to traffic peaks and valleys or to changes in the context length distribution.

    This invisible bandwidth chain has long limited how elastic inference architectures can be.

    2. The Opening Created by Hybrid Attention Architectures

    The variable that changes this situation comes from the model side. In recent years, mainstream long-context models have widely adopted hybrid attention architectures. These models alternate a small number of full attention layers with many layers of linear (or near-linear) complexity. Common combinations include sliding window attention mixed with grouped-query attention, and various linear attention variants mixed with multi-head latent attention. Full attention layers often make up only 1/4 to 1/8 of the total.

    This design directly reduces KV cache size:

    • Linear attention layers maintain only a fixed-size state, independent of context length.
    • Sliding window layers keep only the KV entries inside the window and discard the rest.
    • Multi-head latent attention uses low-rank compression to project KV into a latent space much smaller than the original dimension.

    Overall, at the same context length, the KV cache of a hybrid architecture can be an order of magnitude smaller than that of a traditional dense attention model. In terms of the Φkv metric, the transfer load that once required an RDMA network falls within the range that ordinary Ethernet (such as 25G or 100G Ethernet) can handle.

    Transferring KV cache across data centers has therefore shifted from physically impossible to an engineering problem worth designing carefully. This marks a turning point in the evolution of inference architecture.

    3. Prefill-as-a-Service: Architecture Design

    Based on these premises, a new deployment model emerges, which can be called Prefill-as-a-Service. Long-context Prefill tasks are selectively offloaded to independent high-compute clusters. The resulting KV cache is returned to the local PD cluster over ordinary Ethernet, where Decode runs. The overall flow is as follows:

    1. User request → Scheduler (evaluates offloading benefit)
    2. ├── Short context / low load → Local PD cluster handles the full pipeline
    3. └── Long context / high load → Remote Prefill cluster
    4. ↓ KV cache (over Ethernet)
    5. Local Decode cluster → token-by-token output

    This architecture depends on three core designs.

    3.1 Selective Offloading: Not Every Request Is Worth the Trip

    Cross-datacenter transfer has fixed overheads, including network latency, serialization cost, and queuing time. For short-context requests, local Prefill may finish within a few hundred milliseconds, so offloading would cost more than it saves. The scheduler needs to decide dynamically based on request characteristics (context length, priority) and system state (local load, link bandwidth):

    1. def should_offload(request, local_load, link_bw):
    2. # Estimated local Prefill time
    3. local_time = request.ctx_len * PREFILL_COST / local_capacity(local_load)
    4. # Remote path time = remote compute + transfer + fixed overhead
    5. kv_bytes = estimate_kv_size(request.ctx_len)
    6. remote_time = (request.ctx_len * PREFILL_COST / REMOTE_CAPACITY
    7. + kv_bytes / link_bw + FIXED_OVERHEAD)
    8. return remote_time < local_time * OFFLOAD_MARGIN

    Only long-context requests enter the offloading path. For these requests, the reduced KV cache keeps transfer costs manageable, and the compute gain is significant.

    3.2 Bandwidth-Aware Scheduling: Treating the Network as a First-Class Resource

    Cross-datacenter links are shared and fluctuate. The scheduling system needs to monitor available link bandwidth in real time and treat KV cache transfer as a scheduling constraint. When a link is congested, the system can lower the offloading ratio or switch transfer paths.

    During transfer, chunked transfer pipelining can send KV cache layer by layer as each layer is produced. This overlaps transfer with Prefill computation and hides part of the transfer latency. When necessary, KV cache can also be quantized (for example, from FP16 to FP8 or INT8) to reduce transfer volume further.

    3.3 Transport Protocol and Reliability Design

    Compared with transfers inside an RDMA domain, Ethernet transfers across data centers must handle packet loss, out-of-order delivery, and congestion control. Common engineering practices include:

    • Reliable transport over TCP or QUIC, with application-layer verification.
    • Falling back to local recomputation when a transfer fails.
    • Managing the KV cache lifecycle by releasing remote cache promptly after Decode completes, which pr