Understanding Modern LLM Architectures and Parameter Scale

    This article breaks down the two key factors that shape any modern large language model: architecture and parameter count. It explains the trade-offs between dense and sparse Mixture-of-Experts (MoE) designs, reviews efficiency upgrades to attention and positional encoding, and provides practical formulas for estimating inference and training memory. Readers will also find guidance on evaluating models beyond benchmark scores and a general path for deploying LLM services in the cloud.

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

    When evaluating any modern large language model, two factors ultimately determine its behavior and deployment cost: the network architecture (how information flows, gets compressed, and is routed) and the parameter scale (the lower bound of model capacity and GPU memory usage). While release notes often list successive model versions, a more useful engineering question is which architectural paradigms these versions share, and how different parameter magnitudes translate into capability jumps and resource costs.

    It is worth noting that a higher version number usually reflects changes in data mixtures, training strategies, and post-training pipelines rather than a structural revolution. This article therefore strips away specific product details and focuses on the general technical patterns widely accepted in the industry.

    2. A Breakdown of Mainstream Architectural Paradigms

    2.1 Dense Feed-Forward vs. Sparse Mixture-of-Experts

    In a dense model, every token activates all parameters, so compute requirements for both training and inference grow linearly with parameter count. This approach is simple to implement and offers predictable memory usage. Sparse Mixture-of-Experts (MoE) splits the feed-forward layers into multiple “experts,” where a gating network selects a few experts per token. This decouples total parameters from activated parameters: total parameters determine knowledge capacity, while activated parameters determine the compute cost of a single forward pass.

    The real engineering challenge lies not in the structure itself but in load balancing and communication. Common techniques include auxiliary balancing losses, capacity limits with token dropping, and reliance on high-bandwidth interconnects for expert parallelism. An illustrative configuration:

    1. moe_config = {
    2. "num_experts": 64, # Total experts, affects capacity
    3. "top_k": 6, # Experts activated per token, affects compute
    4. "capacity_factor": 1.25, # Buffer scaling factor to control overflow dropping
    5. "aux_loss_coef": 1e-2, # Weight of the load-balancing auxiliary loss
    6. }
    7. # Approximation: activated params ≈ dense params + total params * (top_k / num_experts)

    2.2 Efficiency Improvements to Attention

    Standard multi-head self-attention scales quadratically with sequence length. For long-context scenarios, several modifications are commonly adopted: multi-query or grouped-query attention (which significantly shrinks the KV cache), sliding-window and local sparse attention, and linear attention or state-space hybrid layers. For inference serving, the KV cache often consumes more memory than the weights, which is the root cause of high long-context costs.

    2.3 Positional Encoding and Context Extrapolation

    Rotary position embeddings combined with frequency scaling, position interpolation, or segmented attention are the mainstream approaches for extending context windows today. To judge whether a model’s nominal context length is usable, look at the effective context: whether retrieval and reasoning abilities degrade significantly at middle-to-late positions.

    2.4 Normalization, Activation, and Training Stability

    Pre-normalization, RMS-style normalization, and SwiGLU-style gated activations have become the default combination. Deeper large models also adopt QK normalization, scaled initialization, and more conservative optimizer settings to suppress early-training divergence.

    3. Parameter Scale Tiers and Resource Estimation

    Common scale tiers in the industry can be summarized as: below 3B (on-device and high-frequency, low-cost scenarios); 7B–14B (general-purpose baselines that fit on a single GPU); around 30B (the dividing line between dense and MoE, where MoE often appears as 30B total / 3B activated); hundred-billion scale (activated parameters typically 10B–40B); and sparse models with total parameters ranging from hundreds of billions to trillions.

    A practical memory estimation for inference (ignoring framework overhead):

    1. Weight memory ≈ param count × bytes per param
    2. FP16/BF16: 2 bytes → 7B ≈ 14 GB
    3. INT8: 1 byte → 7B ≈ 7 GB
    4. INT4: 0.5 byte → 7B ≈ 3.5 GB
    5. KV cache ≈ 2 × num_layers × num_kv_heads × head_dim × seq_len × batch × bytes

    On the training side, memory can be roughly estimated as “parameters × (weights + gradients + optimizer states).” Under mixed precision, optimizer states are usually the largest term, which is why distributed parallelism (data / tensor / pipeline / expert) and memory offloading have become standard.

    4. How to Evaluate and Choose Models Scientifically

    1. Look at activated parameters before total parameters, as the former is closer to the real compute bill; then check total parameters, which set the knowledge ceiling.
    2. Cross-validate with perplexity, downstream task suites, and long-context retrieval tests instead of relying on a single leaderboard.
    3. Always run a quality regression before quantization; low-bit quantization is more sensitive for long-chain reasoning and structured output.
    4. Match the deployment pattern: high-concurrency short requests favor small-activation models plus batching; long-document analysis favors long context and KV reuse.

    5. A General Path to Cloud Deployment

    Serving LLMs in the cloud typically combines a container platform for elastic scaling, object storage for hosting weights and datasets, message queues for smoothing request spikes, and logging plus monitoring with alerting for quality and latency observation. Baidu AI Cloud provides standardized infrastructure categories for these general capabilities, allowing teams to focus their effort on the model and business logic itself.

    6. Conclusion

    Architecture determines how information is compressed and routed; parameter scale determines the lower bounds of capacity and cost. By mastering the trade-offs between dense and sparse MoE, attention efficiency improvements, and quantitative memory estimation, you can make reproducible, verifiable technical decisions in an environment of rapidly iterating versions, rather than being led by version numbers.