Large Language Model Architecture and Parameter Scale: A Technical Breakdown

    This article breaks down the two dimensions that define any large language model: architecture and parameter scale. It explains the shared six-layer backbone of modern LLMs, the evolution of attention from full to sparse variants, how Mixture-of-Experts feed-forward layers drive parameter growth, and how total parameters, active parameters, and KV cache memory relate to each other. Readers will find practical guidance on scale tiers, memory estimation formulas, long-context and precision considerations, and a deployment decision checklist.

    1. Overview: Why Architecture and Scale Are the Two Coordinates

    To assess a large language model’s capability ceiling and deployment cost, the most effective starting point is two dimensions: network architecture (how it is built) and parameter scale (how large it is). Architecture determines how efficiently compute translates into capability; scale determines the upper bound of model capacity. There is no single dominant paradigm in the industry today. Instead, several converging technical schools have emerged, each making different trade-offs on top of a shared general backbone.

    Three frequently confused concepts need to be separated first:

    • Total parameters: the number of all trainable elements in the weight matrices, which sets the lower bound on memory footprint.
    • Active parameters: the number of parameters actually involved in computation during a single forward pass, which determines real compute consumption. For sparse models, the gap between the two is enormous.
    • Effective capacity: the capability level a model demonstrates under a given inference budget, influenced by data quality, training recipe, and post-training strategy. It does not scale linearly with total parameters.

    2. The Common Backbone: A Six-Layer Structure

    Most contemporary models can be abstracted into the following stacked structure, with differences mainly in the implementation details of each layer:

    1. Tokenization layer. Typically uses byte-level byte-pair encoding methods, with vocabulary sizes usually ranging from tens of thousands to just over two hundred thousand. A larger vocabulary shortens sequence length, but parameter and memory overhead in the output and embedding layers rise accordingly.
    2. Embedding layer. Maps discrete tokens to vectors of hidden dimension d, usually with weight tying to the output layer to save parameters.
    3. Repeatedly stacked transformer blocks. The core consists of normalization, an attention sub-layer, a feed-forward sub-layer, and residual connections. The number of blocks defines the model’s “depth.”
    4. Normalization placement. Modern designs commonly adopt pre-normalization and remove or simplify the scaling parameters of normalization layers to improve training stability in deep networks.
    5. Output head. Projects back to the vocabulary space to produce a probability distribution.
    6. Positional information injection. Rotary position embeddings are the de facto standard, combined with frequency scaling and temperature adjustment to enable length extrapolation.

    What truly separates models is the attention and feed-forward sub-layers.

    3. Attention Evolution: From Full to Sparse

    Original multi-head attention scales quadratically with sequence length in long-context scenarios, so the industry optimizes along three paths:

    • Grouped-query and multi-query attention. Multiple query heads share a group of key-value heads, directly compressing the key-value cache by several times. This is one of the most practical optimizations for autoregressive serving.
    • Low-rank key-value compression. Projects keys and values into a low-dimensional latent space and caches the latent vectors, reconstructing them at inference time. This can reduce cache footprint by an order of magnitude, at the cost of extra matrix multiplications and implementation complexity.
    • Hybrid sparse and linear attention. A small number of full-attention layers handle global information aggregation, while the remaining layers use local windows, sliding chunks, or linear kernels, bringing complexity back to near-linear. Some designs also alternate different attention types across layers, forming a hybrid stack.

    One engineering caveat: attention implementations generally rely on fused kernels and paged key-value cache management, so there is a significant gap between theoretical compute and actual throughput. Evaluation should be based on real batched load testing.

    4. Feed-Forward Layers and Sparsification: The Main Source of Parameter Scale

    The feed-forward sub-layer typically accounts for more than sixty percent of a model’s total parameters. It is the main battleground for “stacking parameters” and the primary target for sparsification. The Mixture-of-Experts structure replaces a single feed-forward layer with several parallel experts, and a gating network selects a small number of experts for each token to participate in computation. Its benefits and costs can be summarized as:

    • Benefit: total parameters can grow several times to tens of times larger while active parameters and compute stay roughly unchanged, creating a decoupling of “large capacity, low unit price.”
    • Cost one: memory must hold all expert weights, shifting the deployment barrier from compute to memory capacity and inter-card bandwidth.
    • Cost two: load balancing. If the gate persistently favors a few experts, resources are wasted. Training usually introduces an auxiliary balancing loss and capacity limits.
    • Cost three: communication overhead. When experts are distributed across different devices, each layer requires two all-to-all communications, making it sensitive to interconnect topology.

    Shared experts and fine-grained expert splitting are two common refinements: the former keeps a few always-active experts to carry general knowledge, while the latter splits experts more finely to improve combinatorial flexibility.

    5. Parameter Scale Tiers and Capacity Estimation

    Combining total and active parameters, four typical ranges can be identified (values are common industry magnitudes, meant to build intuition rather than refer to specific products):

    Tier Total Parameters Active Parameters Typical Positioning
    Small dense 1B–10B Same as total On-device, single-GPU deployable
    Medium dense 10B–100B+ Same as total General chat and code, the cost-performance workhorse
    Large sparse 100B–1T 10B–100B Complex reasoning and long context
    Very large sparse Above 1T ~100B Frontier capability exploration

    A rough estimate of memory footprint (inference scenario, weights only):

    1. Weight memory ≈ total parameters × bytes per parameter
    2. FP16/BF16 : 2 bytes
    3. INT8 : 1 byte
    4. INT4 : 0.5 bytes
    5. KV cache ≈ 2 × layers × KV heads × head dim × sequence length × batch size × bytes per parameter

    As this shows, in long-context serving the KV cache is often equal to or even larger than the weights. This is the fundamental reason low-rank compression and sparse attention have become necessities. On the training side, empirical scaling laws describe the power-law relationship between loss and parameters, data, and compute, used to extrapolate the optimal allocation.

    6. Long Context and Training Precision

    Context length is not a single switch but the result of coordination among three factors: data construction, positional encoding extrapolation, and inference strategy. It requires continued training on long samples, combined with positional frequency scaling, and on the serving side the use of paged caching, chunked prefill, and speculative decoding to control time-to-first-token.

    On precision, mixed-precision training is now the default: forward and backward passes use half precision while retaining single-precision master weights and some reductions. On the inference side, post-training quantization is widely adopted, with weights quantized per channel or per group and activations quantized by dynamic range, improving throughput while keeping accuracy loss controllable.

    7. Selection and Deployment Decision Checklist

    • Memory-first or compute-first: sparse models save compute but consume memory. When device memory is tight, choose small-to-medium dense models or low-bit quantized versions.
    • Concurrency pattern: high-concurrency short requests focus on KV cache and batching efficiency; long-document scenarios focus on cache compression and chunking strategy.
    • Capability validation: run small-scale evaluations on your own business datasets, focusing on instruction following, structured output stability, and long-document retrieval accuracy.
    • Cost accounting: include weight memory, cache memory, interconnect bandwidth, and operations monitoring in total cost of ownership.
    • Observability: integrate logging services, metrics monitoring, and alerting, with thresholds set for time-to-first-token, throughput, and memory utilization.

    8. Conclusion

    Architecture determines efficiency; scale determines the ceiling. Together they define the capability and cost curve of a model. Mastering the conversion among total parameters, active parameters, and cache footprint, then layering on the specific form of attention and expert structures, enables fast and accurate engineering judgment on any new-generation model. To serve the inference workloads described above, you can build an elastic service foundation using general capabilities such as the container platform, object storage, and monitoring and alerting offered by Baidu AI Cloud.