Large Language Model Architecture Evolution in 2025: A Complete Overview
This article maps how large language model architectures evolved through 2025, showing that the overall topology has stayed stable while operator implementations and system-level co-design have advanced aggressively. It walks through positional encoding from absolute to relative to RoPE with length extrapolation, attention optimizations such as GQA, cross-layer KV sharing and sparse attention, feed-forward and normalization choices, fine-grained expert sparsity with token routing, training stability and inference cost, and closes with an actionable selection checklist for engineering teams.
1. The Seven-Year Question: Why the Structure Still Looks the Same
Roughly seven years have passed since the first autoregressive decoder architectures were published. Put an early 2019 baseline model next to a new 2024–2025 model on the same structural diagram and you get a slightly counterintuitive result: the overall skeleton has barely changed. It is still a stacked design of “token embeddings + several stacked transformer blocks + an output head,” and inside each block the order is still “normalization — attention — residual — normalization — feed-forward — residual.”
What actually changed is the internal implementation of each component and the system-level co-design around them. The evolution of this period can be summarized in one sentence: the topology has stabilized, while operator implementations and system co-design keep pushing aggressively. Understanding this matters more than memorizing a handful of acronyms, because it determines where engineering effort pays off. Spending your budget on replacing the overall structure usually yields limited returns, while optimizing operators, parallelism strategies, and numerical precision often delivers multiplicative end-to-end gains.
2. Positional Encoding: From Absolute to Relative to Extrapolatable
Attention itself is permutation-equivariant, so positional information must be injected from outside. The evolution has gone through roughly three stages:
- Absolute positional encoding: position is added directly to the embeddings as a learnable or sinusoidal vector. Simple to implement, but weak at extrapolation, with performance degrading sharply on sequences longer than the training length.
- Relative position bias: a bias term related to relative distance is added on top of the attention score matrix. Extrapolation improves, but it introduces extra memory and operator overhead.
- Rotary position embedding (RoPE): applying a position-dependent rotation to query and key vectors makes the inner product naturally depend only on relative distance. It adds no extra parameters and is compatible with linear attention, which makes it the de facto mainstream choice today.
What really deserves engineering attention is length extrapolation. Common approaches include adjusting the rotary base frequency (interpolating on low-frequency dimensions so long-range positions are “seen at a finer granularity”), position interpolation (linearly compressing indices beyond the training length back into the existing range), and hybrid schemes that apply different scaling strategies per frequency band. All three share the same idea: instead of forcing the model to guess at position indices it has never seen, map the new lengths back into a representation space that training already covered thoroughly.
# Illustration: the core idea of RoPE (not a specific implementation)def rope(x, theta_base=10000.0):# x: [batch, heads, seq, dim], dim must be evenhalf = x.shape[-1] // 2freq = theta_base ** (-torch.arange(0, half) / half)pos = torch.arange(x.shape[-2])ang = pos[:, None] * freq[None, :] # [seq, half]cos, sin = ang.cos(), ang.sin()x1, x2 = x[..., :half], x[..., half:]return torch.cat([x1 * cos - x2 * sin,x1 * sin + x2 * cos], dim=-1)
3. Attention: From Multi-Head to Grouped-Query and Cross-Layer Sharing
The bottleneck during decoding is not compute but memory bandwidth: every generated token requires re-reading the ever-growing key-value cache. Around this constraint, three optimization lines have emerged in attention.
- Grouped-query attention (GQA): multiple query heads share one set of key-value heads, so the KV cache shrinks in proportion to the sharing ratio while quality loss usually stays manageable. It is a compromise between multi-head and multi-query attention and is now widely adopted.
- Cross-layer key-value sharing: letting several adjacent layers reuse the same key-value projections yields a larger compression factor, but it demands redundancy between layers.
- Sparse and sliding-window attention: replacing global attention with a local window plus a few global tokens brings complexity down from quadratic to near-linear, at the cost of needing an extra mechanism so long-range information can propagate gradually through stacked layers.
The selection guidance is straightforward: if the serving scenario is mainly long context with high-concurrency decoding, prioritize reducing the KV cache; if the task depends heavily on precise long-range retrieval, evaluate the recall loss from sparsification carefully.
4. Feed-Forward Networks and Normalization: Steady Gains in the Details
The feed-forward sublayer usually accounts for the bulk of the parameters. Gated linear unit variants (such as SwiGLU) replace a single activation with an element-wise product of a gating branch, often achieving better convergence at the same parameter count. The cost is roughly a one-third increase in parameters, so in practice the hidden width is reduced at the same time to keep the total constant.
Normalization placement also affects stability. The more common current practice is pre-normalization, placing normalization before each sublayer, together with scaled initialization on the residual branch so deep stacks do not suffer activation explosions early in training. Pairing this with root-mean-square normalization (which skips mean centering) keeps quality while removing one reduction pass.
5. Sparsification: Fine-Grained Experts and Token-Level Routing
Another prominent route replaces the dense feed-forward layer with multiple expert subnetworks, where a router selects a few experts per token, decoupling “total parameter count” from “compute per step.” The key engineering points include:
- Routing strategy: select the top few experts and apply normalized weighting, with noise or temperature tuning introduced to avoid routing collapse;
- Load balancing: an auxiliary loss spreads tokens as evenly as possible across experts to prevent a few experts from being overloaded;
- Communication overhead: when experts sit on different devices, tokens must be rearranged across devices, and communication often becomes the real bottleneck;
- Shared experts: keeping a small number of always-active experts to carry general knowledge can improve training stability.
It is worth stressing that sparsification improves “parameter capacity utilization” and does not automatically reduce memory footprint; if memory is the binding constraint, the gains are cancelled out.
6. The Overlooked Parts That Decide Success: Training Stability and Inference Cost
Architecture discussions often ignore numerical precision and optimizer state. Mixed-precision training, keeping higher precision for normalization and loss computation, and sharding optimizer state are prerequisites for training large models under limited memory. In addition, whether the attention implementation uses fused operators and avoids explicitly materializing the score matrix directly determines the memory curve on long sequences.
The cost structure on the inference side is completely different from training and must be accounted for separately: the prefill stage is compute-bound, while the decoding stage is bandwidth-bound. General-purpose measures include KV cache quantization, continuous batching, paged cache management, and reusing high-frequency prefixes to cut repeated computation.
7. Practical Guidance: An Actionable Selection Checklist
- Define the constraint boundaries first: context length, concurrency, memory ceiling, and latency targets, then discuss structural choices.
- Default to rotary positional encoding, and plan the extrapolation strategy for the target length up front rather than patching it afterward.
- Reduce cache overhead with grouped-query attention first; evaluate sparsification only when there is a clear long-range requirement.
- Adopt a gated feed-forward variant and adjust the width accordingly to keep the total parameter count comparable.
- If you take the sparse expert route, treat communication and load balancing as first-class concerns, not add-ons.
- Set up a small-scale ablation process: fix the data and random seed, change a single variable at a time, and avoid mistaking engineering optimization for structural gains.
To carry the full training and inference pipeline, you can compose general cloud capabilities: object storage for datasets and checkpoints, a container platform for elastic training and inference clusters, a message queue for task decoupling, and logging plus monitoring and alerting for observability. Baidu AI Cloud offers the same categories of general infrastructure for these scenarios, which lets teams focus their energy on the architecture and the data themselves.
8. Conclusion
Seven years on, mainstream large models have converged strongly at the macro structural level. This is not a stall in innovation but engineering rationality winning out: once the structure stabilizes, the optimization focus naturally shifts to operator efficiency, numerical stability, and system throughput. For developers, the real competitive edge is not chasing the newest acronym but building the ability to map “constraints — bottlenecks — means,” and to make verifiable, reproducible trade-offs given specific hardware and business metrics.
