Introducing TPU Sync: Fast KV Cache & Weight Transfer on TPU

TPU Sync is a new open-source, native C++ library that acts as the model-state layer across TPU clusters. It treats accelerator HBM, host DRAM, shared storage, and the data center network (DCN) as one co-designed memory hierarchy, moving TPU-tiled tensors directly between tiers with asynchronous DMA transfers that overlap data movement with compute. For inference, it turns host DRAM, local SSDs, and Google Cloud Managed Lustre into a multi-tier KV cache; for reinforcement learning, it exposes low-level DMA and DCN primitives for streaming updated weights from trainers to rollout samplers. The project reports KV transfer latency reductions over 90% and an average 90% reduction in time to first token (TTFT) for heavy MoE models (235B–480B) in prefix-caching and disaggregated-serving workloads compared with running without TPU Sync.

The library integrates with existing infrastructure: it works with PyTorch via TorchTPU and with JAX, and serves as the TPU KV cache connector for vLLM, SGLang, and llm-d disaggregated serving, while providing low-level transfer primitives for Pathways and multi-controller JAX (McJAX) RL pipelines. The post uses a kitchen analogy to explain the architecture: the TPU is the chef with a small countertop (HBM), and TPU Sync adds a side pantry (pinned host RAM), shared cold storage (cluster storage), and runners that swap full prep trays directly without repacking (direct DMA in native TPU layout) while the chef keeps cooking (asynchronous, non-blocking transfers).

The main use cases are long-context agents and multi-turn chats, where KV caches grow beyond HBM; enterprise prefix caching, where shared system prompts can be reused from distributed host memory; and disaggregated prefill/decode serving, where TPU Sync streams processed context from prefill nodes to decode nodes as a host-to-host pipeline. An experimental RL module supports weight synchronization between trainers and samplers, including automatic resharding across different parallelism layouts.

TPU Sync‘s performance comes from four design choices. Layout-preserving direct DMA accesses JAX PJRT buffers or PyTorch tensors in place and moves slices between HBM and page-locked host memory in a single hardware DMA, keeping tensors in their native TPU physical tile layout. Compute-overlapped transfers create raw PJRT buffer aliases without holding PJRT usage locks, so block-level transfers run concurrently with active computation, with DMA pacing to avoid delaying kernel launches. The data path runs in native C++ outside the XLA graph, so moving or resharding tensors does not trigger runtime compilation. Finally, raw transfers reach up to 223 GB/s aggregate D2H/H2D per Ironwood (TPU v7x) host out of the 256 GB/s PCIe Gen5 ceiling, and stream across the DCN at up to ~192 Gbps on one 200G NIC or ~350 Gbps on dual NICs with NUMA-aware striping.

On top of the transport primitives, TPU Sync provides a modular orchestration stack: a global KV store maps prompt prefix hashes to physical cache blocks and coordinates LRU eviction and tier demotion; a controller generates transfer plans, coordinates movement across nodes, and handles leases and recovery; and a local KV cache manager tracks block states and executes asynchronous DMA transfers across HBM, host DRAM, and experimental POSIX storage backends.

Reported results are from internal testing in July 2026 on TPU v7x (2x2x1) with PCIe Gen5 and 1–2 200G NICs per host. For disaggregated inference on Qwen3 235B, median KV transfer latency dropped from seconds to roughly 230 ms, TTFT fell by an average of 60% under low concurrency (90% for a 480B model), and token output throughput rose 30–70% during sustained traffic spikes depending on traffic distribution. Prefix caching expanded effective cache capacity by an order of magnitude, reduced average TTFT by up to 90% on 64K-context workloads, delivered over 50% higher throughput, and cut P99 inter-token latency by 30%. The authors caution that actual results vary with system configuration, network bandwidth, concurrency, and workload. TPU Sync was built with collaborators: Inferact integrated it as the KVConnector backend in vLLM-TorchTPU; RadixArk uses it as the P/D disaggregation and hierarchical-cache I/O backend in SGLang-TorchTPU; and llm-d 1.0 pairs with it on GKE for global prefix-cache-affinity routing and capacity spill to Managed Lustre. Open-source Python wheels are available for PyTorch (tpu-sync-torch) and JAX (tpu-sync-jax).

Introducing TPU Sync: Fast KV cache & weight transfer on TPU

View Original