KV Broadcast Technical Guide: Reusing KV Caches in LLM Inference

    This article explores KV Broadcast, a technique designed to reduce communication overhead by reusing KV caches during large language model inference. It details the origins of inference communication costs, the core workflow and components of KV Broadcast, and its integration with tensor parallelism, cache quantization, and EPD disaggregated architectures. Additionally, it outlines applicable boundaries, common pitfalls, and a comprehensive checklist for deployment and performance validation.

    1. Where Do Inference Communication Overheads Come From?

    Large language model inference is divided into two phases. The Prefill phase processes all input tokens at once, which is compute-intensive. The Decode phase generates tokens one by one; each step requires reading the entire historical KV cache, making it primarily limited by memory bandwidth. As the context length grows, the memory read volume in the Decode phase increases accordingly.

    The size of the KV cache is directly proportional to the context length. Taking a model with 80 layers, 8 KV heads, a per-head dimension of 128, and stored in BF16 as an example, the KV cache per token is 2×80×8×128×2 = 327,680 bytes, or about 320KiB. For a request with 32K tokens, the entire KV cache is approximately 10GiB. This figure is only a theoretical lower limit; in practice, metadata, memory alignment, and framework overheads must also be accounted for. In your own service, you should recalculate based on actual layer counts, KV head counts, precision, and context length.

    Standard Tensor Parallelism (TP) does not move the KV cache during each decoding step. TP partitions computation by attention heads, so each card only stores its responsible KV heads, and what is exchanged between cards is mainly intra-layer activations. Note an exception: when the model uses GQA or MQA, and the number of KV heads is less than the TP parallelism, some KV heads will be replicated across multiple cards. The memory and transmission for this replicated portion need to be accounted for separately.

    Moving KV caches across devices or nodes typically occurs in three scenarios. First, the Prefill node hands off the cache to the Decode node, known as disaggregated deployment. Second, multiple replicas share the same prefix. Third, context parallelism splits a long sequence across multiple cards. These three scenarios each have alternative solutions. For example, prefixes can be reused locally only, long contexts can use more rational partitioning methods, and disaggregated deployment can also be restricted to the same high-speed network domain.

    The bandwidth of different links within a cluster varies greatly. Intra-node interconnects are typically much faster than cross-node networks, with the exact multiplier depending on the hardware. If this is not considered during scheduling, cross-node transmission will become a primary source of wait time.

    2. How KV Broadcast Works

    The core idea of KV Broadcast is: a specific KV cache segment is transmitted only once, after which it is reused by the receivers, avoiding repeated computation or copying for each request and node. It involves four key components.

    1. Identifying Sharable Cache Blocks. The system chunks the token sequence into fixed lengths, usually several tokens per block, with the exact value determined by the framework. The hash key for each block consists of two parts: the token content within the block, and the hash value of the previous block. Thus, the same block will only get the same key if all preceding prefixes are identical. System prompts, common prefixes in multi-turn conversations, and fixed document contexts will receive the same hash and are therefore identified as sharable blocks. An index table records which nodes each block resides on.

    There are prerequisites for the consistency of shared blocks. A block can only be reused if the following configurations are completely identical across all nodes: model weight version, tokenizer, position encoding configuration (e.g., RoPE parameters and context extension settings), attention mask and sliding window settings, KV cache precision and quantization method, and tensor parallelism partitioning. Any inconsistency may lead to reading incorrect KV values and degraded output quality, which can be difficult to detect.

    Hash collisions require specific protection. It is recommended to use strong hash functions and include the model identifier and configuration version number in the hash key. After hitting the index, the original token sequence or stored checksum should also be compared; if verification fails, it should be treated as a miss.

    2. Broadcast by Group. The source node sends the block to a group of nodes that need it. Broadcasting can use tree or ring topologies, allowing receivers to forward to each other, preventing the source node’s egress link from becoming a bottleneck. Before sending, it should verify whether the receiver actually needs the block; nodes that have already hit locally should be skipped.

    After receiving the data, the receiver first verifies it, then writes it to the local cache and records the reference count for direct reuse by subsequent requests.

    3. Overlap with Computation. The system uses a double-buffering mechanism. While the current batch is computing, the blocks required for the next batch are transmitted in the background. This overlap only yields benefits when the following conditions are met: the transmission time is less than the computation time; the extra memory required for the receive buffer can be accommodated; dependencies between batches have been checked, meaning blocks being read will not be overwritten by subsequent writes. Before entering computation, the system needs to set a synchronization point to confirm that the required blocks are ready.

    4. Eviction and Release. Cache capacity is limited, and eviction strategies usually employ LRU (Least Recently Used). Only blocks with a reference count of zero can be released; blocks being read must be retained.

    Failure Fallback. When broadcast times out, bandwidth is insufficient, or verification fails, the system should degrade gracefully rather than blocking requests. There are two optional fallback methods. First is on-demand pulling, where the block is fetched from the source node when the request arrives. Second is local recomputation, which means re-executing the Prefill phase. The fallback threshold should be set based on a comparison of the actual costs of the two. The fallback trigger rate should be monitored continuously.

    The choice of broadcast topology depends on scale and network conditions. The table below provides a qualitative comparison.

    Dimension Tree Broadcast Ring Broadcast
    Source node egress pressure Lower; source node only sends to a few child nodes Lower; forwarded segment by segment
    Tail latency Grows with tree depth, usually shorter Grows significantly with node count, longer tail
    Implementation complexity Higher; requires maintaining a forwarding tree Lower; but needs to handle ring failures
    Applicable scale Scenarios with many receivers and latency sensitivity Scenarios with fewer receivers or limited bandwidth

    3. Integration with Tensor Parallelism, Cache Quantization, and EPD Disaggregated Architecture

    Integration with Tensor Parallelism. KV Broadcast only acts on cross-device KV blocks; activation communication within tensor parallelism still follows the original path. Blocks are stored in shards on each TP rank, so broadcasting requires sending the corresponding shard per rank, or using a unified layout within the group. In GQA or MQA models, the replicated portion of KV heads must also be included in storage and transmission calculations.

    Integration with Cache Quantization. Quantizing the KV cache to lower bit widths such as FP8 or INT8 can reduce transmitted bytes proportionally to the bit width. Quantization parameters (such as scale) must be transmitted alongside the block and included in consistency checks. Note that dequantization itself incurs computational overhead, so actual gains should be confirmed through testing. Quantization can affect output quality, and a regression evaluation should be performed on the target task.

    Integration with EPD Disaggregated Architecture. If the system splits visual or other encoder modules, Prefill, and Decode across different nodes, KV Broadcast primarily acts between Prefill and Decode, or among multiple Decode replicas. Intermediate features generated during the encoding phase are different from KV caches and should have separate transmission paths designed for them. Specific terminology and division of labor vary by framework, so you should refer to your own framework’s definitions before deployment.

    4. Applicable Boundaries and Common Pitfalls

    Suitable Scenarios:

    • High proportion of common prefixes in system prompts, fixed documents, or multi-turn conversations.
    • Adoption of disaggregated deployment, where KV transfer accounts for a significant portion of Time To First Token (TTFT).
    • Cross-node network bandwidth has become a bottleneck.

    Unsuitable Scenarios:

    • Almost no common prefixes among requests.
    • Primarily relying on intra-node tensor parallelism with sufficient bandwidth.
    • Extremely sensitive to queue latency while load fluctuation is high.
    • Frequent model or configuration updates, causing caches to expire quickly.

    Common Pitfalls:

    • Assuming that all tensor parallel decoding steps require moving the KV cache. In reality, standard tensor parallelism mainly exchanges activations.
    • Focusing only on cache hit rate and ignoring transmission costs. A high hit rate but slow transmission can still worsen overall latency.
    • Ignoring consistency prerequisites, leading to incorrect reuse of the same text under different configurations.
    • Ignoring security and isolation. Cross-tenant cache sharing may cause information leakage or cache pollution. Sharing should be restricted to common prefixes within the same trust domain, with proper authentication, isolation, and lifecycle management.
    • Treating a single stress test result as a direct reflection of production gains.

    5. Checklist and Effectiveness Validation

    Pre-launch Checklist:

    • What is the proportion of common prefixes in real traffic, and does it meet the prerequisites for gains?
    • How much does cross-node KV transfer account for in Time To First Token (TTFT)?
    • Do the network bandwidth and broadcast scale match the chosen topology?
    • Are model versions, tokenizers, quantization, and tensor parallelism configurations consistent across all nodes?
    • Are tenant isolation, capacity limits, and eviction strategies configured?
    • Has the failure fallback path been implemented and verified for availability?

    Effectiveness Validation Metrics:

    • P50, P95, and P99 for Time To First Token (TTFT) and Time Per Output Token (TPOT).
    • Overall throughput (tokens/s) and request success rate.
    • Cache hit rate, broadcast completion time, and timeout rate.
    • Overlap ratio between transmission and computation, as well as the fallback trigger rate.
    • Memory usage, including the extra overhead of receive buffers.
    • Output consistency: compared with the baseline output under a fixed random seed, the difference should be within an acceptable range.

    Validation Method: First, record real traffic and replay it in a test environment to conduct an A/B comparison under the same load. After confirming stable gains, proceed with a phased, gradual rollout. Each phase should monitor both performance metrics and output quality simultaneously. The mechanisms described in this article are general design concepts; specific implementations vary by framework and hardware, and must be validated in your own environment before use.