Modern LLM Architecture: Structure, Parameter Scale, and Future Trends
This article explores the architectural evolution of modern Large Language Models (LLMs) beyond mere parameter counts. It examines the structural variants built on the Decoder-only Transformer skeleton, the distinction between total and active parameters in sparse models, the engineering challenges of Mixture-of-Experts (MoE) routing, and the optimization of KV Cache for long contexts. Finally, it provides guidelines for accelerator planning and predicts future trends in LLM architecture, emphasizing the trade-offs among capacity, bandwidth, and compute.
Discussing the structure of modern Large Language Models (LLMs) cannot stop at the question of “how many parameters.” Parameter scale dictates model capacity and storage overhead; active parameters determine the effective computation per token; attention and caching strategies dictate long-context costs; and Mixture-of-Experts (MoE) and routing granularity determine the difficulty of parallel communication and load balancing. Only by mapping these trade-offs onto a single engineering diagram can we answer what the structure and parameter scale of modern LLMs look like, and where the next generation of models is heading.
1. Typical Structure: Variants on the Decoder-only Skeleton
Current mainstream LLMs predominantly use the Decoder-only Transformer as their foundational skeleton: inputs pass through word embeddings and positional encoding, enter multi-layer stacked modules; each layer typically contains an attention sublayer and a feed-forward network (FFN) sublayer, combined with residual connections and normalization; finally, an output head maps to vocabulary probabilities. The differences lie not in “whether it is a Transformer,” but in the engineering variants built upon this skeleton.
Common variants include: pre-normalization and Root Mean Square Normalization (RMSNorm) to improve deep training stability; Rotary Position Embedding (RoPE) to enhance positional extrapolation; Grouped-Query Attention (GQA) or Multi-Query Attention (MQA) to reduce the number of KV heads and shrink the KV Cache; Gated FFN replacing the traditional FFN to improve parameter efficiency; and MoE layers replacing some dense FFN layers to decouple total parameters from active parameters. Thus, “structure” is no longer a fixed template, but a set of trade-off schemes balancing capacity, latency, memory, and communication.
A simplified pseudocode can describe the modern layer structure:
for layer in layers:x = x + attention(norm(x)) # Attention sublayer, may use Grouped-Query Attentionif layer.use_moe:x = x + moe_ffn(norm(x), top_k) # Mixture-of-Experts Feed-Forward Networkelse:x = x + dense_ffn(norm(x)) # Dense Gated Feed-Forward Network
The key point behind this pseudocode is: attention is responsible for routing information between tokens, while the FFN is responsible for per-token feature transformation. When dense FFN is replaced by MoE, the total parameters of the model can increase significantly, but each token only activates a small number of experts, thereby controlling the computation per token.
2. Parameter Scale: Total Parameters, Active Parameters, and Sparsification
When answering “how large is the parameter scale,” one must distinguish between total parameters and active parameters. In dense models, the two are basically identical; in MoE models, total parameters can be far larger than the active parameters per token. A common trend in industry discussions is that total parameters are expanding from hundreds of billions to trillions, while the active parameters per token remain at the tens of billions level for a long time. The purpose is not simply to pile up parameters, but to use a larger parameter pool to carry knowledge capacity while keeping per-token computation within a serviceable range.
Total parameters mainly affect weight storage, loading bandwidth, and the scale of expert parallelism; active parameters mainly affect per-token compute, latency, and throughput. During inference, memory usage is approximately composed of weights, KV Cache, and temporary buffers; during training, gradients, optimizer states, and activation values are also added. Therefore, the parameter scale problem is essentially a “capacity—bandwidth—compute” triangle problem, rather than a single-number race.
3. MoE and Routing Granularity: More Experts, Finer Routing
The core of MoE is routing: calculating expert scores for each token, selecting top-k experts to participate in computation, and then aggregating the outputs. As the number of experts expands from hundreds to nearly a thousand, the routing granularity becomes finer, meaning individual experts are smaller, the combination space is larger, and specialization capabilities are stronger. However, the cost is increased routing computation, load balancing difficulties, expert parallel communication, and cache fragmentation. The more experts there are, the easier it becomes for all-to-all communication to become a bottleneck; the finer the routing, the more auxiliary load balancing loss and capacity factor control are needed during training to prevent a few experts from being overloaded.
Therefore, more experts are not always better. Engineering must simultaneously consider expert parallelism, interconnect bandwidth, single-expert compute density, and batch size. Small experts are suitable for fine-grained specialization but require stronger communication scheduling; large experts have higher compute density but make load balancing more difficult. The trend for next-generation models is not simply to increase the number of experts, but to co-design the number of experts, routing granularity, parallel strategies, and accelerator interconnects.
4. Long Context and KV Cache: Expanding Windows vs. Compression
Expanding context from 128K to 1M directly results in the growth of attention computation and KV Cache. The cost of full attention rises with sequence length, and the KV Cache grows linearly with the number of layers, KV heads, head dimension, sequence length, and batch size. Consequently, long-context capabilities are often accompanied by KV Cache compression: reducing KV heads, quantizing the cache, low-rank compression, paged management, eviction policies, and hierarchical caching. KV Cache compression is not an auxiliary optimization, but a key determinant of whether long context can be serviceable.
A simplified KV Cache capacity estimation is as follows:
def kv_cache_bytes(layers, kv_heads, head_dim, seq_len, batch, bytes_per_elem):# Coefficient 2 represents K and V; actual systems also consider paging, quantization, and alignment overheadreturn 2 * layers * kv_heads * head_dim * seq_len * batch * bytes_per_elem
From the formula, it is evident that sequence length and batch size directly amplify the cache; GQA reduces the cache by decreasing kv_heads; quantization reduces footprint by lowering bytes_per_elem; paging and hierarchical caching separate hot and cold data. Long context is not as simple as “opening a larger window,” but a systems engineering effort involving attention architecture, cache management, and scheduling strategies.
5. Accelerator Planning: Three-Dimensional Margins for Capacity, Bandwidth, and Interconnect
When planning for accelerators, it is recommended to split the workload into two budgets: training and inference. Training focuses on estimating weights, gradients, optimizer states, and activation values, while considering the communication overhead of expert parallelism; inference focuses on estimating weights, KV Cache, temporary buffers, and concurrent batch sizes. Total parameters determine weight capacity, active parameters determine per-token compute, sequence length and concurrency determine KV Cache, and the number of experts and routing granularity determine interconnect pressure. Planning should be based on peak context and peak concurrency estimations, with safety margins reserved to prevent long context or fine-grained routing from exhausting memory and bandwidth.
In general cloud environments, container platforms can be used to host inference services, while monitoring and logging services observe time-to-first-token, per-token latency, throughput, and cache hit rates. Cold KV Cache can be offloaded to object storage or memory pools, while hot data remains in high-bandwidth memory. When deploying in general cloud environments such as Baidu AI Cloud, hardware selection should still be driven by stress testing results rather than defaulting to a specific interface or model.
6. Trend Analysis: Larger Total Parameters, Sparser Activation, Finer Cache
Overall, the next generation of models will likely continue along three main lines: first, total parameters will continue to expand, but active parameters will remain restrained, making sparsification the default option; second, the number of experts will increase and routing granularity will become finer, but this must be co-designed with interconnect topology and load balancing; third, context will continue to expand, with KV Cache repeatedly compressed through quantization, low-rank methods, paging, and hierarchical caching. Structural innovation will increasingly occur among attention variants, expert routing, and cache management, rather than the replacement of a single layer structure.
Therefore, answering “what is the structure and parameter scale of modern LLMs” more accurately: they use the Decoder-only Transformer as a skeleton, overlaid with GQA, gated FFN, MoE, and long-context cache optimizations; parameter scales commonly feature hundreds of billions to trillions of total parameters and tens of billions of active parameters, depending on task, latency, and cost constraints. Engineering planning should place total parameters, active parameters, number of experts, routing granularity, context length, and KV Cache strategy within the same budget, reserving margins across capacity, bandwidth, and interconnect to support the stable training and efficient inference of next-generation models.
