Anatomy of Modern Large Language Models: Architecture and Parameter Scale Explained

    This article breaks down the internal structure of modern large language models and explains how to read their parameter counts. It examines four core design dimensions—layer ordering, attention sparsification, expert routing, and residual mixing with numerical formats—and shows how seemingly scattered design choices all converge on the same hardware constraints: compute, memory bandwidth, and interconnect communication. You will learn to separate total parameters, active parameters, KV cache size, and expert/layer configuration, see a dimension-level estimation snippet, and understand the implications for hardware planning and future trends.

    Anatomy of Modern Large Language Models: Architecture and Parameter Scale Explained

    1. Why Structure Deserves Its Own Discussion

    It has been over a decade since the Transformer appeared, and the literature already contains numerous surveys of its structural evolution. This article does not repeat that history. Instead, it narrows the focus to the large language models actually in service today and dissects how each one organizes its network.

    Structure is worth discussing on its own because the seemingly scattered changes made by different vendors all point to the same set of constraints once they land on hardware: compute, memory bandwidth, and interconnect communication. Viewed together along these dimensions, many design choices stop looking arbitrary:

    • Total parameters have climbed from hundreds of B to several T, yet the parameters actually activated per token have stayed in the tens of B range;
    • Context windows have expanded from 128K to 1M, yet the KV Cache is repeatedly compressed;
    • The number of experts has grown from 256 to nearly a thousand, while routing granularity keeps getting finer.

    These three “counter-movements” are the key to understanding modern large models. Throughout, B denotes one billion parameters and T denotes one trillion parameters, with everything measured in tokens. The article is organized by model family: each chapter first states scale and layer configuration, then covers attention, mixture of experts, and numerical format in turn, and finally maps the model’s concrete hardware constraints. Each section ends with an operator-level breakdown diagram that lists operators, formulas, and tensor dimensions segment by segment along both the attention and feed-forward paths, along with accounting for cache, compute, and weight footprint.

    The differences across models ultimately converge on four aspects: layer ordering, attention sparsification, expert routing, and residual mixing. Each is discussed below.

    2. Four Core Design Dimensions

    2.1 Layer Ordering: How Attention and Feed-Forward Are Arranged

    Early models generally used a strictly alternating “attention–feed-forward” layer order. Modern models break this symmetry: some merge several feed-forward layers into a single computation, some stack more attention layers in the shallow layers and more feed-forward layers in the deep layers, and some make certain layers feed-forward only to save a cache read/write.

    Layer ordering matters because it directly determines two things: the number of layers that produce a KV Cache (only attention layers do), and the partitioning granularity for pipeline parallelism. Concentrating attention layers in the front segment lets the feed-forward layers in the back segment carry heavier computation, raising arithmetic intensity under the same bandwidth.

    2.2 Attention Sparsification: Balancing Long Context Against Cache

    The first pressure from a longer context is not compute but cache. Standard multi-head attention must store key-value pairs for every layer and every historical token, and its footprint grows linearly with context, quickly exceeding the weights themselves. Common countermeasures include:

    • Low-rank cache compression: project keys and values into a lower-dimensional space before caching, trading a little precision for an order-of-magnitude reduction in capacity;
    • Cross-layer cache sharing: adjacent layers reuse the same key-values, reducing duplicate storage;
    • Sparse or block attention: let each token attend only to a local window plus a few global anchors;
    • Linear/gated hybrid attention: replace some quadratic-complexity layers with linear-complexity operators.

    In engineering practice, multiple techniques are usually combined rather than betting on a single one.

    2.3 Expert Routing: Finer Granularity, More Experts, Sparser Activation

    The core accounting of Mixture of Experts (MoE) is simple: total parameters are determined by the number of experts, and activated parameters are determined by how many experts each token selects. The modern approach is to make experts smaller and more numerous while activating only a handful per token, widening the gap between “model capacity” and “per-inference cost.”

    The cost of fine-grained routing shows up in communication: tokens must be sent to experts on different devices and then brought back. Routing design must therefore account for load-balancing loss, cross-device bandwidth, and expert parallelism at the same time; otherwise the theoretical gains from sparsity are eaten by communication overhead.

    2.4 Residual Mixing and Numerical Format

    Residual connections determine how gradients and activations are combined, and they also affect numerical range. With low-precision training and inference now widespread, numerical format has become part of the structure: which tensors accumulate in high precision, which are stored in low precision, and how scaling factors are chosen all change final accuracy. Newer approaches tend to keep higher precision on sensitive paths while using lower bit widths for the bulk of weights and activations.

    3. How to Read Parameter Scale

    To read a model’s scale, at least four numbers must be separated:

    1. Total parameters: sets the floor for memory and storage;
    2. Activated parameters: determines compute per token;
    3. Cache footprint: determines peak memory under long context;
    4. Expert and layer configuration: determines the partitioning scheme and communication volume.

    A typical order-of-magnitude relationship: when total parameters reach several T, weight footprint estimated at 1–2 bytes per parameter reaches several TB and must be carried jointly by tensor parallelism, expert parallelism, and pipeline parallelism; meanwhile activated parameters are only tens of B, so per-token compute demand is relatively manageable. What tends to blow up first is usually the cache, not the weights.

    An illustrative calculation can be written as:

    1. # For dimension illustration only; does not represent any specific model
    2. def estimate(weights_params, active_params, layers, kv_heads,
    3. head_dim, seq_len, bytes_per_value=2):
    4. weight_bytes = weights_params * bytes_per_value
    5. # Cache elements per layer per token: 2(K/V) * kv_heads * head_dim
    6. cache_bytes = layers * seq_len * 2 * kv_heads * head_dim * bytes_per_value
    7. flops_per_token = 2 * active_params # forward approximation
    8. return weight_bytes, cache_bytes, flops_per_token

    The point of this code is a reminder: weight footprint is independent of sequence length, while cache footprint is proportional to it. Expanding context from 128K to 1M grows the cache nearly eightfold, which is why compressing the cache is more urgent than piling on parameters.

    4. Implications for Hardware Planning

    Mapping these structural differences onto hardware yields a few relatively firm conclusions:

    • Bandwidth first: the decode stage is memory-intensive, and read bandwidth for cache and weights often matters more than peak compute;
    • Communication is a hidden cost: expert parallelism and long context both amplify cross-device communication, so the interconnect topology needs headroom;
    • Precision tiers: different paths differ in precision sensitivity, so accelerators are best served by supporting mixed precision and flexible scaling;
    • Elastic memory: cache changes dynamically with context, so memory management must be designed for the peak rather than the average.

    When deploying in the cloud, these needs usually map to a combination of general-purpose capabilities: a container platform handles elastic orchestration, object storage holds weights and datasets, a message queue decouples the data-processing pipeline, and logging plus monitoring/alerting services provide visibility into throughput, latency, and cache hit rates. The selection only needs to check whether the general categories are covered, without binding to any specific implementation.

    Surveying the structural evolution across model families, three trends stand out:

    1. Decoupling capacity from cost will deepen further, with sparse activation becoming the default;
    2. Cache compression will happen ahead of context expansion, so long-context capability will come more from smarter caching than from larger windows;
    3. Asymmetrization of layer ordering and residuals will continue, with the design freedom shifting from “stacking layers” to “orchestrating operators around hardware constraints.”

    For developers, reading a model’s structure does not require memorizing every number; what matters is grasping this main thread: every structural change ultimately redistributes the budget among compute, memory access, and communication. With that perspective, when facing the technical specs of the next generation of models, you can quickly judge where the bottleneck lies and how much headroom is needed.

    You do not understand music until you have played a thousand tunes, nor weapons until you have handled a thousand swords.