Understanding Large Language Model Architectures and Parameter Scale

    This article breaks down the architectures and parameter scale of mainstream large language models. It explains the common decoder-only Transformer backbone, attention variants, dense versus Mixture-of-Experts feed-forward layers, position encoding, and normalization choices. It also maps parameter tiers to deployment implications, shows a rough memory-estimation formula, and offers practical guidance for reading model cards, capacity planning, and avoiding common misconceptions.

    1. Why Architecture and Parameter Scale Are the Starting Point

    Before comparing specific models, one thing needs to be clear: parameter count alone does not equal capability. What really determines a model’s performance is the product of three factors — architecture design, data quality and mixture, and training and post-training methods. Parameters set the upper bound of capacity; architecture determines whether that capacity can be used efficiently; data and training strategy determine how much effective capability the capacity finally turns into.

    From an engineering perspective, practitioners care about parameter count for three reasons: estimating inference memory and throughput, judging training and fine-tuning cost, and assessing how well a model can adapt to their own business data. The analysis below therefore focuses on actionable decision criteria rather than a plain list of numbers.

    2. The Common Skeleton of Modern LLMs

    Most contemporary LLMs follow the same basic paradigm — a decoder-only Transformer — with differences concentrated in a few replaceable modules.

    2.1 Base Layer Structure

    • Token embedding layer: maps discrete tokens to vectors. Vocabulary size typically ranges from tens of thousands to over a hundred thousand. A larger vocabulary improves multilingual and code coverage, but also increases the parameter count of the embedding and output layers.
    • Repeated transformer blocks: each block contains normalization, an attention sublayer, a feed-forward sublayer, and residual connections. Depth (number of layers) and width (hidden dimension) together determine per-layer capacity.
    • Output head: projects hidden states back to the vocabulary space, usually with weight tying to the embedding layer to save parameters.

    2.2 Evolution of the Attention Mechanism

    Standard multi-head self-attention has complexity that grows quadratically with sequence length, which directly limits the context window. The industry commonly adopts several improvements:

    • Grouped-query attention: multiple query heads share one set of key-value heads, substantially reducing key-value cache usage during inference.
    • Sliding-window and local attention: attend only to nearby regions, leaving global information to a small number of “global layers.”
    • Sparse and linear attention variants: reduce complexity approximately, at the cost of possibly weaker long-range exact retrieval.
    • Low-rank compression schemes such as multi-head latent attention: project the key-value cache into a low-dimensional latent space, trading a small cache for long-context capability.

    2.3 Feed-Forward Layers: The Divide Between Dense and Sparse

    The feed-forward layer usually accounts for the bulk of per-layer parameters and is the main source of “parameter scale.”

    • Dense feed-forward: every token activates all parameters. Training and inference behavior is stable and deployment is straightforward, but cost grows linearly with scale.
    • Mixture-of-Experts feed-forward: multiple expert subnetworks are defined, and a routing network selects a few experts per token. Its key property is that total parameter count is decoupled from activated parameter count: total parameters can be large to hold knowledge, while each step activates only a small fraction, expanding capacity while keeping inference cost manageable.

    Routing design is the hard part of engineering sparse models. Common practices include capacity-factor limits, load-balancing auxiliary losses, shared experts, and fine-grained expert splitting — all aimed at avoiding severe skew in expert usage and the resulting “bucket effect.”

    2.4 Position Encoding and Context Extension

    Rotary position encoding has become the mainstream choice. Combined with frequency scaling, position interpolation, or segmented extrapolation, it extends a training window of a few thousand tokens to hundreds of thousands or even millions. Note that nominal window length often differs from effective retrieval length; evaluation should rely on actual performance on tasks such as locating key information in long documents.

    2.5 Normalization and Activation Functions

    Pre-normalization combined with residuals is the common recipe for training stability. On activations, gated linear unit designs (branch multiplication with gating) have become the de facto standard, generally giving better convergence at the same parameter count.

    3. Parameter Tiers and Their Engineering Implications

    By common industry usage, parameter scale can be roughly divided into tiers, each mapping to a different deployment shape:

    Tier Typical Positioning Deployment Implication
    Below a billion On-device, high-frequency simple tasks A single GPU or even consumer hardware
    Hundreds of millions to tens of billions General chat, lightweight business use Single GPU or single node with multiple GPUs, controllable latency
    Tens of billions Mainstream general-purpose models Multi-GPU tensor parallelism, careful memory planning
    Hundreds of billions and above Hard reasoning, complex agents Multi-node GPU clusters, sparsification almost mandatory

    A practical inference: once total parameters reach the hundreds of billions, a dense structure makes training and inference cost hard to bear, so models around this tier generally shift to sparse feed-forward. This also explains why “hundreds of billions of total parameters, tens of billions activated” has become the common shape of flagship models.

    A rough estimate of memory usage can be written as the following illustrative logic (expressing order-of-magnitude relationships only, not any specific implementation):

    1. Inference memory ≈ parameters × bytes per parameter (weights)
    2. + layers × 2 × KV heads × head dim × sequence length × bytes per element (cache)
    3. + activations and temporary buffers

    Take half precision as an example: the weight portion is roughly “parameters × 2 bytes.” A dense 70-billion-parameter model needs about 140 GB for weights alone, before counting cache and runtime overhead. A sparse model with the same total parameters has similar weight usage, but compute drops significantly by the activation ratio — the core value of sparse architectures: trading memory for throughput.

    4. How to Read Structural Information in a Model Card

    When facing a technical report or model card, extract key information in this order:

    1. Total and activated parameters: indicates capacity and per-step cost; their ratio reflects the degree of sparsification.
    2. Layers, hidden dimension, attention heads, and key-value heads: reconstructs the width-to-depth ratio and hints at key-value cache pressure.
    3. Number of experts and routing strategy: indicates load-balancing difficulty and fine-tuning feasibility.
    4. Vocabulary size: affects the embedding parameter share and multilingual capability.
    5. Context length and position encoding scheme: indicates real usability on long-document tasks.
    6. Post-training description: differences in supervised fine-tuning, preference optimization, and reinforcement learning with verifiable rewards often affect the final experience more than architectural differences.

    5. General Practices for Selection and Capacity Planning

    • Start with a small-scale baseline: validate the data pipeline and evaluation set with a billion-scale model before scaling up, avoiding burning compute in the wrong direction.
    • Select by business metrics, not leaderboards: build an evaluation set that fits your own scenario, covering long-document retrieval, structured output, tool calling, and multi-turn consistency.
    • Separate training cost from always-on cost: sparse models are cheaper to train but cost more in resident memory, while small dense models are the opposite; do the total accounting by call pattern.
    • Leave room for fine-tuning: prefer open-weight options with public architecture and sufficient disclosure of tokenizer and training details, making parameter-efficient fine-tuning easier.
    • Make good use of general cloud capabilities: container platforms host inference services, object storage holds weights and datasets, message queues smooth request spikes, and logging plus monitoring with alerts handle observability. General-purpose capabilities from cloud platforms such as Baidu AI Cloud can serve as the underlying foundation; refer to the official documentation for specific specifications.

    6. Common Misconceptions

    • Treating total parameters as a capability metric: a sparse model’s total includes a large amount of capacity not currently in computation.
    • Treating nominal context as effective context: long-document key-information recall needs to be measured.
    • Ignoring tokenizer impact: at the same parameter count, differences in tokenization efficiency cause noticeable swings in cost and quality.
    • Overlooking hidden losses from quantization: low-bit quantization is more sensitive on long-chain reasoning and code tasks, so task-level validation is needed.

    7. Summary

    The architectural mainline of modern LLMs has converged considerably: a decoder-only skeleton, rotary position encoding, gated feed-forward, grouped or low-rank compressed attention, plus sparse expert layers to decouple capacity from cost. Understanding the four coordinates — total parameters, activated parameters, context, and post-training — is enough to make an engineering judgment about most models, without being led by specific model names or marketing numbers.