Large Language Model Architectures and Parameter Scale: A Technical Breakdown
This article explains how network architecture and parameter scale jointly determine a large language model's capability ceiling and deployment cost. It breaks down dense transformer backbones, sparse Mixture-of-Experts layers, attention efficiency variants, positional encoding and extrapolation, and training versus inference precision. It also covers how parameter tiers map to use cases, how to estimate memory footprint, and what to check when reading a model architecture document.
1. Why Architecture and Parameter Scale Are the First-Order Questions
When evaluating any large language model, what actually determines its capability ceiling and deployment cost is not a single headline number, but the combination of two dimensions: the network architecture paradigm and the parameter scale (total and activated). The former governs how information flows within and across layers; the latter determines the order of magnitude of model capacity and memory footprint. Together they constrain training stability, inference throughput, the maximum context length, and the cost per token.
One common misconception needs to be cleared up first: total parameter count is not the same as the compute used in a single forward pass. In a dense architecture, the two are roughly proportional. In a sparse Mixture-of-Experts (MoE) architecture, the total parameter count can be very large while each token activates only a small subset of experts, so “total parameters” and “activated parameters” must be stated separately. This is why the industry commonly labels models with both numbers.
2. Breaking Down the Mainstream Architecture Paradigms
2.1 Dense Feed-Forward Backbone and Residual Connections
The most basic and common form is a stack of Transformer decoder layers. Each layer contains a self-attention sublayer and a feed-forward sublayer, each wrapped with normalization and a residual connection. The choice of where normalization goes (before or after the sublayer) significantly affects training stability in deep networks. Pre-sublayer normalization combined with a final normalization at the output layer is more common today.
The feed-forward sublayer usually accounts for the largest share of a model’s parameters. The classic design expands the dimension and then reduces it, with the intermediate dimension being several times the hidden dimension. To cut parameter count and compute, gated linear unit variants are now widely adopted: they add a gating branch alongside an up-projection branch and use element-wise multiplication for dynamic filtering.
2.2 Sparse Mixture-of-Experts Layers
MoE replaces the feed-forward sublayer with multiple parallel “expert” networks, and a router selects a few experts to participate in the computation for each token. Its engineering value is that model capacity grows with the number of experts while per-token compute stays roughly flat. The cost is higher memory usage and full-parameter synchronization overhead. In addition, uneven routing overloads some experts while leaving others idle, which is why auxiliary load-balancing loss and capacity limits are needed.
The routing logic can be abstracted schematically as:
# Pseudocode: conveys only the idea of routing and sparse computationlogits = router(hidden_states) # [tokens, num_experts]weights, expert_ids = topk(softmax(logits), k=2)outputs = zeros_like(hidden_states)for e in range(num_experts):mask = (expert_ids == e) # process only tokens assigned to this expertif mask.any():outputs[mask] += weights[mask, e] * expert_e[hidden_states[mask]]
In practice this is often combined with expert parallelism: different experts sit on different devices, and tokens are exchanged via All-to-All communication. How well communication and computation are scheduled to overlap often affects end-to-end throughput more than the architecture itself.
2.3 Efficiency Improvements to Attention
The compute and memory cost of standard self-attention grow quadratically with sequence length, so long-context scenarios commonly introduce modifications. Multi-query and grouped-query attention reduce memory bandwidth pressure by sharing key-value heads. Sliding-window and local attention bring complexity down to linear. Linear attention and state-space architectures replace the ever-growing key-value cache with a fixed-size state. In practice, a hybrid strategy is more common: most layers use local or compressed attention, while a few layers keep global attention to preserve a long-range information path.
2.4 Positional Encoding and Extrapolation
Rotary positional encoding applies a rotation to queries and keys to model relative positions, and is currently the mainstream choice. To support inference beyond the training length, the industry uses position interpolation, frequency scaling, and progressively extending the context during training. To judge a model’s context capability, look at the training length, the extrapolation strategy, and measured performance on long-text retrieval tasks, rather than the nominal window alone.
2.5 Training Precision and Quantization
Mainstream training uses mixed precision, with low-precision formats carrying gradient accumulation and optimizer states to reduce overhead. On the inference side, weight quantization and key-value cache quantization compress memory usage by several times. Note that the accuracy loss from quantization is strongly task-dependent, so comparison evaluations should be run on the real distribution of the business before going live.
3. Parameter Scale Tiers and What They Mean for Model Selection
The industry usually groups models by activated parameters. Below the billion-parameter mark suits on-device and high-frequency lightweight tasks. Billion to tens-of-billions is a common mainstay for general dialogue and structured extraction. Tens of billions to hundreds of billions of activated parameters are mostly used for complex reasoning and code generation. Sparse models with trillions of total parameters and billions of activated parameters decouple capacity from cost, and fit demanding quality requirements in settings with strong engineering capability.
When selecting a model, break memory usage into four parts: weights, key-value cache, activations, and the communication buffers of the parallel framework. A rough mental model: weight memory is roughly parameter count multiplied by bytes per parameter, while the key-value cache grows linearly with the number of layers, key-value heads, sequence length, and batch size. In long-context, high-concurrency scenarios it is often the real bottleneck.
Weight memory ≈ parameter count × bytes per parameterKV cache ≈ 2 × num_layers × num_kv_heads × head_dim × seq_len × batch_size × bytes per element
4. How to Read a Model Architecture Description
When facing a technical document, check the following in order: architecture paradigm (dense or sparse), total and activated parameters, number of layers and hidden dimension, attention variant and context approach, positional encoding and extrapolation strategy, training and inference precision, and whether the data mixture and training stage breakdown are disclosed. The more complete the information, the lower the risk of reproduction and secondary development.
If an enterprise wants to validate candidate models in its own environment, it can use a container platform for elastic resource orchestration, manage weights and datasets with object storage, and observe throughput, latency, and memory levels through logging and monitoring with alerts, forming a reusable evaluation pipeline. Baidu AI Cloud provides a general combination of capabilities for this kind of engineering chain; specific selection should still be based on measured data.
5. Conclusion
Understanding modern large language models comes down to treating architecture and scale as a set of coupled variables: architecture determines how efficiently a unit of compute is used, scale determines the capacity ceiling, and sparsification is making the two independently adjustable. With the breakdown framework above, whether reading a technical report or planning a deployment, you can quickly grasp the factors that truly drive cost and quality.
