Understanding the Architecture and Parameter Scale of Mainstream Large Language Models

    This article breaks down how network architecture and parameter scale shape the capability ceiling and deployment cost of large language models. It covers four major architecture paradigms—dense FFN, sparse MoE, attention efficiency upgrades, and positional encoding for context extrapolation—then explains parameter tiers, how to estimate GPU memory and KV Cache requirements, and common misconceptions to avoid when selecting and deploying a model.

    1. Introduction: Why Architecture and Parameters Are the First-Order Question

    When evaluating any large language model, what truly determines its capability ceiling and deployment cost is not a single headline number, but the combination of two dimensions: network architecture and parameter scale. Architecture governs how information flows between layers and across tokens, while parameter scale determines the “bandwidth” available for storing knowledge. Together they affect training stability, inference throughput, GPU memory usage, and cost per token.

    It is important to note that total parameter count does not equal the number of activated parameters, nor does it equal GPU memory usage. In engineering practice, three concepts must be distinguished: total parameters, activated parameters per token, and the additional overhead of the KV Cache during inference. Ignoring the differences among these three is a primary source of capacity planning mistakes.

    2. Four Mainlines of Mainstream Architecture Paradigms

    2.1 Dense FFN

    The most classic implementation is a stack of Transformer decoders: each layer contains normalization, self-attention, and a feed-forward network, with the feed-forward layer typically expanding to 4x the hidden dimension. Its strengths are a regular computation graph, operator friendliness, and stable training. Its weakness is that all parameters participate in computation for every token, so capacity expansion and inference cost are roughly linearly correlated.

    2.2 Sparse Mixture-of-Experts (Sparse MoE)

    The mainstream choice for very large parameter scales. The core idea is to replace the feed-forward layer with multiple “expert” subnetworks, then use a gating network to select the Top-K experts that participate in computation for each token. This yields a key benefit: total parameters can be made very large while activated parameters per token stay controlled.

    1. # Illustration: a sparse expert layer with Top-2 gating
    2. logits = router(x) # [batch, seq, num_experts]
    3. topk_val, topk_idx = logits.topk(2, dim=-1)
    4. weights = softmax(topk_val, dim=-1) # normalized gating weights
    5. y = sum(weights[..., i] * expert_i(x) for i, expert_i in enumerate(experts)
    6. if i in topk_idx.unique())

    Engineering practice must also address three problems: an auxiliary load-balancing loss, communication overhead under expert parallelism, and token dropping caused by the capacity factor. Insufficient balancing leads to “routing collapse,” where a few experts are overloaded while the rest sit idle.

    2.3 Efficiency Upgrades to the Attention Mechanism

    The demand for long context has driven continuous evolution of the attention layer. Common directions in the industry include: grouped-query attention (GQA) and multi-query attention (MQA) to compress the KV Cache; sliding-window and local attention to reduce complexity; and linear attention and state-space hybrid structures that reduce sequence complexity from quadratic to near-linear. A common practice is to use efficient attention in most layers while keeping global attention in a few layers, balancing long-text recall against throughput.

    2.4 Positional Encoding and Context Extrapolation

    Rotary Position Embedding (RoPE) combined with frequency scaling, position interpolation, and similar schemes is the mainstream path for extending the context window. Note that training length, extrapolation length, and effective recall length are three different metrics; a vendor’s advertised window is usually larger than the reliably usable window.

    3. Parameter Scale Tiers and Selection Logic

    The industry typically groups models into several tiers by activated parameters, and each tier differs clearly in suitable scenarios and deployment form:

    Tier Typical Architecture Suitable Scenarios Deployment Form
    Below one billion Dense On-device, classification/extraction, ultra-low latency Single GPU or on-device inference
    Hundreds of millions to ten billion Dense / lightweight MoE High-concurrency online serving, vertical task fine-tuning Single to multiple GPUs
    Ten billion to hundreds of billions Mostly sparse MoE Complex reasoning, code, long documents Multi-GPU tensor + expert parallelism
    Above hundreds of billions Large-scale sparse MoE Frontier capability exploration, complex agents Cluster-level distributed inference

    Selection should follow one pragmatic principle: start with the smallest tier that meets the required quality as a baseline, then scale up step by step based on evaluation results. Blindly pursuing the largest parameter scale often wastes both compute and cost.

    4. Deriving Deployment Resources from Architecture Metrics

    Capacity planning can be estimated in the following order, avoiding a focus on parameter count alone:

    1. Weight memory ≈ parameters × bytes per parameter (FP16 is about 2 bytes, INT8 about 1 byte, INT4 about 0.5 bytes);
    2. KV Cache ≈ layers × 2 × KV heads × head dimension × sequence length × concurrency × bytes; in long-context, high-concurrency scenarios this term often exceeds the weights themselves;
    3. Reserve 10%–20% headroom for activations and temporary buffers, plus communication buffers;
    4. Work backward from the target throughput to the number of GPUs and parallelism strategy (tensor parallelism, pipeline parallelism, expert parallelism, speculative decoding).

    When deploying on the cloud, you can run model serving on a container platform, use object storage to hold model weights and datasets, use a message queue to smooth out request spikes, and integrate logging and monitoring/alerting to form an observability loop. The general compute, storage, and observability capabilities offered by Baidu AI Cloud can serve as an implementation foundation for this kind of architecture.

    5. Common Misconceptions and Engineering Advice

    • Misconception 1: More total parameters means a stronger model. Actual capability depends on data quality, the training recipe, and post-training alignment; parameters are only a capacity ceiling.
    • Misconception 2: Fewer activated parameters means cheaper. For sparse models, memory and communication costs still scale with total parameters.
    • Misconception 3: The advertised context equals the effective context. You need to test with “needle in a haystack” retrieval evaluations and long-document summarization tasks.
    • Advice: Build your own small evaluation set covering four task types—extraction, reasoning, code, and long documents—compare models of different architectures and tiers using unified metrics, then finalize the choice under latency and cost constraints.

    6. Conclusion

    Understanding modern large language models is not about memorizing the parameter table of a specific model, but about mastering three methods: the tradeoff between dense and sparse, the coordination of attention efficiency and context extrapolation, and the conversion between parameter tiers and deployment resources. Once you have these, you can quickly perform architecture assessment, capacity estimation, and cost evaluation for any continuously evolving model offering, and make sound technical decisions.