Architecture Evolution of Large Language Models and Key Components Explained
This article explains how large language model architectures have changed and which components matter most. It covers the stable decoder backbone, rotary position embedding (RoPE), attention variants (MHA, MQA, and GQA), gated feed-forward networks such as SwiGLU, normalization and residual design, and sparse mixture-of-experts models. It also presents an analysis framework based on structural constraints, training stability, inference cost, and deployment feasibility, along with an architecture review checklist.
Large language model (LLM) architectures often seem to change a lot while staying much the same. Positional encoding, attention structure, activation functions, normalization, and sparsity schemes keep getting updated. Most models, however, still follow the same basic skeleton: an embedding layer, a stack of decoder layers, and an output head. To tell whether these changes are real breakthroughs or engineering refinements, model size and single benchmark scores are not enough. A better approach is to evaluate them across four dimensions: structural constraints, training stability, inference cost, and deployment feasibility. This article does not discuss specific benchmark results or training recipes. It focuses on common architectural components and the design trade-offs that matter most in current LLM design.
1. Why the Stable Backbone Has Lasted
Mainstream LLMs usually consist of an embedding layer, several decoder layers with identical structure, and an output projection. Each decoder layer contains an attention sublayer, a feed-forward sublayer, normalization, and residual connections. This backbone has lasted because it balances trainability, parallel efficiency, and scalability. Autoregressive modeling requires information to flow in one direction along the sequence, and masked attention enforces this constraint naturally. Residual connections keep gradient propagation stable in deep networks. The placement of normalization determines numerical behavior early in training. The feed-forward network provides most of the parameter capacity and nonlinear transformation.
Architectural changes are valuable when replacing one local component yields better quality, lower inference cost, or stronger long-context capability at the same compute budget. When reviewing a model architecture, start with a parameter ledger. Count the parameters in the embedding matrix, each layer’s attention projections, each layer’s feed-forward network, the normalization parameters, and the output head. Then estimate the compute distribution during training and the memory bandwidth bottleneck during inference. Many structures that look novel actually redistribute the budget between parameter count and memory access costs.
2. Positional Encoding: From Absolute Positions to Relative Rotations
Early methods often used learnable absolute position embeddings or sinusoidal encodings. These added position information directly to token embeddings. They are simple to implement, but they have limits in long-context extrapolation, position interpolation, and modeling relative relationships. Rotary Position Embedding (RoPE) applies a position-dependent rotation to query and key vectors, so attention scores naturally include relative position information. Each pair of vector components is rotated by an angle that depends on position, so the dot product depends on the relative offset between tokens.
RoPE adds no extra position parameters, and it can be combined with frequency scaling, position interpolation, and other strategies to extend context length. Changing the positional encoding alone, however, does not solve long-context problems. Attention compute, key-value cache size, the length distribution of training data, and attention dilution all affect results. In practice, teams need to evaluate extrapolation strategies, attention window design, and long-context training stages together. For architecture review, check whether the positional encoding matches the attention head dimension, how the frequency base is chosen, whether dynamic scaling is supported, and whether attention entropy becomes abnormal at long context lengths.
3. Attention: Multi-Head, Multi-Query, and Grouped-Query
Multi-head attention (MHA) keeps separate query, key, and value projections for each head. It is highly expressive, but its key-value cache grows linearly with the number of heads during inference. Multi-query attention (MQA) lets all query heads share one set of key and value heads. This greatly reduces cache and bandwidth pressure but may lose some expressiveness. Grouped-query attention (GQA) sits between the two. Query heads are divided into groups, and each group shares one key-value head, which offers a good balance between quality and efficiency. A pseudocode abstraction is shown below.
def grouped_attention(x, Wq, Wk, Wv, Wo, num_heads, num_kv_heads, group_size):q = split_heads(x @ Wq, num_heads)k = split_heads(x @ Wk, num_kv_heads)v = split_heads(x @ Wv, num_kv_heads)k = repeat_kv(k, group_size)v = repeat_kv(v, group_size)scores = softmax((q @ k^T) / sqrt(head_dim) + mask)out = scores @ vreturn merge_heads(out) @ Wo
This pseudocode shows the key trade-off. Fewer key-value heads mean a smaller cache and less bandwidth use during decoding. However, each query head can access a smaller key-value subspace. Real designs also consider head dimension, group count, whether query-key normalization is used, and whether sliding-window or sparse attention is combined with the standard attention. For long-context and high-concurrency inference, GQA is often the default choice. For small models or tasks that demand high quality, MHA may still be the better fit. When analyzing architecture, estimate the key-value cache as: number of layers × number of key-value heads × head dimension × sequence length × batch size × bytes per element. This estimate often determines inference throughput more than total parameter count does.
4. Feed-Forward Networks and Activations: The Rise of Gated Linear Units
The feed-forward network in each decoder layer usually holds most of the parameters. Traditional designs use two linear transformations with an activation function such as GELU between them. Gated linear units, such as SwiGLU, use two parallel projections. One passes through an activation function to form a gate, and the other keeps the linear signal. The two outputs are multiplied element by element and then projected back to the model dimension. The pseudocode is shown below.
def swiglu_ffn(x, W1, W3, W2):gate = silu(x @ W1) * (x @ W3)return gate @ W2
Compared with a single activation path, the gated structure adds a projection matrix. The intermediate dimension must therefore be adjusted to keep the parameter budget under control. The potential benefit is more flexible feature selection and nonlinear expressiveness. The cost is more matrix multiplications. During review, check the ratio of intermediate dimension to model dimension, whether biases are used, the numerical stability of the activation function, and the error after quantization. Gated feed-forward networks work best when their size is tuned together with the number of attention heads, the number of layers, and the training budget.
5. Normalization and Residuals: The Hidden Foundation of Stable Training
The type and position of normalization matter a great deal for training deep models. Layer normalization computes the mean and variance across the feature dimension. RMS normalization uses only root-mean-square scaling, which is simpler to compute and is widely used in large models. Pre-Norm places normalization before each sublayer. This keeps the residual path cleaner and makes deep training more stable. Post-Norm can produce different representational behavior, but it is more sensitive to initialization and learning rate. Some models also add normalization to query and key vectors to limit numerical blow-up.
Residual connections involve more than a simple addition. In deep stacks, residual scaling, initialization, and normalization placement together determine signal variance. Architecture review should check whether normalization parameters are shared, whether the embedding layer receives extra normalization, whether residual branches use scaling coefficients, and whether mixed-precision training is prone to overflow. Many training instability problems come from mismatched details in the normalization and residual paths, not from novel components.
6. Sparse Experts: Reallocating Capacity and Cost
Mixture-of-Experts (MoE) models replace a single feed-forward network with multiple expert networks. A router selects a small number of experts for each token. The appeal is larger total parameter capacity, with only part of the parameters activated in each forward pass. This lowers the compute per token. MoE is not free, though. Routing needs load balancing, expert parallelism adds communication overhead, uneven token distribution within a batch wastes expert capacity, and inference requires handling expert caching and dynamic scheduling.
Architecture analysis should focus on the number of experts, the number of experts activated per token, the capacity factor, the routing scoring method, whether shared experts are used, and the load-balancing loss. For deployment, MoE memory use can be much higher than the active parameter count suggests, because all experts must stay resident or be swapped in quickly. In high-concurrency serving, expert-parallel communication and batch scheduling can become bottlenecks. MoE fits best when total capacity needs are high, per-token compute cost matters, and the infrastructure supports efficient parallelism.
7. Reasoning-Enhanced Models: Variables Beyond Architecture
Reasoning-enhanced models have drawn attention in recent years. Their core is usually not a new base architecture. They improve reasoning on the same decoder backbone through post-training, reinforcement learning, test-time compute scaling, and tool use. At the architecture level, long chains of thought significantly increase decoding length, which amplifies key-value cache and attention compute pressure. High-concurrency, low-latency serving requires finer batch scheduling and cache management. Long context and multi-turn reasoning raise memory bandwidth demand. Evaluating a reasoning model therefore requires more than reviewing the structure diagram. The distribution of decoding lengths, the cache strategy, and server-side scheduling also need to be considered.
8. Architecture Review Checklist and Practical Advice
A practical review checklist covers the following points:
- Is the parameter ledger clear, and is the ratio of attention to feed-forward parameters reasonable?
- Does the key-value cache estimate meet the target concurrency and sequence length?
- Do the positional encoding and long-context strategy match the training data distribution?
- Does the attention head configuration balance quality and bandwidth?
- Do the normalization and residual designs
