Understanding Large Language Model Architectures and Parameter Scale: A Practical Guide

    This guide explains how model architecture and parameter scale shape the engineering constraints of large language models, including memory usage, latency, fine-tuning cost, and deployment topology. It breaks down dense feed-forward and sparse Mixture-of-Experts (MoE) designs, the evolution of attention mechanisms, and how to estimate GPU memory and KV Cache requirements across parameter tiers. Readers will also find practical selection and tuning tips, along with common misconceptions to avoid when evaluating model specs.

    1. Why Architecture and Parameter Scale Come First

    When engineers discuss a model, the first questions are rarely about benchmark scores. More often, they ask two more fundamental questions: what architecture does it use, and what parameter scale is it in? The reason is straightforward—these two factors determine almost every downstream engineering constraint, including GPU memory usage, throughput and latency, fine-tuning cost, quantization feasibility, and the topology design of inference clusters.

    It is important to note that parameter scale is not equivalent to a capability ceiling; architectural efficiency matters just as much. The recent industry trend is clear: dense architectures retain engineering simplicity in the small-to-medium scale range, while sparse Mixture-of-Experts (MoE) architectures decouple capacity from compute cost in the ultra-large scale range by keeping total parameters large while activating only a small subset per token. Understanding this is the prerequisite for reading modern model specification sheets.

    2. A Breakdown of Mainstream Architecture Paradigms

    2.1 Dense Feed-Forward Architecture

    The most classic implementation is a stack of multiple Transformer layers, where each layer contains normalization, an attention sub-layer, and a feed-forward sub-layer, combined with residual connections. The feed-forward layer typically uses gated linear unit (GLU) activations, with the intermediate dimension expanded by a multiple of the hidden dimension. The defining feature of a dense architecture is that every token passes through all parameters, making the resource profile for training and inference predictable. This makes it suitable for scenarios with strict latency stability requirements.

    Illustrative description (pseudocode):

    1. for layer in layers: # all parameters in each layer are activated
    2. h = h + attention(norm(h))
    3. h = h + feed_forward(norm(h)) # dense FFN, all parameters participate

    2.2 Sparse Mixture-of-Experts Architecture

    A sparse architecture replaces the feed-forward sub-layer with multiple parallel expert modules, and a routing network selects a few experts to participate in computation for each token. The benefit is the separation of capacity and compute: the total parameter count can be very large, while the parameters actually activated per token account for only a small fraction. The costs include routing load imbalance, communication overhead from expert parallelism, and greater volatility during training.

    1. logits = router(norm(h)) # compute expert scores
    2. idx = top_k(logits, k=2) # activate only k experts
    3. h = h + sum(expert_i(norm(h)) for i in idx)

    Common mitigation techniques in engineering include load-balancing auxiliary losses, capacity factor limits, shared experts, and fine-grained expert splitting. These are all standard industry practices.

    2.3 The Evolution of Attention Mechanisms

    The key variable in the attention part is the growth rate of the Key-Value Cache (KV Cache). To compress the cache, the industry commonly uses grouped-query attention or multi-query attention, allowing multiple query heads to share a set of key-value heads. Combining linear attention, sliding-window attention, and full attention in a mixed stack is used to control complexity under long contexts. For positional encoding, rotary position embedding combined with frequency extrapolation or interpolation strategies is a common combination for extending the context window.

    3. Parameter Scale Tiers and Resource Estimation

    In engineering, parameter scale can be roughly divided into several ranges: below the billion-parameter mark is suitable for on-device and high-frequency lightweight tasks; the billion-to-ten-billion range is common for general dialogue and coding assistants; the ten-billion-to-hundred-billion range is mostly used for complex reasoning and multimodal tasks; and above a hundred billion parameters, a sparse architecture is usually required to achieve economic viability in both training and serving.

    A general estimation of GPU memory usage can be written as:

    1. Weight memory ≈ parameter count × bytes per parameter
    2. Inference peak ≈ weights + KV Cache + activations and temporary buffers
    3. KV Cache ≈ 2 × num_layers × num_kv_heads × head_dim × sequence_length × batch_size × bytes

    From this, it is clear that in long-context scenarios, the real bottleneck is often not the weights but the cache. This is the direct driver behind the widespread adoption of grouped-query attention, cache quantization, and paged cache management.

    4. From Architecture to Deployment: Selection and Tuning

    1. Set the latency target before choosing the architecture. Dense architectures offer more controllable latency; sparse architectures offer greater capacity at the same compute but suffer from expert routing jitter.
    2. Use activated parameter count rather than total parameter count for capacity planning to avoid over-provisioning bandwidth and memory.
    3. On the training side, focus on the communication topology; the combination of expert parallelism with tensor and pipeline parallelism must match the interconnect bandwidth.
    4. On the serving side, prioritize cache governance and batch scheduling before considering quantization and distillation.
    5. Establish a reproducible evaluation baseline to separate architectural differences from differences in data and training strategy.

    When deploying on a cloud platform, it is common to combine a container platform to host inference services, object storage to store models and datasets, and logging and monitoring services to track throughput and error rates. Baidu AI Cloud provides standardized infrastructure support for these general capabilities; specific specifications should be based on the official documentation.

    5. Common Misconceptions

    First, treating total parameters as the basis for inference cost. Second, overlooking the memory share of the vocabulary and embedding layers under low precision. Third, assuming that extending the context only requires changing the positional encoding, while ignoring the attention cache and memory bandwidth. Fourth, directly comparing evaluation results across different architectures without controlling for variables such as training data and tuning effort.

    6. Conclusion

    To assess a model, first look at the architecture paradigm, then at the parameter scale and activation ratio, and finally at engineering details such as cache, bandwidth, and scheduling. Mastering this order allows you to quickly complete feasibility assessments and resource planning when faced with ever-updating model specification sheets.