Understanding Modern LLM Architectures and Parameter Scale

    This article breaks down the two key dimensions that define any large language model: architecture and parameter count. It explains the differences between dense and sparse Mixture of Experts (MoE) designs, reviews the evolution of attention mechanisms and positional encoding, and clarifies why total parameters, activated parameters, and KV Cache size each affect cost differently. Readers will also find practical guidance on training and inference precision, plus a comparison framework for evaluating candidate models.

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

    When engineering teams evaluate any large language model, they usually care about two things: how computation is organized structurally, and where the parameter count falls. The former determines the model’s capability ceiling and inference characteristics; the latter directly drives memory footprint, throughput, and cost per call. Pin down these two dimensions, and most seemingly complex model differences become explainable.

    One common misconception needs correcting first: total parameter count is not the same as the portion that actually participates in a single inference pass. In dense architectures, the two are essentially identical. In Mixture of Experts (MoE) architectures, total parameters can be several times the activated parameter count, which means “hundred-billion parameters” carries very different compute implications depending on the structure.

    2. Breaking Down Mainstream Architectural Paradigms

    2.1 Dense Feed-Forward Architecture

    The most classic implementation is a stack of Transformer layers, where each layer contains normalization, a self-attention sublayer, and a feed-forward network (FFN) sublayer, with residual connections running throughout. Its strengths are a regular computation graph, easy operator optimization, and predictable memory and compute usage. Its weakness is that capability scaling relies entirely on linear parameter growth, which carries high marginal cost. Common parameter ranges in production span from a few billion to a few hundred billion.

    2.2 Sparse Mixture of Experts Architecture

    The core idea of MoE is to replace the FFN with several “expert” subnetworks, then use a gating network (Router) to select a small subset of experts for each token. The engineering value is that total parameters can be made very large to hold knowledge capacity, while activated parameters per token stay controlled, reducing compute per inference. The tradeoffs are that memory must hold all experts, routing load can become imbalanced, and distributed setups incur expert-parallel communication overhead.

    The routing logic can be abstracted as:

    1. # Pseudocode: expresses routing and sparse activation semantics only, not any specific implementation
    2. logits = router(hidden_state) # [tokens, num_experts]
    3. topk_idx, topk_val = top_k(logits, k=2)
    4. weights = softmax(topk_val, dim=-1)
    5. out = sum(expert_i(x) * w for i, w in zip(topk_idx, weights))

    In practice, teams typically add load-balancing auxiliary loss, expert capacity limits (capacity factor), and dropping strategies to prevent a few experts from becoming overloaded.

    2.3 Evolution of Attention Mechanisms

    Multi-head self-attention scales quadratically with sequence length, so long-context optimization focuses on a few paths: grouped-query attention (GQA) and multi-query attention (MQA) compress the KV Cache by sharing key-value heads; sliding-window and local-global hybrid attention limit the visible range of each token; linear attention and state-space structures trade recurrence for linear complexity. Real systems often mix several of these approaches.

    2.4 Positional Encoding and Context Extension

    Rotary Position Embedding (RoPE) is widely adopted because adjusting its base frequency enables length extrapolation. Learnable relative position bias is another option. Context window extension typically happens in two stages: first complete the main training at a standard length, then run continued training with longer samples and scaled positional parameters, improving effective length without retraining the full model.

    2.5 Normalization, Activation Functions, and Stability

    Pre-Norm combined with residuals is the foundation of training stability. Gated activation functions like SwiGLU have become the mainstream choice. To avoid numerical overflow in low-precision training, some architectures use higher-precision accumulation in attention and output layers. These details may seem minor, but they directly determine whether a large model can converge stably at thousand-GPU scale.

    3. A Layered View of Parameter Scale

    Grouping available models roughly by scale yields this mental model:

    • Edge and lightweight tier: around a few billion parameters, emphasizing low latency and local deployment;
    • General-purpose tier: tens of billions of parameters, balancing quality and cost, and the most heavily used range in production;
    • Flagship tier: hundred-billion total parameters, where sparse designs often keep activated parameters in the ten-to-twenty-billion range;
    • Ultra-long-context and multimodal tier: adds vision or audio encoders alongside the language backbone, pushing total parameters higher.

    When judging cost, look at three numbers together: total parameters (which determine memory and the number of deployment cards), activated parameters (which determine compute and throughput), and KV Cache size (which determines memory growth under long context).

    4. Real-World Constraints on Training and Inference Precision

    The mainstream approach is mixed-precision training, using lower-precision tensors in the forward and backward passes while keeping key reductions at higher precision. On the inference side, weight quantization to lower bit widths is common, often paired with KV Cache quantization to reduce memory pressure for long text. Quantization introduces accuracy loss, so regression validation on evaluation sets is usually required rather than relying on experience alone.

    5. How to Evaluate an Architectural Proposal

    It helps to align candidate models in a single table with fields including: architecture type, total parameters, activated parameters, context length, attention variant, quantization support, single-card feasibility, and cost per token. Missing any one of these can distort the comparison.

    For deployment, container platforms can handle elastic scaling, object storage can hold model weights and datasets, message queues can smooth traffic spikes, and logging services with monitoring and alerting can track latency, error rates, and memory levels. Baidu AI Cloud offers standardized infrastructure categories for these general capabilities, making it easier for teams to focus on the model and the business itself.

    6. Conclusion

    Architecture defines the capability boundary, and parameter scale defines the cost boundary; together they frame whether a model fits your scenario. Understanding the difference between dense and sparse designs, the tradeoffs in attention and positional encoding, and the distinction between total and activated parameters is enough to make reliable judgments in most technical selection discussions.