How Transformer LLM Architectures Evolved from GPT-2 to 2025's Flagship Models

    A detailed look at how modern large language model architectures have evolved over seven years—covering GQA, RoPE, SwiGLU, RMSNorm, and Mixture-of-Experts—and why the overall Transformer skeleton has stayed remarkably stable while component-level innovations drive today's efficiency and scaling gains.

    How Transformer LLM Architectures Evolved from GPT-2 to 2025’s Flagship Models

    Seven Years of Evolution: Why the Architecture “Looks Unchanged”

    Seven years have passed since the early GPT architecture was introduced. Compare GPT-2 from 2019 with the new generation of flagship open-source models from 2024–2025, and the immediate impression is striking: the overall structure is remarkably similar. It’s still an autoregressive Transformer decoder, still trained via next-token prediction, and the core data flow path has barely changed at a fundamental level.

    But “similar” does not mean “stagnant.” Beneath the macro skeleton, component-level innovations have continued to accumulate: positional encoding, attention mechanisms, activation functions, normalization schemes, and expert routing have all undergone significant iteration. Understanding these changes has real practical value for developers evaluating a model’s capability boundaries and making fine-tuning and deployment decisions.

    One caveat: directly comparing model performance is extremely difficult—training data scale, data mixtures, training techniques, and hyperparameter settings vary enormously and are often not fully documented publicly. A more reliable analytical path, therefore, is to look at the architecture itself and observe the shared choices of the technical community. That is the core perspective of this article: architecture evolution only, no benchmark scores.

    From MHA to GQA: The Attention Efficiency Revolution

    The Problem: KV Cache Bottleneck at Inference Time

    In early Multi-Head Attention (MHA), every attention head maintains its own Key and Value cache. During inference, as context length grows, the KV cache becomes a dominant consumer of GPU memory and also constrains throughput. For a model with n layers, h heads, and head dimension d, cache size scales with the number of layers, heads, and sequence length—substantial in long-context scenarios.

    The Evolution Path

    Two optimization routes emerged:

    • Multi-Query Attention (MQA): All query heads share a single set of K/V, compressing the cache to 1/h of its original size, but at the cost of some quality degradation.
    • Grouped-Query Attention (GQA): A compromise—query heads are grouped, with each group sharing one set of K/V. For example, 32 query heads map to 8 K/V groups, reducing cache usage to 1/4 with far less quality loss than MQA.

    In 2025, mainstream flagship open-source models almost universally adopt GQA, making it the de facto standard. A simple illustration of the grouping logic:

    1. Query heads: [Q1 Q2 Q3 Q4] [Q5 Q6 Q7 Q8]
    2. Shared K/V: K/V group 1 K/V group 2

    In addition, some newer models combine local sliding-window attention with global attention: most layers attend only to tokens within a recent window, while a few layers retain full context, further reducing attention overhead for long sequences.

    Positional Encoding: From Absolute Positions to RoPE

    Early GPT models used learnable absolute positional encodings—one trainable vector per position. This approach has two limitations: the maximum sequence length is fixed, and generalization degrades sharply beyond it; and the position vectors have no relative relationship to each other, resulting in poor extrapolation.

    Modern models widely adopt Rotary Position Embedding (RoPE). The core idea is to rotate the query and key vectors in the complex domain, so attention scores naturally depend only on the relative distance between two tokens. RoPE’s advantages:

    1. It supports context length extension via techniques such as position interpolation and NTK scaling;
    2. Relative position information is mathematically more natural, with better long-text extrapolation;
    3. It introduces no additional trainable parameters.

    The combination of RoPE and GQA forms the infrastructure of current long-context capability.

    Activation Functions: From GELU to SwiGLU

    The standard approach in the GPT-2 era was a two-layer feed-forward network: linear projection + GELU activation + linear projection. Modern models have almost all switched to SwiGLU:

    1. SwiGLU(x) = W2 * ( SiLU(W1 * x) ⊙ (W3 * x) )

    Its key difference from a standard FFN is the gating mechanism: one branch, after SiLU activation, is multiplied element-wise with the other branch, letting the network dynamically control how much information passes through. Empirically, SwiGLU typically delivers better results at the same parameter budget. To keep total parameter count constant, models using SwiGLU generally shrink the FFN hidden dimension by about one third.

    Normalization and Residual Structure: Details That Ensure Stability

    • RMSNorm replaces LayerNorm: Mean centering is removed, keeping only variance normalization—lighter to compute, more stable in training. The mainstream choice is Pre-Norm (normalizing before each sub-layer), combined with residual connections to keep deep networks trainable.
    • Adjusted normalization placement: Some newer models add an extra normalization after the Q and K projections, known as QK-Norm, to suppress training instability caused by overly large attention logits—increasingly common in larger-scale models.
    • Removed bias terms: Modern models mostly drop bias parameters from linear layers, reducing parameter count and simplifying implementation with virtually no loss in quality.

    Mixture-of-Experts: Trading Conditional Computation for Scale

    MoE (Mixture-of-Experts) is one of the most important architecture-level innovations in recent years. The idea is to replace the FFN layer with multiple “expert” FFNs, where a router activates only a few experts per token (e.g., 2 out of 8 experts, or 8 out of 256 in large-scale models).

    Take a typical modern MoE flagship model: total parameters can reach hundreds of billions, yet each token activates only about one tenth of them, giving inference costs close to a far smaller dense model. The trade-offs of MoE include:

    • Benefits: Dramatically expands model knowledge capacity without increasing per-inference compute;
    • Costs: All expert parameters must reside in GPU/system memory, raising deployment resource requirements; training requires auxiliary load-balancing losses to prevent routing from collapsing onto a few experts;
    • Engineering practice: Some dense layers are typically retained (e.g., the first few layers don’t use MoE), and shared experts capture common knowledge.
    1. Position-free encoding experiments: Some models have tried a NoPE approach, implicitly obtaining positional information from the causal mask, showing that RoPE is not the only path.
    2. Sliding-window + global hybrid: Layered attention designs balance long-context capability against compute.
    3. Multi-token prediction training objectives: Predicting multiple future tokens at once increases training signal density and can also be used for inference acceleration.
    4. Reasoning-oriented architecture adaptation: Models built for enhanced reasoning share the same architecture as their base models; capability gains come mainly from the training pipeline—reinforcing the “stable architecture, training innovation” thesis.

    Conclusion: Incremental Innovation Within a Stable Architecture

    Looking across 2025’s flagship open-source models, one conclusion stands out: the Transformer decoder skeleton has entered a steady state, and real progress now comes from component-level efficiency optimizations and scaling strategies—GQA solves the memory bottleneck, RoPE enables long context, SwiGLU improves expressive efficiency, and MoE breaks through the tension between parameters and compute. For developers, understanding the motivations and trade-offs behind these designs is more valuable than memorizing model names: whether you’re evaluating model selection or performing localized deployment and fine-tuning on cloud-hosted containers and GPU resources, this architectural knowledge is the foundation for sound decisions.