LLM Architecture Trends: How Cross-Layer KV Cache Reuse and MoE Design Reduce Inference Costs

    As context windows grow, KV Cache memory has replaced model size as the main inference bottleneck. This article examines two representative architectural trends in recent open-weight models: cross-layer reuse of KV tensors, which cuts memory along the layer dimension, and the division of labor between Mixture-of-Experts and dense architectures, which lets teams match model design to deployment scenarios. It also offers practical guidance for engineers on memory budgeting, model selection, inference framework compatibility, and quality regression testing.

    1. Background: Where Does the Memory Bottleneck in LLM Inference Come From?

    As the context windows of large language models keep growing, the primary inference bottleneck has gradually shifted from “how large the model parameters are” to “how large the KV Cache is.” The autoregressive decoding mechanism of the Transformer dictates that when generating each new token, the attention mechanism must access the Key and Value states produced by all previous tokens at every layer. Assuming a model has L layers, attention head dimension d, sequence length N, and batch size B, the memory footprint of the KV Cache is approximately:

    1. KV Cache memory ≈ 2 × L × N × B × n_heads × head_dim × dtype_bytes

    For a typical model with several billion parameters, at 32K context length and fp16 precision, the KV Cache footprint is often several times larger than the model weights themselves. This creates three kinds of pressure:

    1. Memory capacity pressure: In long-context scenarios, the KV Cache can consume the memory of a single GPU or even multiple GPUs, sharply reducing the available batch size and directly hurting throughput.
    2. Bandwidth pressure: During decoding, generating each token requires reading the entire KV Cache, making memory bandwidth the dominant source of latency.
    3. Edge deployment pressure: On phones, edge devices, and IoT hardware where memory budgets are extremely tight, KV Cache growth directly determines whether a model can run on-device at all.

    For these reasons, recent generations of open-weight models have focused their architectural design on “how to compress the KV Cache” and “how to trade less activated compute for greater model capacity.” This article examines the two most representative directions.

    2. Direction 1: Reusing KV Tensors Across Layers

    2.1 Core Idea

    In a traditional Transformer, every layer has its own self-attention module, each maintaining a separate set of Key/Value states. Researchers have observed, however, that the attention patterns of adjacent layers (especially deeper layers) are highly similar—attention distributions across many deep layers converge significantly. This suggests that computing and storing KV states independently at every layer may be redundant.

    The idea of cross-layer reuse (Cross-Layer Attention, or inter-layer KV sharing) is to let later layers skip computing their own Key/Value from scratch and instead directly reuse the KV states already computed by an earlier layer (or several earlier layers). As a result:

    • Storage: The layer dimension of the KV Cache shrinks from L to L/k (where k is the sharing interval or group size), and memory usage drops roughly linearly.
    • Computation: Layers that share KV states no longer need to execute the KV projection, reducing forward computation as well.

    2.2 Relationship with Existing Optimization Techniques

    Cross-layer reuse is not an isolated technique; it can be combined with several existing classes of KV Cache compression methods:

    Method Compression Dimension Typical Approach
    Grouped-Query Attention Head dimension Multiple query heads share one set of KV heads
    Quantization Precision dimension KV Cache stored in int8/int4
    Sliding window / sparse attention Sequence length dimension Keep KV only for local or critical tokens
    Cross-layer reuse Layer dimension Later layers reuse KV states from earlier layers

    These four classes of methods operate on different tensor dimensions and can, in theory, be stacked. Cross-layer reuse fills in the “layer” dimension, which had previously seen little large-scale exploration, making it a highlight of recent architectural evolution.

    2.3 Academic Origins and Engineering Adoption

    This line of thinking has a clear lineage in academia. For example, a NeurIPS 2024 paper systematically proposed Cross-Layer Attention to reduce KV Cache size, with experiments demonstrating significant cache savings while maintaining quality. Its adoption by recent generations of open-weight models marks the transition of this idea from “experimental technique in a paper” to “mainstream production architecture.” That is its real significance: an optimization only becomes truly engineering-ready when it is adopted by large-scale open-source models and validated through broad community adaptation in inference frameworks and evaluations.

    2.4 Engineering Considerations for Adoption

    Supporting cross-layer reuse in an inference system typically requires attention to the following:

    1. # Pseudocode: inference logic for cross-layer KV reuse
    2. kv_cache = {} # storage allocated only for "anchor layers"
    3. for layer_id in range(num_layers):
    4. if layer_id in anchor_layers:
    5. k, v = compute_kv(layer_id, x) # actually compute and cache
    6. kv_cache[layer_id] = (k, v)
    7. else:
    8. k, v = kv_cache[shared_source[layer_id]] # reuse earlier layer's result
    9. x = x + attention(x, k, v)
    10. x = x + ffn(x)
    1. Inference framework adaptation: Mainstream inference engines manage paged caches (PagedAttention-style) by allocating physical blocks independently per layer. Cross-layer sharing requires reference counting or shared-block mechanisms; otherwise, the memory savings cannot actually materialize.
    2. Quality regression validation: The sharing ratio (how many layers share one set of KV) is a hyperparameter that requires thorough regression testing on tasks such as long-context retrieval, code generation, and multi-turn dialogue—avoiding the pitfall of “saving memory but losing recall.”
    3. Compatibility with speculative decoding and prefix caching: Cross-layer reuse changes how KV is organized, so combining it with other acceleration techniques that depend on the KV structure requires redesigning cache-hit logic.

    3. Direction 2: The Division of Labor Between MoE and Dense Architectures

    3.1 The Benefits and Costs of MoE

    Another notable trend is that mid-sized models increasingly adopt the Mixture-of-Experts (MoE) architecture. MoE replaces the feed-forward layer with multiple “expert” sub-networks, and a router dynamically selects a small number of experts to activate for each token. This allows a large total parameter count while keeping the actual compute per token low—striking a balance of “large capacity, cheap per-step compute.”

    However, MoE also carries clear engineering costs:

    1. Harder post-training: Router load balancing requires additional auxiliary losses, making training more prone to instability; shifts in expert utilization during fine-tuning can also cause performance fluctuations.
    2. No memory savings: All expert parameters must remain resident in memory, which is actually unfriendly for edge and memory-constrained scenarios.
    3. More complex inference systems: Expert parallelism, all-to-all communication, and load imbalance across dynamic batches all place higher demands on inference scheduling.

    3.2 The Differentiated Positioning of Dense Architectures

    Precisely because of these MoE costs, newly released model families generally follow a “dual-track product matrix” strategy:

    • On-device/embedded small models: Use dense architectures with very small parameter counts (typically in the single-digit billions), combined with techniques like cross-layer KV reuse to compress memory—prioritizing “it runs, and latency is manageable.”
    • Mid-sized models for efficient local inference: Use MoE, pursuing larger effective capacity at low per-step cost on consumer GPUs or single-machine setups.
    • Post-training-friendly models targeting quality: Remain dense with somewhat larger parameter counts, because post-training pipelines for dense models (SFT, RLHF, etc.) are more mature and stable, making it easier for downstream teams to do domain fine-tuning and alignment.

    This “choose the architecture based on the deployment scenario” mindset essentially acknowledges an engineering reality: no single architecture can simultaneously optimize training efficiency, inference cost, memory footprint, and on-device feasibility. Differentiated architectural choices are therefore needed for different deployment form factors.

    4. Implications for Engineering Practitioners

    Combining the two evolutionary directions above, here are several actionable suggestions for teams working on LLM deployment:

    1. When evaluating long-context solutions, treat KV Cache memory as a separate budget item rather than looking only at parameter count. Combinations of cross-layer reuse, GQA, and quantization can often compress memory requirements at the same context length by several times.
    2. Match model selection to the deployment form factor: For edge deployment, prioritize small dense models plus KV compression; for single-machine multi-GPU throughput, consider MoE; for teams that need deep domain fine-tuning, the post-training stability of dense architectures deserves priority.
    3. Verify the capability matrix of your inference framework in advance: New architectural features (cross-layer KV sharing, new attention variants) typically lag between paper publication and inference engine support. When selecting a model, confirm whether your inference service or self-built inference stack already supports them.
    4. Establish a quality regression baseline: Any KV compression technique can introduce degradation on tasks like long-document retrieval and multi-hop reasoning. Conduct systematic evaluations on your own business data before going live.

    5. Conclusion

    The recent evolution of LLM architectures sends a clear signal: the focus of competition is shifting from “stacking parameters and context length” to “using architectural innovation to compress inference costs.” Cross-layer KV reuse unlocks redundancy along the layer dimension, providing a new memory-optimization lever for long-context and on-device deployment. The division of labor between MoE and dense architectures, meanwhile, reflects a mature engineering mindset of scenario-based selection. For developers, understanding the motivations and trade-offs behind these designs has more long-term value than chasing specific model versions—because these mechanisms (KV sharing, expert routing, layered caching) will very likely appear in various combinations across future models and inference platforms, becoming standard capabilities of LLM infrastructure.