Cross-Datacenter KVCache Transfer for Long-Context LLM Inference: A Technical Practice
Prefill-decode (PD) disaggregation is a widely adopted architecture for LLM inference, but transferring KVCache between Prefill and Decode nodes becomes a hard bottleneck across datacenters: dense full-attention models can produce KVCache at ~60 Gbps for 32K-token inputs, exceeding typical inter-datacenter links. This article explains how hybrid attention architectures compress KV throughput by an order of magnitude (down to ~4.7 Gbps), and how system-level mechanisms—selective offloading, bandwidth-aware scheduling, and elastic resource ratios—combine with model design to make cross-datacenter PD disaggregation practical, delivering up to ~54% higher throughput and ~64% lower P90 time-to-first-token in published measurements. It also covers the engineering questions that must be answered before production deployment.
1. After PD Disaggregation, Where Is the New Bottleneck?
In large language model inference, the Prefill and Decode phases have fundamentally different hardware requirements. Prefill is compute-bound: it processes all input tokens at once, and its throughput is limited by raw compute. Decode is autoregressive, generating one token at a time, and each step reads the entire KVCache from HBM—so its performance is limited by memory bandwidth. Splitting the two phases onto different nodes, each scaled independently, has become a widely accepted paradigm for inference serving architectures.
But disaggregation comes at a cost. Once Prefill and Decode run on different nodes, the KVCache produced during Prefill must be transferred across the network to the Decode side. If both sides sit within the same high-speed interconnect domain—for example, the same rack or an RDMA-based fabric within one datacenter—the transfer overhead is tolerable. The moment you want to offload Prefill to another compute cluster, or even another datacenter, ordinary Ethernet bandwidth immediately becomes the hard constraint.
One metric is worth defining precisely here: KV throughput Φkv, the volume of KVCache data produced per unit time during Prefill, typically expressed in Gbps. It directly determines how wide the link between Prefill and Decode must be. A concrete order-of-magnitude comparison: for a traditional dense full-attention model with a 32K-token input, a single instance can produce KVCache at roughly 60 Gbps—already beyond the usable capacity of a typical cross-datacenter Ethernet link. In other words, for this class of models, PD disaggregation is effectively “locked” inside a single high-speed network domain.
This creates a second problem. If all heterogeneous hardware must be crammed into one tightly coupled cluster just to satisfy the network constraint, then the hardware ratio between Prefill compute and Decode compute is frozen. Real-world traffic fluctuates—the mix of long-input/short-output versus short-input/long-output requests shifts constantly—and a frozen ratio means one side of the resources is always idle.
2. The Breakthrough: Hybrid Attention Architectures Compress KVCache
The first piece of the puzzle that makes cross-datacenter PD disaggregation viable comes from the model architecture itself. A recent class of hybrid attention models no longer applies full attention in every layer. Instead, a small number of full-attention layers are interleaved with a large number of linear-complexity (or near-linear-complexity) attention layers. Common combinations include: linear attention variants stacked with latent attention at roughly a 3:1 ratio, sliding window attention with grouped-query attention at roughly 5:1, and linear attention with latent attention at roughly 7:1.
The common effect of these designs is that the vast majority of layers no longer store a full KVCache proportional to sequence length. Sliding window attention retains only the KV of the most recent window; linear-complexity attention replaces per-token KV with a fixed-size state; latent attention projects KV into a low-rank space. The net result is that the KVCache footprint is compressed by roughly an order of magnitude.
In quantitative terms, with a 32K-token input, a model using a hybrid sliding-window plus grouped-query architecture can bring KV throughput down to about 4.7 Gbps, compared with roughly 60 Gbps for a dense attention model of the same scale—a difference of about 13×. That 4.7 Gbps figure is critical: it means ordinary cross-datacenter Ethernet links (10/25/100 Gbps per link) are now capable of carrying the KVCache transfer load. Model architecture evolution has effectively opened a window for system architecture that previously did not exist.
3. Model Compression Alone Is Not Enough: The System-Side Combination
It is important to be clear-eyed: model-side KVCache reduction alone is not sufficient to make cross-datacenter deployment actually work. The candid conclusion from engineering practice is that feasibility comes from the combination of model architecture optimization and system-level mechanisms—neither is dispensable. At minimum, three system capabilities are needed.
1. Selective Offloading. Not every request is worth transferring across datacenters. The decision logic should take request characteristics as input: the longer the input, the larger the Prefill computation, and the greater the benefit of offloading to a high-compute cluster. Conversely, short-input requests produce small KVCaches, but the extra transfer latency accounts for a large share of their total latency, making local processing more economical. An illustrative decision framework:
def should_offload(input_len, output_est, local_load, link_bw):prefill_flops = estimate_prefill_cost(input_len)kv_bytes = estimate_kv_size(input_len) # depends on model architecturetransfer_time = kv_bytes / link_bwremote_gain = prefill_flops / remote_tflops \- prefill_flops / local_tflopsif local_load > THRESHOLD and remote_gain > transfer_time:return Truereturn False
The core idea is to compare “offloading gain” against “transfer cost” on the same time axis, and to adjust the threshold dynamically with local load.
2. Bandwidth-Aware Scheduling. Cross-datacenter links are shared and fluctuating resources. The scheduler needs to treat link bandwidth as a first-class scheduling resource, on par with compute and HBM: estimate transfer completion time based on real-time available bandwidth, and pipeline the KVCache transfer with HBM allocation on the Decode side—avoiding waste on both ends, whether KV arriving before memory is ready or memory sitting idle waiting for KV. Combined with chunked transfer and streaming Decode startup (generation begins before all KV has arrived), transfer latency can be further hidden.
3. Elastic Resource Ratios. Once Prefill can be offloaded to a remote compute pool, the hardware ratio between Prefill and Decode changes from “fixed” to “on demand”: borrow Prefill capacity from the remote pool during traffic peaks, release it during troughs. This is precisely the core benefit of cross-cluster deployment over a homogeneous PD cluster. According to published measurements, on a trillion-parameter-scale hybrid architecture model, throughput improved by about 54% and P90 time-to-first-token dropped by about 64% compared with homogeneous PD deployment. Behind these two numbers lies the same essence: compute that would otherwise sit idle elsewhere becomes an elastic buffer pool for the inference service.
4. Engineering Questions That Must Be Answered Before Production
Moving this architecture from paper to production requires evaluating several practical constraints. First, link stability: cross-datacenter networks suffer from jitter and congestion, so P90 latency improvements must be built on predictable link quality, supported by link quality probing and degradation policies (falling back to local Prefill when the link deteriorates). Second, model architecture constraints: the dramatic reduction in KV throughput depends on hybrid attention design. For existing models still using dense full attention, this path does not apply directly—a prerequisite is that the model itself already incorporates KV-compression-style designs. Third, consistency guarantees: KVCache transferred across the network needs complete checksum and retransmission mechanisms; a single corrupted byte directly contaminates the generated output. Fourth, scheduling complexity: selective offloading and bandwidth-aware scheduling are essentially a multi-resource joint optimization problem. In engineering practice, it is advisable to start with simple rule-based policies and gradually calibrate the cost model with online data, rather than pursuing a globally optimal solution from day one.
For teams building their own inference platforms, or building inference services on general-purpose cloud infrastructure (generic product categories such as elastic compute, container orchestration, load balancing, and monitoring/alerting), the takeaway from this approach is universal: first quantify your model’s KV throughput, then evaluate whether your existing network topology can carry it, and only then optimize offloading and scheduling strategies. This evaluation framework applies equally on general-purpose cloud compute environments, including the elastic compute and networking capabilities offered by providers such as Baidu AI Cloud.
5. Conclusion
Has the path of “cross-datacenter KVCache transfer” truly been proven viable? The answer is a conditional yes: it is not the victory of any single technique, but the result of three elements working together—model architecture (hybrid attention compressing KV volume), system mechanisms (selective offloading, bandwidth-aware scheduling), and resource organization (elastic ratios across pools). Understanding this combined logic is more valuable than memorizing any single performance number—because as models keep growing and contexts keep lengthening, what ultimately determines the ceiling of inference architecture is precisely this methodology of “co-designing the model with the system.”
