Understanding Modern LLM Architecture and Parameter Scale: A Practical Guide

    This guide breaks down modern large language model architecture into four dimensions—scale and layer configuration, attention design, mixture of experts, and numerical precision—to show why total parameter count alone is a poor deployment metric. It explains how to estimate parameter counts and KV cache size, how sparse activation and cache compression change hardware requirements, and how to translate structural analysis into capacity and bandwidth planning with appropriate headroom.

    1. Why Structure and Parameter Scale Should Be Analyzed Separately

    The most common mistake when discussing large models is treating total parameter count as the only metric that matters. In practice, deployment cost is determined by three independent quantities: total parameters, activated parameters per token, and the growth curve of the KV cache as context length increases. A model with a large total parameter count but sparse activation may require less compute than a smaller but fully dense model. Meanwhile, memory pressure in long-context scenarios often comes not from weights but from the cache.

    This article therefore uses a consistent four-part framework that can be applied to any model family in the same order:

    1. Scale and layer configuration: total parameters, activated parameters, layer count, hidden dimension, vocabulary size;
    2. Attention structure: number of heads, head dimension, whether position encoding extrapolation is used, whether the cache is compressed;
    3. Mixture of experts: total number of experts, routing count per token, shared experts, load balancing strategy;
    4. Numerical formats and hardware constraints: weight precision, compute precision, communication primitives, and bandwidth lower bounds.

    These four threads constrain one another. For example, introducing low-rank compression to shrink the cache adds a small amount of computation and extra operators; increasing the expert count to grow total parameters shifts the bottleneck from compute to memory capacity and inter-GPU bandwidth. Understanding these trade-offs is more valuable than memorizing a specific model name.

    2. Scale and Layer Configuration: Three Numbers Set the Baseline

    Current mainstream dense and sparse models concentrate in the range of a few dozen layers, with hidden dimension scaling roughly in step with layer count. Vocabulary size is generally large (on the order of a hundred thousand), which makes the weight share of the output projection layer non-negligible.

    The following approximation is convenient for hand calculation and can be used to quickly estimate the non-expert parameter count:

    1. attn_params ≈ L * (4 * d^2) # QKVO, four projections
    2. mlp_params ≈ L * (3 * d * d_ff) # dense FFN, d_ff often 2.67d~4d
    3. embed_params ≈ V * d # input and output vocabulary projections
    4. total ≈ attn_params + mlp_params + embed_params

    For sparse models, rewrite mlp_params as “number of routed experts × width of a single expert,” then multiply by the activation ratio to obtain the activated parameter count. Empirically, the ratio of activated to total parameters falls between a few percent and one third, and this ratio is the first indicator of whether a model is compute-friendly or capacity-friendly.

    3. Attention: From Cache Compression to Sparse Selection

    The evolution of the attention component can be summarized along three paths, which are often combined.

    The first is low-rank cache compression. The key-value cache is projected into a lower-dimensional latent space before being stored, then projected back up during inference. Cache size can drop by an order of magnitude, at the cost of two extra matrix multiplications per step. For long-context serving, this trade is almost always worthwhile.

    The second is sparsification and windowing. Local window attention combined with a small number of global tokens pushes complexity from quadratic back to near-linear. In engineering terms, care must be taken that information is not lost at window boundaries, usually handled by global tokens or cross-layer sharing.

    The third is sparse selection in the attention computation itself, where each query attends to only a subset of keys for exact computation. This saves compute rather than cache, and places higher demands on operators due to irregular memory access.

    As a rough illustration, cache usage can be estimated as follows:

    1. kv_bytes ≈ 2 * L_kv * H_kv * d_head * ctx_len * batch * bytes_per_elem

    Here L_kv is the number of layers participating in the cache and H_kv is the number of key-value heads. Reducing H_kv to a fraction of the query head count, or lowering bytes_per_elem from 2 to 1, both yield linear gains.

    4. Mixture of Experts: Decoupling Capacity from Activation

    The core value of a sparse expert structure is decoupling total capacity from per-token computation. A typical configuration includes several routed experts plus one or two always-active shared experts: shared experts carry general capability, routed experts carry specialized capability.

    What really determines success in engineering is routing quality, not the number of experts:

    • Load balancing: auxiliary loss or bias correction prevents a few experts from being overloaded;
    • Communication pattern: under expert parallelism each token requires one all-to-all exchange, and inter-GPU bandwidth often becomes a hard lower bound;
    • Tail latency: the more activated experts, the more pronounced the long tail, so the capacity factor needs headroom.

    A rough estimate of the communication lower bound:

    1. comm_bytes ≈ tokens * hidden * top_k * bytes_per_elem

    If this value approaches or exceeds what the interconnect can transfer within one decode step, throughput cannot improve no matter how much compute is available. This is also why many deployment plans prefer fewer activated experts in exchange for more stable batching efficiency.

    5. Numerical Formats: Precision Allocation Matters More Than a Single Precision

    The current common practice is low-precision floating point for weights and compute (8-bit is mainstream), higher precision for first-order states and some reductions, and retained higher precision for sensitive layers such as normalization, output projection, and routing scores. Mixed precision is not better the more aggressive it is: routing scores and accumulation reductions are the most precision-sensitive, and once they degrade, expert selection starts to jitter, showing up as random fluctuations in output quality.

    The practical recommendation is to treat precision as a configurable item rather than a global constant:

    1. policy = {
    2. "default": "fp8",
    3. "router": "fp32", # keep precision for routing scores
    4. "norm": "fp32",
    5. "reduce": "fp32", # keep precision for cross-GPU reduction
    6. "kv_cache":"fp8" # cache can be compressed aggressively
    7. }

    6. A Headroom Method for Hardware Planning

    To turn the four threads above into planning actions, proceed in the following order:

    1. Measure the cache first: compute peak cache usage from the target context length and concurrency, and confirm whether single-card capacity is sufficient;
    2. Measure bandwidth next: compare the communication lower bound under expert parallelism against interconnect bandwidth to decide whether parallelism should be reduced;
    3. Measure compute after that: multiply activated parameters by per-token computation and check decode step latency at peak utilization;
    4. Leave headroom last: reserve 20%~30% capacity and bandwidth for the long tail, burst concurrency, and version iteration.

    When deploying in the cloud, this method maps onto a set of general capabilities: a container platform hosts inference services and elastic scaling, object storage holds model weights and datasets, a message queue smooths out peaks and fills troughs, and logging plus monitoring and alerting handle latency and memory watermark observation. This closes the loop between structural analysis and resource planning, so that when the model is iterated only the parameters need to be replaced and the evaluation process does not need to be rewritten.

    7. Common Pitfalls

    • Looking only at total parameters: ignoring the activation ratio leads to over- or under-provisioning compute;
    • Looking only at peak compute: ignoring inter-GPU bandwidth keeps sparse model throughput low;
    • Ignoring vocabulary overhead: a large vocabulary takes a noticeable share at small batch sizes;
    • Applying one precision everywhere: insufficient precision for routing and reduction causes quality jitter;
    • Leaving no headroom: long context and burst traffic hitting the ceiling at the same time.

    Master the four-part checklist of scale, attention, experts, and precision, and you can make verifiable structural inferences and resource estimates for any new model even without public details—exactly the capability that hardware and inference planning needs most.