LLM Architecture Evolution: From KV Cache Reuse to Sparse Mixture-of-Experts

    As large language models grow in parameter count and context length, memory and compute costs during inference have become the primary deployment bottleneck. This article examines recent architectural advances from three angles: cross-layer KV cache reuse, sparse mixture-of-experts (MoE) routing improvements, and hybrid dense-sparse designs, along with supporting techniques for long-context inputs such as positional encoding evolution and cache quantization. It also outlines where these trends are heading and offers practical guidance for choosing the right architecture based on memory constraints, throughput needs, and quality requirements.

    1. Background: Inference Bottlenecks and the Drive for Architectural Innovation

    As large language models (LLMs) scale up in parameter count and context length, GPU memory usage and compute cost during inference have become the primary deployment bottlenecks. The KV (key-value) cache plays a central role in autoregressive decoding—it stores the key and value vectors for already generated tokens so they don’t have to be recomputed. However, cache size scales with sequence length, layer count, and number of attention heads. In long-context scenarios, it can quickly fill available memory and drag down throughput. As a result, compressing, reusing, and sharing the KV cache has become a hot topic in recent architecture evolution.

    At the same time, approaches to scaling model size have diverged: dense models (where every token activates all parameters) versus sparse mixture-of-experts (MoE) models (where routing activates only a subset of parameters). This trade-off directly affects training efficiency, inference speed, and post-training complexity. Drawing on technical developments from the past six months, this article analyzes architectural progress across three dimensions: cross-layer KV reuse, expert routing optimization, and dense/sparse hybrid designs. These are not isolated techniques—they are interconnected, all pointing toward the same goals: lower memory usage, faster inference, and easier adaptation.

    2. Cross-Layer KV Reuse: A New Paradigm for Cache Compression

    2.1 The Redundancy Problem in Traditional KV Caches

    In a standard Transformer decoder, every layer’s attention heads maintain their own key and value matrices. For example, consider a model with 30 layers, 32 heads, and a per-head dimension of 128. Generating 1K tokens, the KV cache footprint is roughly:

    2 (K and V) × 30 layers × 32 heads × 128 dims × 1K tokens × 2 bytes (half precision) ≈ 120 MB

    As the sequence grows to the million-token scale, the cache can consume tens of gigabytes, directly capping the maximum context length the model can handle.

    Research has shown, however, that attention patterns across different layers are highly similar—deeper layers often reuse semantic information extracted by lower layers. Forcing every layer to store its own keys and values therefore produces substantial redundant computation and storage. This provides the theoretical basis for cross-layer KV sharing.

    2.2 How Sharing and Reuse Work

    Recent lightweight model families designed for mobile and embedded scenarios have adopted “shared KV cache” designs. The core idea: later layers no longer compute their own keys and values independently, but instead reuse KV states already computed by an earlier layer (or layers). Two common implementation patterns exist:

    • Contiguous sharing: The model is split into groups, and layers within each group share the same KV cache. For example, layers 1–5 each compute their own KV, layers 6–10 reuse the KV from layer 5, and so on. Memory usage is divided by the number of layers per group.
    • Cross-layer skip reuse: Deeper attention layers directly reference the KV of shallower layers. The shapes stay identical, and only a lightweight linear transformation (such as a small projection matrix) is applied to align the semantic spaces.

    As an example, a lightweight model family’s ultra-small “E series” reduces KV cache footprint by roughly 40% to 60% through sharing, enabling longer contexts on devices with only a few gigabytes of memory (extending from 2K to 8K tokens). Because it also cuts the number of matrix multiplications, inference latency improves as well.

    2.3 Costs and Trade-offs

    Sharing KV is not a free lunch. First, semantic differences between layers can reduce representational capacity, especially for tasks that depend on capturing fine-grained local detail, such as code generation and mathematical reasoning. Second, during backpropagation, gradients must flow through the shared path, increasing training complexity. To mitigate these issues, designers typically add adaptation modules after shared layers and use two-stage training (pretraining the shared structure first, then fine-tuning a small number of layers). In practice, at mid-range scales (2B–5B parameters), the memory savings from shared KV far outweigh the accuracy loss, making it particularly well suited for long-document comprehension and summarization tasks.

    3. Mixture-of-Experts: Balancing Efficiency and Quality Through Sparsity

    3.1 Why Mixture-of-Experts Matters

    At a fixed parameter count, dense LLMs activate all weights for every token, so compute grows linearly with model size. MoE models split the network into multiple “expert” subnetworks and use a router to select only a few experts per token, achieving the effect of “more parameters without more compute.” For example, a 100B-parameter MoE model might activate only 10B parameters per token, giving inference costs close to a 10B dense model while offering far greater model capacity.

    However, MoE introduces three pain points: unstable routing, low training efficiency, and difficult post-processing (such as instruction fine-tuning). Expert activation patterns are unevenly distributed, which easily leads to “dead experts” that are never selected. Meanwhile, full-parameter updates during fine-tuning can break routing balance.

    3.2 Recent Architectural Improvements

    3.2.1 Grouped Fine-Grained Routing

    Traditional MoE uses Top-2 or Top-4 routing, where each token selects two or four experts. To improve expert utilization, newer schemes introduce “fine-grained experts”—increasing the number of experts while making each one smaller, and having each token activate more of them (for example, Top-8). This raises the probability that each expert gets selected and reduces parameter waste. For instance, a 26B-scale model with 64 fine-grained experts activating 8 per token yields roughly 6.5B effective parameters, yet its expressive capacity approaches that of a 26B dense model.

    3.2.2 Auxiliary Losses and Dynamic Balancing

    To prevent routing collapse, most implementations add an auxiliary loss during training (such as a load-balancing loss) that penalizes overly concentrated routing distributions. Recent architectures further refine auxiliary loss scheduling: the auxiliary loss weight is set higher early in training to quickly establish uniform routing, then gradually reduced so the model can learn more meaningful specialization on its own. They also adopt dynamic adjustment of “expert capacity”—the maximum number of tokens each expert can process—allowing overloaded experts to spill tokens into a shared layer rather than forcing them to be dropped.

    3.3 The Dense and Sparse “Dual-Track” Approach

    Notably, MoE is not the right fit for every scenario. Dense models cost more to run at the same parameter count, but their post-training pipelines are simpler, compatibility is stronger, and they avoid the hidden latency overhead of routing. Consequently, some model families release both a sparse and a dense version: the sparse version targets cost-efficient inference, while the dense version targets maximum quality and fast iteration. This dual-track design reflects the industry’s awareness of the trade-off between efficiency ratios and generality.

    4. Further Optimizations for Long-Context Inputs

    4.1 The Evolution of Positional Encoding

    Beyond the KV cache, long-context capability also depends on positional encoding. Traditional absolute positional encodings (such as sinusoidal encodings) extrapolate poorly. Relative positional encodings (such as rotary position embeddings, RoPE) and “linear scaling” techniques—stretching position indices at inference time to support sequences longer than the training length—have become popular recently. But all of these introduce accuracy fluctuations. More advanced architectures are therefore exploring “anchor positions” or “dual-layer positional encoding,” which separate short-range local positions from long-range global positions and combine them in computation.

    4.2 Cache Compression and Quantization

    Cross-layer reuse is a structural form of compression; another path is numerical compression. Quantizing the KV cache from FP16 down to INT8 or INT4 significantly reduces memory usage, though it requires activation-aware quantization calibration. Newer architectures also adopt “peeking caches” (caching only part of the key dimensions while caching all of the value dimensions) and “block-wise caching” strategies combined with retrieval-based sparse attention, so the model only accesses the portions of prior context highly relevant to the current token. These techniques can be stacked on top of shared KV for further compression.

    Taken together, recent LLM architecture evolution is not following a single direction but converging along three fronts:

    1. Smarter caching: Moving from “independent cache per layer” to combinations of “cross-layer reuse + quantization + sparse retrieval,” with the goal of decoupling cache size from sequence length—or even achieving sublinear growth.
    2. Parameter sparsification: MoE continues to improve routing efficiency and expert utilization, while “half-MoE” structures are being explored (for example, applying experts only to feed-forward layers while keeping attention dense), reducing engineering complexity.
    3. Training-inference co-design: Architecture design is shifting from post-training compression to “considering inference efficiency during training itself”—for example, introducing shared KV constraints at the pretraining stage so the model actively adapts to the reuse mechanism.

    Behind these innovations is an industry shift from “big and comprehensive” to “smart and precise.” For developers, understanding the underlying logic of these architectures helps make the right deployment choices: if memory is tight and you need to support very long documents, prioritize models with cache reuse and quantization support; if you need high throughput and can tolerate some accuracy loss, fine-grained MoE routing offers better cost efficiency; and dense models remain the best starting point for rapid prototyping and fine-grained tuning.

    Looking ahead, as hardware (such as accelerators purpose-built for sparse computation) and software (such as dynamic compilers) evolve in tandem, architectural innovation will become increasingly coupled with the underlying system stack. We can expect a new generation of LLMs whose cache footprint barely grows with context length and whose routing overhead is negligible—opening the door to truly unlimited context. Understanding today’s evolutionary trajectory is the ticket to tomorrow’s breakthroughs.