A Practical Guide to Modern LLM Architecture and Parameter Scale

    This article breaks down the internal architecture of today's mainstream large language models and explains how to read their parameter counts. It covers four structural trends—sparsification, attention variants, context extension with KV cache compression, and finer routing granularity—and shows how they all converge on the same hardware constraints: compute, memory access, and communication. You will find a reusable checklist for inspecting any set of weights, a formula for estimating cache footprint, and practical implications for accelerator and cluster planning.

    1. Why Structure Deserves Its Own Discussion

    More than a decade has passed since the Transformer was introduced, and the evolution of its architecture has already been covered extensively. Rather than retelling that history, this article focuses on current mainstream large language models, dissects their network structures one by one, and explains why these modifications converge on the same set of hardware constraints: compute, memory access, and communication.

    A note on notation: B denotes billion parameters, T denotes trillion parameters, and the unit of measurement throughout is the token, without a plural suffix.

    Looking at the past two years of progress, four seemingly contradictory patterns stand out:

    • Total parameters have grown from hundreds of B to several T, yet the parameters activated in a single forward pass 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 risen from 256 to 896 or more, while routing granularity keeps getting finer.
    • The number of layers does not necessarily increase, but the width of each layer, the gating structure, and the position of normalization are rearranged repeatedly.

    Putting these trade-offs on a single chart makes it possible to anticipate the direction of the next generation of models and to leave headroom in accelerator planning.

    2. Four Main Threads: Where Structural Changes Point

    2.1 Sparsification: Decoupling Capacity from Compute

    The mainstream approach replaces the feed-forward layer with a gated expert network: total parameter count carries knowledge capacity, while activated parameters determine the actual compute cost. Three engineering concerns matter here: load balancing in the routing function, communication volume under expert parallelism, and the division of labor between shared experts and routed experts. Shared experts carry general capabilities and routed experts carry specialized knowledge—a common compromise over the past two years.

    Illustrative pseudocode:

    1. # Minimal abstraction of a gated sparse feed-forward layer
    2. def sparse_ffn(x, router, experts, shared, top_k=8):
    3. logits = router(x) # [batch, seq, num_experts]
    4. weights, idx = topk_softmax(logits, k=top_k)
    5. y = shared(x) # shared expert: general transformation
    6. for e_id, w in aggregate(idx, weights):
    7. y = y + w * experts[e_id](x) # routed expert: specialized transformation
    8. return y

    2.2 Attention Variants: Making Room for Memory Access

    Attention is no longer the only option. Linear attention, gated recurrent units, and sliding-window attention are stacked in mixtures, with a common ratio of one global attention layer inserted every three to four layers. The goal is straightforward: reduce the memory-access complexity of long sequences from quadratic to near-linear, while retaining a small amount of global interaction.

    2.3 Context Extension and KV Cache Compression

    As context grows longer, the cache has to get shorter. Common techniques in the industry include multi-query/grouped-query attention to reduce the number of cached heads, cross-layer key-value sharing, and rotary position embedding adjustments with position extrapolation. The key insight here: context length is a capability metric, while cache occupancy is a cost metric, and the two must be evaluated separately.

    2.4 Routing Granularity: Finer Gating, More Stable Load

    More experts bring routing jitter. The solution is to split large experts into finer sub-experts, combined with a capacity factor and an auxiliary loss to constrain the load distribution, thereby increasing effective capacity while keeping activated parameters unchanged.

    3. A General Framework for Dissecting Structures by Series

    Because implementation details vary considerably across vendors, here is a reusable dissection checklist. Faced with any set of weights, readers can quickly locate its design orientation:

    1. Compute the ratio of total parameters to activated parameters to gauge sparsity.
    2. Confirm whether the feed-forward layer is dense or gated-sparse, along with the number of experts and the top_k value.
    3. Check the global/local attention mixing ratio and the cache-sharing strategy.
    4. Observe the position of normalization, the residual connections, and how position embeddings are extrapolated.
    5. Verify whether multimodal inputs require an additional vision or audio encoding branch.
    6. Assess the differences between long-context and base versions—usually cache and position embeddings, rather than the backbone.

    The value of this checklist is that models across different generations and different positioning (flagship, lightweight, long-context, multimodal) often make aggressive changes in only one or two of these areas and stay conservative elsewhere.

    4. How to Read Parameter Scale

    When discussing parameter scale, it helps to record four numbers at the same time: total parameters, activated parameters, cache bytes, and supported context length. Looking only at total parameters overestimates compute demand; looking only at activated parameters underestimates memory pressure. A practical estimation approach:

    1. cache footprint ≈ num_layers × 2 × num_cache_heads × head_dim × context_length × bytes_per_precision × concurrency

    Substituting this expression together with the activated parameter count reveals whether a single inference is bottlenecked by compute, memory, or communication bandwidth.

    5. Implications for Accelerators and Cluster Planning

    • Estimate compute from activated parameters and sequence length, not total parameters.
    • Prioritize optimizing cache layout and precision for memory access; operator fusion comes second.
    • Communication must cover both the all-to-all exchange of expert parallelism and the point-to-point transfers of pipeline parallelism.
    • For long-context scenarios, reserve cache bandwidth headroom rather than simply piling on compute.

    If you adopt a cloud-based approach, you can deploy training and inference in separate tiers on a container platform, use object storage to hold weights and datasets, and use logging and monitoring/alerting services to track throughput, cache hit rate, and communication wait time—completing capacity assessment without binding to a specific implementation.

    6. Conclusion

    The essence of architectural evolution is a dynamic balance among compute, memory access, and communication. With the dissection framework above and the four key numbers in hand, readers can quickly assess any new model and leave reasonable headroom for the next stage of hardware and cluster planning.