Open-Source LLM Architecture Evolution: Attention, Optimizers, and System Co-Design

    This article examines the evolving architecture and training methods of open-source large language models, focusing on the growing interdependence between attention mechanisms, optimizers, and system-level implementation. It explores key design choices including MHA, MQA, GQA, and MLA, the emergence of orthogonalized optimizers like Muon, and the practical challenges of training stability and distributed deployment. The discussion spans algorithmic trade-offs, low-level kernel complexity, inference costs, and deployment considerations, distinguishing between publicly documented findings and claims that require further verification.

    The architecture and training methodologies of open-source large language models continue to evolve rapidly. As model parameters scale from tens of billions toward the trillion range, the dependency between attention structures, optimizers, and low-level operators has become significantly tighter. Gains from optimizing a single component are often offset by system-level bottlenecks, meaning that any discussion of model evolution must simultaneously consider algorithms, training frameworks, and inference deployment. This article examines these changes across six dimensions—attention mechanisms, optimizers, training stability, low-level implementation, inference cost, and deployment checks—while distinguishing between publicly documented facts and claims that still require verification.

    Attention Mechanisms: Trade-offs among MHA, MQA, GQA, and MLA

    In standard multi-head attention (MHA), each query head has its own independent Key and Value projections. During inference, the size of the KV Cache scales proportionally with the number of heads, which significantly increases memory pressure as sequence length grows.

    Multi-query attention (MQA), introduced by Shazeer in 2019, shares a single set of Keys and Values across all query heads. This reduces the KV Cache to approximately 1/head_count of MHA’s size, lowering memory access pressure, though model quality may suffer as a result. Grouped query attention (GQA) strikes a middle ground by partitioning query heads into groups, with each group sharing one set of Keys and Values. GQA balances quality and memory usage and has been adopted by several open-source models.

    Multi-head latent attention (MLA), proposed in the DeepSeek-V2 technical report, compresses Keys and Values into low-dimensional latent vectors for caching, then reconstructs them during inference. This approach achieves a favorable balance between memory footprint and model quality, but it introduces greater implementation complexity and requires additional computation.

    It would be inaccurate to claim that the industry has converged exclusively on MLA or that all models are shifting to MQA. The attention structure adopted by a specific model should be verified against its own technical report. When a report indicates that a model has transitioned from MLA to MQA or GQA, the stated motivations typically fall into three categories: reducing the byte size of the KV Cache, simplifying kernel implementation complexity, and decreasing communication and data replication overhead under tensor parallelism. These motivations must be evaluated alongside the model’s ablation studies and benchmark results.

    Tensor parallelism is a detail that is often overlooked. When the parallelism degree exceeds the number of KV heads, Keys and Values must be replicated across multiple GPUs, which partially negates the memory savings. Therefore, parallelism strategy should be factored into architectural selections.

    Optimizers: From AdamW to Orthogonalized Updates

    AdamW remains the default optimizer for most large model training runs. It maintains first-order and second-order momentum for each parameter, offering straightforward implementation and well-established hyperparameters through years of validation.

    In recent years, the Muon optimizer, based on momentum orthogonalization, has attracted growing attention. Muon was publicly introduced by Keller Jordan in 2024. It applies approximate orthogonalization to the momentum updates of two-dimensional weight matrices, typically using Newton-Schulz iterations. This processing makes update magnitudes more uniform across different directions, reducing the dominance of a few directions during optimization. Public reports have disclosed the use of Muon or its variants in larger-scale training runs, but reported benefits are inconsistent across different reports. Each claim should be assessed against its specific comparative experiments rather than being directly applied.

    When deploying optimizers at scale, three main categories of issues typically emerge:

    1. Numerical stability: Newton-Schulz iterations can accumulate errors under low-precision formats such as bf16, requiring careful control over iteration counts and normalization methods.
    2. Distributed synchronization: Orthogonalization requires access to the complete matrix, but parameters are typically partitioned across multiple GPUs. Collecting full matrices across devices adds communication overhead, while approximation methods may compromise effectiveness.
    3. Computational cost: Each step introduces additional matrix iterations, requiring comparison between training throughput changes and the number of steps needed for convergence.

    Additionally, learning rates tuned for AdamW do not necessarily transfer directly to new optimizers. Switching optimizers generally requires re-running hyperparameter search.

    Training Stability: Residual Connections, Normalization, and Attention Logits Control

    Training stability in deep networks relies primarily on residual connections and normalization layers. The Pre-LN structure is generally considered more stable than Post-LN, as normalization applied before the residual branch prevents activation magnitudes from growing unboundedly across layers. This design choice reduces sensitivity to learning rate variations and helps maintain stable gradient flow during training. Beyond layer placement, controlling the scale of attention logits is equally important—unbounded logits can push softmax outputs into saturated regions, slowing convergence or causing training divergence. Common practices include scaling attention scores and, in some implementations, introducing auxiliary loss terms that penalize extreme logit values. These stability mechanisms form the foundation that allows the aforementioned architectural innovations to be trained reliably at scale.

    Low-Level Implementation: Operator Fusion and Kernel Efficiency

    The gap between algorithmic design and achievable hardware utilization is bridged by low-level kernel implementations. FlashAttention and similar memory-efficient attention kernels reduce the memory footprint of attention computation by avoiding materialization of the full attention matrix, instead computing attention outputs in a tiled fashion. Operator fusion—combining multiple operations into a single kernel launch—reduces kernel launch overhead and memory traffic between GPU global memory and registers. In practice, these techniques interact directly with the attention mechanism choice: GQA and MLA are partly motivated by kernel efficiency, as they reduce the amount of data movement during decoding. The standard approach is to profile kernel-level bottlenecks before deciding whether algorithmic changes or implementation optimizations will yield the greater end-to-end improvement.

    Inference Cost and Deployment Checks

    Inference cost is determined by both algorithmic characteristics and implementation efficiency. KV Cache size directly affects the memory ceiling for batch size during serving—smaller caches allow larger batches and higher throughput. The choice of attention mechanism also affects time-to-first-token for long prompts and decode throughput. Deployment considerations include inter-node communication patterns in tensor parallelism, which can dominate latency at scale. Deployment often requires empirical checking: measuring end-to-end latency across sequence lengths, monitoring memory utilization across GPUs, and validating that optimizations hold across different hardware generations. The interaction between algorithm and system is bidirectional—architecture choices constrain system design, while system capabilities enable or restrict algorithmic possibilities. Given the pace of change in both algorithm research and hardware evolution, models should be regularly re-evaluated under realistic deployment conditions rather than assumed optimal based on static benchmarks.