Modern Large Language Model Architectures: Structure, Parameter Scaling, and Hardware Constraints

    This article provides a structural overview of modern large language models (LLMs) without focusing on any specific vendor. It outlines four key architectural dimensions—layer ordering, attention sparsification, expert routing, and residual mixing—and explains parameter scaling through total parameters, activated parameters, and sparsity. It discusses how attention mechanisms and KV cache compression address long-context demands, how mixture-of-experts (MoE) routing balances capacity and communication, and how residual normalization and numerical formats affect training and inference. It also maps these design choices to hardware constraints such as compute, memory bandwidth, and interconnect, and offers practical selection criteria for evaluating LLM architectures.

    Introduction

    This article focuses on structural patterns that recur in publicly available technical documentation for modern large language models (LLMs), rather than targeting any specific vendor or release. In recent designs, total parameter counts have scaled from hundreds of billions to trillions, while the number of parameters activated per token typically remains in the tens of billions. Context windows have expanded from 128K to 1M tokens, yet the KV cache is repeatedly shrunk through grouped-query attention, low-rank compression, quantization, and hierarchical caching. The number of experts has grown from 256 to 896, with increasingly fine-grained routing. These seemingly scattered changes all converge on the same set of hardware constraints: compute, memory access, and communication.

    Four Key Architectural Dimensions

    When analyzing modern LLM architectures, four dimensions are crucial: layer ordering, attention sparsification, expert routing, and residual mixing. Layer ordering determines whether a model uses homogeneous repeated blocks or inserts heterogeneous modules at different depths. Attention sparsification affects computational complexity and KV cache size under long contexts. Expert routing determines the ratio between total and activated parameters, as well as the communication overhead in expert parallelism. Residual mixing affects training stability and information flow in deep networks. Examining these four dimensions together helps determine whether a design trades parameter count for compute, cache for bandwidth, or communication for capacity.

    Parameter Scale: Total Parameters, Activated Parameters, and Sparsity

    Parameter scale cannot be judged by total parameters alone. In a dense decoder, total parameters are roughly equal to activated parameters per token. Sparse expert models increase total parameters but activate only a small subset of experts per token. A common metric is sparsity:

    Sparsity = Total Parameters / Activated Parameters

    Public technical materials indicate a general trend: total parameters increase from hundreds of billions to trillions, while per-token activated parameters often remain in the tens of billions. The number of experts grows from 256 to 896, with finer routing granularity. The goal is not simply to stack parameters, but to increase model capacity within limited compute and memory bandwidth. Dense models have simple structure and low communication, but total parameters are bound by memory capacity and bandwidth. Sparse expert models offer larger capacity but introduce routing computation, load balancing, and expert-parallel communication overhead. When making engineering trade-offs, activated parameters, per-token KV cache overhead, and expert-parallel communication traffic deserve priority over total parameters.

    Layer Configurations and Ordering

    Layer configurations include the number of layers, hidden dimensions, intermediate dimensions of feed-forward networks, number of attention heads, KV heads, expert count, and shared expert count. Common designs range from dozens to over a hundred layers, with hidden dimensions from thousands to tens of thousands. Layer ordering determines how these modules are repeated and combined: homogeneous repeated blocks are convenient for pipeline parallelism and compiler optimization; heterogeneous ordering may insert expert layers, sparsely attended layers, or shared expert layers at different depths to balance capacity and efficiency.

    Layer ordering directly affects hardware mapping. If expert layers are concentrated in the middle or later part of the network, pipeline splitting can produce load imbalance. If shared experts and routed experts alternate, All-to-All communication can be overlapped with feed-forward computation. If early layers remain dense and later layers introduce sparse experts, routing instability can have less impact on low-level features. Layer ordering is not a stylistic choice; it is a constraint on parallelism strategy, memory allocation, and communication scheduling.

    Attention Sparsification and Long Contexts

    Attention mechanisms have evolved from multi-head attention (MHA), grouped-query attention (GQA), and multi-query attention (MQA) to low-rank compressed attention and hybrid local-global attention. GQA reduces KV heads to lower cache size; MQA compresses KV heads to a minimal number; low-rank compressed attention projects K and V into a low-dimensional latent space and recovers them during computation. For long contexts, full attention grows quadratically with sequence length in computation, while KV cache grows linearly. Common solutions include sliding windows, block sparsity, global tokens with local windows, hierarchical caching, and KV quantization.

    The KV cache size can be roughly estimated as:

    KV cache bytes ≈ batch × seq_len × layers × kv_heads × head_dim × 2 × bytes_per_elem

    where 2 means two tensors for K and V. The prefill phase is compute-intensive, while decoding is memory-bound. The longer the context, the more likely decoding is limited by KV cache bandwidth. Therefore, long-context capability should not be judged solely by the maximum window size; per-token cache overhead, compression ratio, and effective retrieval capability are also important.

    Mixture of Experts and Routing

    Mixture-of-Experts (MoE) splits feed-forward networks into multiple experts, and each token selects Top-k experts via routing. Common optimizations include capacity factor, load-balancing auxiliary loss, shared experts, and fine-grained experts. Capacity factor limits the number of tokens each expert can process, preventing hot spots. Load-balancing loss encourages even routing. Shared experts capture common knowledge, reducing redundancy among routed experts. Fine-grained experts increase combinations but also add routing and communication overhead.

    The key constraint of MoE is expert-parallel communication. If experts are distributed across devices, each layer requires All-to-All exchange of tokens, and communication volume is roughly proportional to token count, Top-k, hidden dimension, and byte width. More experts and finer routing mean more communication complexity. Thus, expert routing granularity must be matched to interconnect bandwidth, batch size, and load-balancing strategy.

    Residual Mixing and Normalization

    Deep models commonly use Pre-Norm, RMSNorm, and residual scaling to stabilize training. Pre-Norm places normalization before the sublayer, keeping the residual pathway cleaner. RMSNorm reduces computation. Residual scaling controls residual accumulation in deep networks. Some architectures add cross-layer residual mixing or parallel branches so information at different depths flows more directly. The design goal is better gradient propagation and representational capacity, at the cost of extra memory reads/writes and operator fusion difficulty. Implementation should consider whether normalization and residual operations can be fused into the same kernel to avoid repeated memory access.

    Numerical Formats and Quantization

    Training commonly uses BF16 or FP16, with FP8 mixed precision in some cases. Inference often uses INT8 or INT4 weight quantization, and KV cache quantization. Weights memory can be estimated as:

    Weight bytes ≈ parameter count × bytes per parameter

    For example, tens of billions of activated parameters under FP16 already occupy tens of gigabytes. When total parameters reach hundreds of billions to trillions, weight size becomes a core constraint on memory capacity. Quantization lowers memory usage and bandwidth pressure but introduces precision loss and requires calibration and layer-specific strategies. Numerical format choices should be evaluated based on operator support, tolerance for precision loss, and KV cache compression requirements.

    Hardware Constraints and Operator-Level Analysis

    Modern LLM architectures are constrained by the triangle of compute, memory access, and communication. Compute determines prefill throughput; memory bandwidth determines decode speed; interconnect bandwidth determines the efficiency of expert and pipeline parallelism. Operator-level decomposition generally separates the attention path and feed-forward path: QKV projections, attention scoring, output projection, routing scoring, expert feed-forward, residual and normalization. Each operator must be examined for tensor dimensions, cache footprint, FLOPs, and byte count. Arithmetic intensity helps identify the bottleneck: high FLOPs/Byte indicates compute-bound; low indicates memory-bound.

    The following is a sample calculation using assumed parameters:

    1. def kv_cache_gib(batch, seq_len, layers, kv_heads, head_dim, bytes_per_elem=2):
    2. total_bytes = batch * seq_len * layers * kv_heads * head_dim * 2 * bytes_per_elem
    3. return total_bytes / (1024 ** 3)
    4. def weight_gib(params_billion, bytes_per_param=2):
    5. return params_billion * 1e9 * bytes_per_param / (1024 ** 3)
    6. print("KV Cache GiB:", kv_cache_gib(8, 131072, 64, 8, 128))
    7. print("Weight GiB:", weight_gib(671))

    This example shows that under long contexts, the KV cache can reach hundreds of GiB, and weight size grows linearly with parameter count. Real deployments must account for batch size, concurrency, quantization, and cache eviction policies.

    When evaluating a modern LLM architecture, the following order is recommended: first, examine the ratio of activated parameters to total parameters to estimate compute cost; second, examine per-token KV cache overhead and effective context length; third, examine expert count, Top-k, and parallel communication volume; finally, examine numerical formats, quantization support, and operator fusion. Trend-wise, total parameters will continue to grow, but activated parameters tend to stabilize. Context windows will keep expanding, with more aggressive cache compression. Expert routing will become finer-grained, and hardware-software co-design will become tighter. Understanding these trade-offs helps reserve reasonable margin for accelerator planning, inference services, and capacity evaluation.