From GPT to 2025 Flagship Models: How LLM Architectures Have Evolved
This article reviews the architectural evolution of large language models from GPT-2 in 2019 to flagship open models in 2024–2025. It explains why the decoder-only Transformer backbone has remained stable while key components—positional encoding, attention efficiency, feed-forward layers, normalization, and inference-time optimizations—have changed, and it examines the engineering trade-offs behind GQA, RoPE, SwiGLU, MoE, RMSNorm, Pre-LN, MTP, and speculative decoding.
1. Has LLM Architecture Changed After All These Years?
From GPT-2 in 2019 to flagship open models in 2024–2025, the Transformer decoder skeleton looks almost unchanged at first glance: an embedding layer, a number of Transformer blocks with residual connections, and a final layer normalization plus linear output head. This apparent stability itself sends an important signal: after large-scale validation by industry and academia, the pure decoder-only architecture with an autoregressive objective has become the optimal foundation for text generation tasks, and it is unlikely to be displaced in the short term.
But the evolution in the details has been deep and systematic. In summary, improvements over the past few years have concentrated on four dimensions:
- Positional encoding: from learnable absolute positional encoding to rotary position embedding (RoPE);
- Attention efficiency: Multi-Head Attention (MHA) has largely given way to Grouped-Query Attention (GQA) or Multi-Head Latent Attention-style approaches;
- Feed-forward network: GELU activation has been replaced by SwiGLU, and FFN layers have been replaced by sparse MoE structures;
- Normalization: LayerNorm has evolved into RMSNorm, and its position has moved from Post-LN to Pre-LN.
Understanding the motivation behind these changes is more important than remembering “what was used.” The following sections examine each one.
2. The Efficiency Revolution in Attention
2.1 Why GQA?
In MHA, each attention head maintains independent Key and Value projections. During inference, the KV cache grows linearly with context length and becomes a memory bottleneck. GQA lets multiple Query heads share one set of KV heads—for example, 32 Q heads and 8 KV heads—reducing the KV cache directly to one quarter of its original size, usually with very little loss in model quality.
From an implementation perspective, the change is only in the projection matrix dimensions:
# MHA: num_kv_heads == num_headsk = W_k(x) # [batch, seq, num_heads, head_dim]# GQA: num_kv_heads < num_heads, align with repeat_interleavek = W_k(x) # [batch, seq, num_kv_heads, head_dim]k = k.repeat_interleave(num_heads // num_kv_heads, dim=2)
In addition, some newer models further introduce a layered design that alternates sliding-window attention and global attention: a few layers handle long-range dependencies (global), while most layers only look at local windows (sparse), significantly reducing computation and cache overhead in very long-context scenarios.
2.2 Another Path for KV Cache Compression
Besides reducing the number of KV heads, the industry is also exploring low-rank compression of the KV itself: jointly projecting Key and Value into a low-dimensional latent space for caching, then decompressing them when used. This route can compress the KV cache by an order of magnitude, at the cost of an additional projection computation and a small accuracy loss, reflecting a different trade-off of trading memory for compute.
3. Positional Encoding: Why RoPE Became Standard
Absolute positional encoding cannot extrapolate beyond the training length and lacks translation invariance for relative positions. RoPE applies rotation transformations to Query and Key vectors according to position, so attention scores naturally depend only on relative position differences. With interpolation techniques such as NTK-aware scaling and YaRN, the context window can be extended relatively smoothly.
For developers, one hidden advantage of RoPE is that it is engineering-friendly: it is a purely functional transformation, introduces no learnable parameters, is simple to implement in both training and inference, and is highly compatible with chunked computation paradigms such as FlashAttention.
4. Two Upgrades to FFN: SwiGLU and MoE
4.1 SwiGLU
After the gated linear unit idea was introduced into FFN, two parallel projections are used for element-wise gated multiplication:
def swiglu_ffn(x, W_gate, W_up, W_down):return (silu(x @ W_gate) * (x @ W_up)) @ W_down
A large body of experiments shows that under the same parameter budget, SwiGLU outperforms ReLU/GELU-based FFNs. This is now an almost consistent choice across all new models.
4.2 MoE: The Path to Scaling with Sparse Activation
Mixture of Experts (MoE) is the technique that has most widened the model-scale gap in recent years. Its core idea is to replace a single large FFN with N expert FFNs, with each token routed by a router (Top-K, usually a small ratio such as K=8/64) to activate a small number of experts:
- Total parameter count can reach hundreds of billions or even trillions;
- Per-token computation corresponds only to the activated parameter count, so inference cost is similar to that of a much smaller dense model.
The main engineering challenges brought by MoE include expert load imbalance (often mitigated with auxiliary losses or auxiliary-loss-free routing strategies), high memory usage (all experts must remain resident), and training stability. The introduction of shared experts—letting some experts remain always active to carry general knowledge—is also a common improvement in recent MoE designs.
5. Normalization and Stability Details
RMSNorm removes mean centering and performs only variance normalization, requiring less computation while achieving results comparable to LayerNorm. It has become standard. The Pre-LN structure (normalization placed inside the residual branch rather than outside) greatly improves the training stability of deep networks, enabling stable training of Transformers with more than one hundred layers. Some models also introduce an additional normalization before the output head to stabilize the logits distribution and mitigate loss spikes in the late stage of training.
6. Structural Optimizations at Inference Time
Architecture evolution does not stop at training:
- Multi-token prediction (MTP): during training, the model is asked to predict multiple future tokens simultaneously; during inference, the later heads can be used for speculative draft generation to accelerate decoding;
- Speculative decoding: a small model or multi-token head drafts, and the large model verifies in parallel, improving throughput while keeping the output distribution unchanged;
- Hybrid attention layout: local windows and global attention are interleaved, balancing long context and inference cost.
7. Summary and Outlook
Overall, the architectural evolution of 2025 flagship models follows a clear path of “efficiency engineering on a stable backbone”: on the attention side, KV cache is compressed; on the FFN side, sparsity is used to expand capacity; and on the training and inference side, methods such as MTP and speculative decoding are used to improve throughput. A truly breakthrough structural change has not yet appeared, but it is precisely these continuously refined details that form the underlying driver of model capability and cost curves moving steadily downward. For engineers, understanding the motivation and trade-offs of each component is more valuable in the long term than chasing the metrics of any single model.
