Large Language Model Architectures and Parameter Sizes Explained

    A practical breakdown of how modern large language models are built and sized. It covers the two anchors for understanding any model—architecture and parameter count—why parameter count differs from activated parameters in sparse MoE designs, the core components of a decoder-only backbone (RMSNorm, Pre-Norm, SwiGLU feed-forward layers, GQA and MLA attention, RoPE, sparse expert layers), a rough tiering of parameter scales with deployment implications, a checklist for reading a model technical report, and capacity planning guidance for serving these models.

    1. Why Architecture and Parameters Are the Two Anchors

    In engineering practice, only two dimensions are meaningful when discussing a model: how information flows inside the network (architecture), and how many learnable values that flow mechanism carries (parameters). Architecture determines the shape of computational complexity and memory footprint; parameter scale sets the floor for knowledge capacity and training data requirements. Together they determine the floating-point operations of a single forward pass, the memory-access pressure during decoding, and the hardware threshold for practical deployment.

    One common confusion needs clearing up first: parameter count is not the same as activated count. In dense architectures the two are equal. In sparse Mixture-of-Experts (MoE) architectures, total parameters can reach the hundreds of billions, yet each token activates only a small subset of experts, so per-token compute can stay at a level comparable to small and mid-sized models. This explains a trend: the total parameter count has been growing faster than inference cost.

    2. Anatomy of a General Architecture: What a Modern Decoder Backbone Contains

    The vast majority of mainstream models use a Decoder-only autoregressive architecture, whose backbone can be abstracted as a stack of identical modules:

    1. # Illustrative structure, not the implementation of any specific product
    2. class Block(nn.Module):
    3. def __init__(self, d_model, n_heads, ffn_hidden, use_moe=False):
    4. self.norm1 = RMSNorm(d_model)
    5. self.attn = Attention(d_model, n_heads) # can pair with GQA / MLA
    6. self.norm2 = RMSNorm(d_model)
    7. self.ffn = MoE(ffn_hidden, n_experts, top_k) if use_moe \
    8. else SwiGLU(d_model, ffn_hidden)
    9. def forward(self, x, kv_cache=None):
    10. x = x + self.attn(self.norm1(x), kv_cache)
    11. x = x + self.ffn(self.norm2(x))
    12. return x

    The key components and the mainstream trade-offs are as follows.

    Normalization position and form. Modern models have largely abandoned classic layer normalization in favor of root mean square normalization, and place normalization before each sublayer (Pre-Norm) to keep deep training stable. The parameter impact is minimal, but the effect on convergence behavior is significant.

    Gated feed-forward layers. A stack of two linear transformations with an activation has evolved into the gated linear unit family (such as SwiGLU and GeGLU), with the intermediate dimension typically set to a multiple of the hidden dimension (commonly in the 2.67x to 4x range). The feed-forward layer usually accounts for more than two-thirds of a single layer’s parameters, making it the main consumer of the parameter budget.

    Efficiency改造 of attention. Three main lines: first, grouped-query attention, where multiple query heads share one set of key-value heads, directly shrinking the key-value cache during decoding; second, multi-head latent attention, which compresses keys and values into a low-rank latent space; third, sparse or sliding-window attention, which reduces long-context complexity from quadratic to near-linear. In engineering, global layers and local window layers are often interleaved to balance long-range dependencies against local detail.

    Positional encoding. Rotary position embedding has become the de facto standard, and paired with frequency-scaling interpolation methods it extends the context window, giving models trained on short contexts the ability to extrapolate to longer sequences.

    Sparse expert layers. Each expert is essentially an independent feed-forward network, and a router selects the top few experts for each token to participate in computation. To maintain load balance, training introduces an auxiliary balancing loss, together with expert capacity limits and dropping strategies. Shared experts (a few experts that are always active) carry general knowledge and reduce capability fluctuation caused by routing.

    3. Parameter Scale Tiers and Their Engineering Implications

    By common industry usage, a rough layering looks like this; the specific numeric ranges float with the task and data quality:

    Tier Typical total parameter range Deployment implication
    On-device / lightweight 0.5B - 4B Can run on a single card or even consumer hardware; quantizable to low bit widths
    Small-to-mid dense 7B - 14B A single mainstream inference card suffices; fine-tuning cost is manageable
    Mid-to-large dense 30B - 70B Requires multi-card tensor parallelism; memory becomes the main constraint
    Sparse large-scale 100B - 1T+ total, 10B - 40B activated Memory tracks total parameters, compute tracks activated ones; expert parallelism needed
    Very large scale Above 1T Training relies on thousand-card clusters and three-dimensional pipeline/tensor/data parallelism

    A handy rule of thumb for estimation: inference memory is roughly the parameter count multiplied by bytes per parameter, plus the key-value cache. At half precision, a 70B dense model needs about 140GB for weights alone, before counting cache and framework overhead; a sparse model with the same activated count occupies more memory for weights but consumes less compute. This is exactly the divide between the two classes of bottlenecks: memory-bound and compute-bound.

    4. How to Read a Model Technical Report

    Faced with a steady stream of version iterations, extract information in the following order to avoid being distracted by marketing language:

    1. Architecture type: dense or sparse, and the activation ratio;
    2. Number of layers and hidden dimension, and the ratio of attention heads to key-value heads;
    3. Context length and how it is extended;
    4. Training data scale and the curriculum arrangement of context lengths;
    5. Post-training pipeline: the combination of supervised fine-tuning, preference optimization, and reinforcement learning with verifiable rewards;
    6. Weight precision and quantization friendliness, and whether a low-bit usable version is provided.

    5. Deployment Recommendations

    On a general-purpose cloud platform, model serving is typically carried by a container platform running inference images, with object storage distributing weights, message queues smoothing traffic spikes, and logging plus monitoring with alerting tracking time-to-first-token and throughput. Capacity planning should back out the key-value cache size from “target concurrency x average context length,” then add weight occupancy, and leave at least a 20-30% margin for burst traffic. If the business has a strong need for long-document processing, evaluate attention efficiency options first rather than simply piling on parameters; if cost-sensitive, make the trade-off on activated count rather than total parameters. The general-purpose container, storage, and monitoring capabilities offered by Baidu AI Cloud can serve as the implementation vehicle for the capacity model above.