Understanding Modern LLM Architectures and Parameter Scale

    This article breaks down the two defining dimensions of modern large language models: architecture and parameter scale. It explains dense and Mixture-of-Experts (MoE) designs, attention and long-context techniques, and multi-token prediction, then covers typical parameter ranges, deployment considerations such as memory estimation and parallelism, and common misconceptions to avoid.

    1. Why Architecture and Parameter Scale Come First

    When engineers discuss a model, two dimensions come up most often: network architecture and parameter scale. Architecture determines computational complexity, memory footprint, and how the model can be sharded for parallelism. Parameter scale directly affects training cost, inference throughput, and the upper bound on quality.

    One important clarification: parameter scale is not a single “total parameter count” number. Modern models commonly use sparse activation, so you must distinguish between total parameters and activated parameters per token.

    Across the industry, a few relatively stable technical routes have emerged: dense architectures, Mixture-of-Experts (MoE) architectures, and enhanced variants that add multi-token prediction, linear or hybrid attention, and long-context extensions. The sections below follow these general paradigms.

    2. Breaking Down the Mainstream Architectures

    2.1 Dense Feed-Forward Architecture

    The classic Decoder-only Transformer: each layer contains normalization, self-attention, a feed-forward network, and residual connections. Most parameters sit in the FFN, whose intermediate dimension is typically about 2.67 to 4 times the hidden dimension. Dense architectures offer stable inference and predictable memory usage; the downside is that all parameters are activated, so compute efficiency per unit of compute is relatively low.

    Illustrative configuration:

    1. # Core dimension relationship in a dense layer (illustrative)
    2. hidden = 4096
    3. ffn = int(hidden * 2.67) # commonly 8/3 times
    4. params_per_layer ≈ 12 * hidden ** 2

    2.2 Mixture-of-Experts (MoE) Architecture

    The FFN is replaced with multiple expert networks plus a gating router, and each token activates only the Top-K experts (commonly K=1, 2, 4, or 8). The key metrics are:

    • Total parameters: determine knowledge capacity;
    • Activated parameters: determine actual compute cost;
    • Expert granularity and shared experts: fine-grained experts plus a few shared experts can improve routing stability;
    • Load-balancing loss and capacity factor: prevent routing collapse.

    Engineering implication: a model with hundreds of billions of total parameters but only a few billion activated has inference cost close to a dense model with the same activated size, yet memory must hold all expert weights. This is why decoupling memory from compute is the defining feature of MoE deployment.

    2.3 Attention Mechanisms and Long-Context Evolution

    Long context mainly relies on three techniques: positional encoding extrapolation (rotary position embeddings with frequency scaling), sparse or block attention, and linear or gated hybrid attention layers. A common recent approach keeps standard attention in most layers and replaces some layers with linear attention or sliding-window attention, reducing complexity from quadratic to near-linear on long sequences.

    2.4 Multi-Token Prediction and Training Objective Improvements

    Adding several auxiliary prediction heads alongside the main prediction head lets the model learn to predict multiple future tokens in a single forward pass. The benefits cut both ways: during training, it improves sample efficiency and representation quality; during inference, it can pair with speculative decoding to merge drafting and verification, increasing decoding parallelism.

    3. Common Parameter Ranges and Selection Logic

    Scenario Architecture Preference Parameter Range (general reference)
    On-device / real-time Small dense model 1B–8B
    General conversation Dense or lightweight MoE 7B–70B
    Hard reasoning Sparse MoE Hundreds of billions total, a few billion activated
    Very long document processing Hybrid attention + long context Moderate activated size + long window

    When selecting a model, focus on four metrics rather than parameter count alone: activated parameters, context window, feasibility of expert parallelism, and memory-bandwidth pressure per token.

    4. Deployment and Optimization Practices

    1. Memory estimation: weight memory ≈ parameters × bytes per parameter (2 bytes for FP16, 1 byte for INT8), plus KV Cache. KV Cache scales with “layers × heads × head dimension × sequence length × batch size,” and in long-context scenarios it is often the real source of the memory bottleneck.
    2. Parallelism strategy: dense models commonly use tensor parallelism plus pipeline parallelism; MoE relies more on expert parallelism, requiring attention to cross-device communication volume and routing imbalance.
    3. Quantization and distillation: weight quantization reduces bandwidth pressure, and distillation transfers capability from a large model to a small one; the two are often combined.
    4. Inference acceleration: continuous batching, paged KV management, and speculative decoding are general and mature directions.
    5. Observability: using monitoring, alerting, and logging services to track throughput, time-to-first-token latency, and memory levels is the foundation of capacity planning.

    5. Common Misconceptions

    • Treating total parameter count as a measure of compute cost;
    • Ignoring the amplifying effect of KV Cache on long context;
    • Assuming a longer context window always yields better results, while overlooking “effective context” decay;
    • Comparing different architectures by parameter count alone, without looking at activated size and data quality.

    6. Conclusion

    The key to understanding modern LLMs is to evaluate the architecture paradigm and the three parameter factors (total, activated, and KV overhead) on the same chart. Whether dense or sparse, the core of engineering deployment is always finding a verifiable balance among quality, latency, and cost. On platforms such as Baidu AI Cloud, you can combine general capabilities like container platforms, object storage, and monitoring and alerting to build a complete loop from training to inference.