KV Cache Reuse and Sparsification in LLM Architecture Evolution

    Large language model architecture design is shifting from parameter scaling toward cost control across quality, inference cost, memory usage, and maintainability. Long-context, multi-turn, tool-calling, and agent workloads make KV cache a primary constraint on context length, batch size, throughput, and cost per request. This article reviews the main KV cache reduction techniques—GQA/MQA, cache-dimension compression, cross-layer KV reuse, paged cache management, and sparsification such as MoE—and examines their tradeoffs. It focuses on cross-layer reuse mechanics, training and quality considerations, architecture selection logic for edge, MoE, and dense models, and practical deployment and evaluation guidance.

    1. The Main Thread of Architecture Evolution: From Parameter Stacking to Cost Control

    A notable feature of recent LLM architecture evolution is that design goals have moved from purely pursuing parameter scale toward balancing model quality, inference cost, memory usage, and maintainability. In long-context, multi-turn dialogue, tool-calling, and agent reasoning scenarios in particular, a model must retain a large amount of historical state within a single session, which further amplifies memory pressure during decoding. KV Cache is no longer just an implementation detail; it is a core variable that directly affects context window length, concurrent batch size, service throughput, and cost per request.

    At the architecture level, recent changes have formed several parallel paths. One path is small models for on-device and local devices, which compress runtime cost by sharing KV Cache, reducing the number of cache heads, and using quantization and paged management. Another path is medium-sized models using Mixture-of-Experts (MoE), which reduce per-token computation through activation sparsity while still facing attention-layer cache overhead. A third path is dense architecture models, which trade higher computation cost for more stable quality and a simpler post-training process. Understanding these tradeoffs is more important than memorizing a particular model name.

    2. Why KV Cache Becomes a Core Constraint

    During autoregressive decoding, each generated token must attend to the Keys and Values of historical tokens. To avoid repeated computation, inference systems cache the historical Key-Value tensors; this is the KV Cache. Its memory usage can be estimated with a simplified model:

    1. KV bytes per token per layer ≈ 2 × n_kv_heads × head_dim × bytes_per_element
    2. Total KV bytes ≈ batch_size × seq_len × layers × KV bytes per token per layer

    Here, 2 accounts for the two tensors, Key and Value. As this shows, KV Cache grows approximately linearly with batch size, sequence length, number of layers, number of cache heads, and head dimension. In long-context scenarios, sequence length itself is large; in high-concurrency scenarios, batch size further amplifies usage. Even if the total number of model parameters remains unchanged, KV Cache can become a memory bottleneck, reducing the number of concurrent requests that can be served or forcing the system to shorten the context window, reduce batch size, and increase cache swap-in and swap-out.

    More importantly, the decoding phase is often constrained by memory bandwidth. Each generated token requires reading a large amount of cache, and the larger the cache, the more obvious the bandwidth pressure. Therefore, shrinking KV Cache not only saves memory but also reduces memory access cost during decoding, affecting time-to-first-token (TTFT), per-token latency, and overall throughput.

    3. The Technical Spectrum for Reducing KV Cache

    Optimization around KV Cache is not a single method but a set of composable techniques.

    The first category is reducing the number of cache heads. In multi-head attention, each attention head maintains independent Key-Value tensors. Grouped-query attention lets multiple query heads share one set of Key-Value tensors, and multi-query attention further lets all query heads share one set. These methods directly reduce cache replicas, but they require attention to potential loss of representational capacity and usually need training or continued training for adaptation.

    The second category is compressing cache dimensions. Common ideas include low-rank projection, quantization, and block compression. Quantization can significantly reduce the number of bytes per element but introduces numerical error; low-rank projection can reduce the number of channels but requires a well-designed projection matrix and evaluation of error accumulation in long contexts.

    The third category is cross-layer reuse. The core idea is that later layers no longer independently compute and store full Key-Value states; instead, they reuse Key-Value states already computed by earlier layers or apply lightweight adaptation on top of them. This can turn “one cache per layer” into “one cache per group of layers,” directly reducing overhead along the layer dimension of the cache. A recent class of small on-device models has brought this idea into mainstream open-source architectures, showing that cross-layer reuse is moving from a research topic to engineering practice.

    The fourth category is cache management optimization, such as paged cache management, prefix reuse, and cache offloading and recomputation strategies. These methods do not necessarily change model structure, but they can improve memory utilization and cache hit rate, making them especially suitable for multi-turn dialogue and long agent trajectories.

    The fifth category is sparsification architectures. MoE reduces per-token computation by activating only some experts, but it does not automatically eliminate the KV Cache in attention layers. Dense architectures have a stable computation path and relatively straightforward post-training, but higher inference cost. Therefore, sparsification and KV Cache optimization are usually orthogonal and need to be evaluated in combination.

    4. Mechanisms and Implementation Points of Cross-Layer KV Reuse

    The basic approach to cross-layer KV reuse is to divide adjacent or nearby layers into a sharing group. The first layer in the group computes Keys and Values and writes them to cache, and subsequent layers reuse that cache. To prevent different layers from losing all differences, learnable lightweight projection, gating, or residual adaptation can be added on top of reuse so that each layer can still form distinct attention patterns.

    A simplified pseudocode example is shown below:

    1. # Pseudo-code: share KV by layer group
    2. function attention(x, layer_id, cache):
    3. group_id = layer_id // SHARE_GROUP
    4. if layer_id % SHARE_GROUP == 0:
    5. k = Wk[layer_id] @ x
    6. v = Wv[layer_id] @ x
    7. cache[group_id] = (k, v)
    8. else:
    9. k_base, v_base = cache[group_id]
    10. k = adapt_k[layer_id](k_base)
    11. v = adapt_v[layer_id](v_base)
    12. q = Wq[layer_id] @ x
    13. return softmax(q @ k.T / sqrt(d)) @ v

    Several issues need particular attention during implementation. The first is sharing granularity: the larger the sharing group, the more obvious the cache savings, but the more inter-layer representational differences are compressed, potentially affecting quality. The second is position-information consistency: when reusing Key-Value tensors, position encoding and mask logic must remain consistent with the queries of each layer; otherwise, attention misalignment can occur. The third is training adaptation: cross-layer reuse is best introduced during pretraining or continued training so that the model learns to allocate layer functions under shared-cache conditions. Forcing sharing only at inference time carries higher quality risk. Finally, there is cache layout: after sharing, the number of cache entries decreases, but access patterns change, so it must be paired with paged management, batching, and prefix reuse strategies to avoid new memory-access bottlenecks.

    Cross-layer reuse is not a free lunch. It reduces cache capacity and bandwidth requirements but may weaken inter-layer representation diversity. Therefore, engineering decisions should evaluate quality through tasks such as long-document retrieval, multi-turn consistency, and tool-call success rate, and then make joint decisions together with memory usage, throughput, and latency.

    5. Selection Logic for Edge, MoE, and Dense Architectures

    For small models aimed at on-device and local devices, the primary goals are low memory usage, low power consumption, and deployability. Shared KV Cache, fewer cache heads, quantization, and paged management can be combined to make long context more feasible within limited memory. Such architectures usually require finer quality tradeoffs, and evaluation should cover offline tasks, long sessions, and resource-constrained scenarios.

    MoE architectures are suitable for reducing per-token computation in local inference by controlling compute through sparse activation. However, it is important to note that MoE mainly optimizes feed-forward layer computation; the KV Cache in attention layers still exists. If the context is very long, the cache can still become a bottleneck. Therefore, MoE models should be evaluated together with KV cache compression, paged management, and batch scheduling. In addition, MoE models usually involve routing stability and expert load balancing, and post-training and tuning are more complex.

    The advantage of dense architectures is a stable computation path, controllable quality performance, and a relatively straightforward post-training process, making them suitable for scenarios with high requirements for quality consistency and tuning efficiency. However, their inference cost is higher, and KV Cache pressure is more obvious in long-context settings. In actual selection, one should not look only at parameter count or per-token compute; instead, one should build a comprehensive matrix covering quality, memory, throughput, latency, post-training cost, and operational complexity.

    6. Deployment and Evaluation Recommendations

    During deployment, it is advisable to first build a memory budget model and account separately for model weights, KV Cache, activations, temporary buffers, and batching overhead. For long-context services, monitor KV Cache usage, cache hit rate, time-to-first-token, per-token latency, throughput, and out-of-memory rate. Evaluation sets should cover long-document retrieval, multi-turn dialogue consistency, tool-calling traces, and abnormal inputs, rather than validating only on small-scale short text.

    At the deployment level, general-purpose container platforms can host inference services, object storage can save evaluation sets and log archives, and logging services plus monitoring and alerting can build an observability loop. In a cloud environment, these general-purpose services can support canary releases, A/B evaluation, and rollback mechanisms. Cache optimization must be paired with tenant isolation and sensitive-information management. In prefix reuse scenarios in particular, cache contamination between different sessions must be prevented.

    7. Conclusion

    One of the core threads in recent LLM architecture evolution is reducing runtime cost without significant quality degradation. Cross-layer KV tensor reuse, shared KV Cache, grouped-query attention, low-rank compression, paged management, and sparsification architectures compress memory and bandwidth pressure from different dimensions. The value of cross-layer reuse lies in directly reducing cache replicas along the layer dimension, but it requires training adaptation, quality evaluation, and engineering support. A more feasible future route is likely a combined optimization of “adaptive sharing granularity + compressed cache + paged management + software-hardware co-design,” rather than reliance on a single trick. For developers and enterprises, understanding the cost models and tradeoff logic behind these techniques is essential for designing verifiable, operable, and sustainable inference solutions for long-context and agent applications.