Understanding Large Language Model Architecture and Parameter Scale: A Technical Guide

    This article breaks down the two key factors that define large language model capability and deployment cost: network architecture and parameter scale. It explains dense versus Mixture-of-Experts (MoE) designs, attention variants, positional encoding, and normalization choices, then maps parameter tiers to practical trade-offs. Readers will find an actionable engineering checklist covering quantization, parallelism, serving, observability, and evaluation, plus common misconceptions to avoid.

    1. Why Architecture and Parameter Scale Are the Two Core Dimensions

    When evaluating any large language model, its capability ceiling and deployment cost are usually determined by just two factors: network architecture (the architectural paradigm) and parameter scale (including activated parameters). Architecture governs how information flows within and across layers, while parameter scale sets the model’s capacity and the lower bound on GPU memory and compute. The design space created by combining these two is far more complex than the simplistic notion that “bigger is always better.”

    From an engineering perspective, architecture determines parallelism strategy and operator characteristics, while parameter scale determines how the model is sharded and the memory budget. Explaining these two points clearly is almost equivalent to providing a deployment feasibility assessment.

    2. A Breakdown of Mainstream Architectural Paradigms

    2.1 Dense Feed-Forward and Mixture of Experts (MoE)

    In dense models, every token passes through all parameters, so compute is roughly linear in parameter count. The advantages are stable training and predictable inference paths. Sparse Mixture-of-Experts architectures introduce a router that selects a small number of experts per token, creating a decoupling of “large total parameters, small activated parameters.”

    1. # Illustrative: abstract logic of an MoE forward pass (not any specific implementation)
    2. logits = router(hidden) # [batch, seq, num_experts]
    3. idx, gate = top_k(logits, k=2) # select k experts per token
    4. out = sum(gate[i] * experts[idx[i]](hidden) for i in range(k))

    The engineering implication is straightforward: GPU memory must be provisioned for total parameters, while compute (FLOPs) is estimated from activated parameters. This explains why models with very large total parameter counts can still achieve acceptable per-request cost in certain throughput scenarios. It also introduces new challenges such as uneven expert load and amplified cross-device communication, typically mitigated with capacity factors, load-balancing losses, and expert parallelism.

    2.2 The Evolution of Attention Mechanisms

    Multi-head attention is the baseline. To reduce key-value cache overhead during inference, the industry commonly adopts grouped-query attention or key-value head sharing, which reduces cache size proportionally to the number of heads. More aggressive approaches include multi-query attention, low-rank key-value compression, and replacing some global attention with local windowed or linear attention hybrid layers. The shared goal of these changes is to contain memory and bandwidth pressure under long context.

    2.3 Positional Encoding and Context Extension

    Rotary position embeddings combined with frequency scaling, position interpolation, or segmented extrapolation are the mainstream approach for extending context windows today. Note that nominal context length is not equivalent to effective context length; “needle-in-a-haystack” retrieval and multi-hop reasoning tests on real tasks are needed to verify actual performance.

    2.4 Normalization, Residuals, and Activation Functions

    Pre-normalization with residuals, RMS-style normalization, and SwiGLU-style gated activations have become the de facto standard. They significantly affect convergence stability and deep-network trainability, making them a “low-cost, high-return” structural choice.

    3. Parameter Scale Tiers and Trade-Offs

    The industry generally groups models into four rough tiers for easier communication and selection:

    Tier Total Parameter Scale Typical Trade-Off
    On-device / lightweight Below a billion to a few billion Low latency, local deployment, privacy-friendly
    General-purpose workhorse A few billion to tens of billions Balances quality and cost, covers most business needs
    Flagship dense Hundreds of billions High quality ceiling, high inference cost
    Very large sparse Hundreds of billions total, a few billion activated Balances capacity and compute, highest engineering complexity

    It is important to emphasize that activated parameters predict per-request compute cost better than total parameters, while total parameters affect GPU memory and knowledge capacity more. Both numbers should be considered during selection, not just one.

    4. From Architecture to Deployment: An Actionable Engineering Checklist

    1. Precision and quantization: Weight-only low-bit quantization, activation quantization, and key-value cache quantization can be combined, with task-level regression testing to validate accuracy loss.
    2. Parallelism strategy: Tensor parallelism reduces per-layer memory, pipeline parallelism reduces layers per device, expert parallelism supports sparse structures, and data parallelism increases throughput; all three must be matched to the bandwidth topology.
    3. Serving mode: For throughput priority, use continuous batching and paged cache management; for latency priority, limit batch size and optimize time to first token.
    4. Observability: Use a container platform to host inference services, and use logging and monitoring/alerting to track queue time, cache hit rate, and memory watermarks; models and datasets can be stored in object storage, and a message queue can be used for request peak shaving.
    5. Evaluation loop: Establish a dual-dimension regression across a capability set (reasoning, code, long-form, multi-turn) and a cost set (time to first token, cost per thousand tokens) to avoid being misled by single-point metrics.

    5. Common Misconceptions

    • Looking only at total parameters while ignoring activated parameters and cache overhead;
    • Treating nominal context length as effective context length;
    • Using general leaderboards instead of business-specific evaluation sets;
    • Ignoring the additional cross-device communication cost of sparse architectures.

    6. Conclusion

    Understanding large language models is fundamentally about understanding that “architecture determines how data flows, and parameter scale determines the resource floor.” By evaluating dense and sparse designs, attention variants, positional encoding, and quantization and parallelism on a single selection table, and by building an evaluation and deployment loop on top of general capabilities such as containers, object storage, logging, and monitoring offered by Baidu AI Cloud, you can achieve a controllable balance among quality, latency, and cost.