Modern LLM Architecture and Parameter Scaling Explained
This article breaks down the architectural design choices behind modern large language models from four dimensions: layer arrangement, attention sparsification, expert routing (MoE), and residual connections with numeric formats. It explains why total parameter counts have grown to trillions while activated parameters remain in the tens of billions, how KV cache compression enables million-token contexts, and what these trade-offs mean for model selection and deployment planning under compute, memory bandwidth, and communication constraints.
Modern LLM Architecture and Parameter Scaling Explained
1. Why Architecture Matters More Than Scale
It has been over a decade since the Transformer architecture was proposed, and surveys about it are abundant. But focusing only on the “doubling parameter counts” narrative makes it easy to miss what has actually changed in the past two or three years: total parameter counts have grown from hundreds of billions (B) to trillions (T), while the activated parameters per forward pass have long remained stable in the tens-of-billions range.
This seemingly contradictory phenomenon is the direct result of maturing sparsity designs. Understanding these architectural trade-offs matters because every design change ultimately points to the same set of hardware constraints:
- Compute: determines the total FLOPs required for training and inference;
- Memory bandwidth: determines whether decode phases can keep compute units fed;
- Communication: determines the scaling efficiency ceiling for multi-GPU parallelism.
Following this thread, this article dissects the common design patterns of contemporary LLMs across four dimensions: layer arrangement, attention sparsification, expert routing, and residual connections with numeric formats.
2. Overall Architecture: Decoder-Only Remains Dominant
Whether total parameters are 200B or 2T, nearly all contemporary open-weight models share the same skeleton:
- Embedding layer: vocabulary sizes are typically around 150K tokens, with embedding dimensions scaling from 4096 to over 8192 as models grow;
- Stacked decoder layers: layer counts range from 40 to 90, each containing one attention sublayer and one feed-forward sublayer;
- Normalization: RMSNorm has become the de facto standard, replacing LayerNorm because it eliminates mean computation and is more memory-access friendly;
- Positional encoding: Rotary Position Embedding (RoPE) is mainstream, combined with base frequency extension techniques (such as NTK-aware methods) to support ultra-long contexts;
- Output head: whether to share weights with the embedding layer (weight tying) varies across models.
Two notable changes in layer arrangement stand out: first, some models introduce cross-attention or additional shared expert layers in the later stages near the output to strengthen long-range dependencies; second, residual connection schemes have evolved from standard Pre-Norm into variants like residual mixing and dynamic residual scaling, used to stabilize gradients in ultra-deep networks.
3. Mixture of Experts (MoE): Decoupling Parameter Growth from Computation
MoE is the direct reason why “total parameters grow while activated parameters don’t.” Key trends in typical configurations:
- Total expert count: from dozens in early designs to 256, 384, and even 896;
- Activated experts: each token typically activates only 8–12 experts, an activation ratio of roughly 1%–3%;
- Shared experts: nearly every new-generation model retains 1–2 always-active shared experts that carry general knowledge and mitigate routing imbalance;
- Routing granularity: from token-level Top-K routing to fine-grained segmentation, where experts are split smaller and combined more flexibly.
Three key engineering problems in routing strategy:
- Load balancing: auxiliary loss functions (e.g., sequence-wise balance loss) or loss-free balancing strategies (dynamically adjusting bias terms) are widely adopted to prevent “expert collapse”;
- Routing scoring: the router’s sigmoid/softmax scoring affects gradient behavior; some models replace loss constraints with scoring biases to achieve “zero auxiliary loss” balancing;
- Communication cost: MoE layers inherently require all-to-all communication. When expert parallelism (EP) spans nodes, communication volume grows linearly with expert count—a hard constraint on unlimited expert scaling.
A rough but practical estimation method: if the per-expert feed-forward dimension is d_ff_expert, the model has L MoE layers, each with N experts, and each token activates K experts, then:
Total FFN parameters ≈ L × N × (3 × d × d_ff_expert)Activated FFN parameters ≈ L × (K + shared experts) × (3 × d × d_ff_expert)
where d is the hidden dimension. This explains why total parameters can reach trillions while per-token computation matches that of a 30B–70B dense model.
4. Attention Sparsification and KV Cache Compression
Once context lengths extend from 128K to 1M tokens, attention complexity and KV cache size become the primary bottlenecks. Industry solutions concentrate in three categories:
4.1 “Fewer Heads, Higher Dimensions” in Attention Structure
Multi-Head Attention (MHA) → Grouped-Query Attention (GQA) → Multi-head Latent Attention (MLA), with KV cache compression ratios increasing at each level. MLA-style approaches project K and V into a low-dimensional latent space (e.g., 512 dimensions), caching only the latent vectors during inference. This can shrink the KV cache by over an order of magnitude compared to MHA, at the cost of a small amount of additional matrix reconstruction computation.
4.2 Sparse Attention
For ultra-long contexts, full attention’s O(n²) computation is unacceptable. Mainstream approaches include:
- Sliding window + global layer mixing: most layers attend only to local windows, while a few layers perform global attention;
- Dynamic sparse selection: a lightweight scorer first selects relevant token blocks, then exact attention is computed on selected blocks;
- Chunked compression: historical tokens are compressed into summary vectors that participate in attention alongside raw tokens.
4.3 KV Cache Engineering Estimates
The KV cache size estimation formula:
KV Cache bytes = 2 × layers × KV dimension × sequence length × bytes per element × batch size
With 60 layers, a 512-dimensional KV latent space, FP8 storage, and 1M context, the KV cache for a single request is roughly 60GB—which is why “the longer the context, the more the cache must be compressed” has become a shared problem for all new architectures. Deployment typically pairs this with paged memory management (a virtual-memory-like block table mechanism) and prefix cache reuse.
5. Numeric Formats and Quantization: Trading Precision for Bandwidth
Stable activated parameters with exploding total parameters mean inference is memory-bandwidth-bound: every decoded token requires reading the activated weights from GPU memory once. Low-precision numeric formats have therefore become standard:
- Training: BF16/FP16 dominates, with some models attempting FP8 mixed-precision training in feed-forward layers, using fine-grained scaling factors to control numerical overflow;
- Inference: INT8/FP8 weight quantization is nearly lossless; INT4 becomes acceptable with group-wise quantization and outlier protection; KV caches can likewise be quantized to FP8/INT8;
- Communication: gradients and all-to-all transfers use low-precision compression to reduce cross-node bandwidth pressure.
Quantization gains land directly on memory bandwidth: dropping weights from FP16 to INT4 can theoretically yield nearly 4× decode throughput (in practice, constrained by compute and kernel efficiency, typically 2–3×).
6. A Hardware Perspective: A Unified Set of Constraints
Abstracting away the differences between model families reveals converging design trade-offs:
| Design Goal | Approach | Main Cost |
|---|---|---|
| Expand knowledge capacity | More experts, larger total parameters | Memory footprint, routing communication |
| Control inference cost | Sparse activation, low activated parameters | Harder load balancing |
| Support long context | MLA/GQA, sparse attention | Structural complexity, implementation cost |
| Improve throughput | Low-precision quantization, cache reuse | Precision risk requiring validation |
For teams planning infrastructure, it is advisable to reserve headroom along three parameters: per-GPU memory capacity (determines whether activated weights and KV cache fit), inter-GPU interconnect bandwidth (determines expert parallelism scaling efficiency), and the memory bandwidth to compute ratio (determines actual utilization during decoding).
7. Practical Advice: Model Selection and Deployment
- Clarify scenario priorities: for high-concurrency short conversations, choose models with small activated parameters and cache-friendly designs; for long-document processing, prioritize attention sparsity schemes and measured context window lengths;
- Benchmark, don’t just read leaderboards: measure TTFT (time to first token) and TPOT (time per output token) with real production traffic, and monitor KV cache occupancy as context length grows;
- Leverage cloud infrastructure to lower the barrier: general-purpose cloud capabilities such as container platforms, object storage, logging services, and monitoring/alerting can support elastic scaling and observability of model serving, allowing teams to focus on prompt engineering and business integration rather than low-level cluster operations;
- Preserve migration flexibility: keep architecture interfaces standardized (e.g., model formats and API conventions compatible with mainstream inference frameworks) so that switching costs stay low as architectures iterate rapidly.
8. Conclusion
The architectural competition among large language models appears, on the surface, to be a permutation of layer counts, expert counts, and attention variants. In essence, it is a search for the optimal path between three walls: compute, memory bandwidth, and communication. The coexistence of trillion-scale total parameters with tens-of-billions activated parameters, and of million-token contexts with relentlessly compressed KV caches, are both mirror images of these constraints. Grasping these constraints is more valuable in the long run than memorizing any single model’s configuration numbers—because the next generation of models will still be written by the same set of hardware laws.
