Understanding Modern LLM Architectures and Parameter Scale
This article breaks down the two factors that shape large language model capability and deployment cost: architecture paradigm and parameter scale (total versus activated). It explains dense and Mixture-of-Experts (MoE) feed-forward designs, the evolution of attention mechanisms, position encoding, normalization, and activation functions, then maps common parameter tiers to their memory and compute implications. Readers will find practical guidance on quantization, parallelism strategies, serving, and layered evaluation, along with common misconceptions about total parameters, context length, and expert load balancing.
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 governs how model capacity maps to memory, bandwidth, and compute.
From an engineering perspective, architecture determines three things: how friendly the model is to parallel partitioning (tensor parallelism, pipeline parallelism, sequence parallelism), the composition of memory usage (weights, gradients, optimizer states, KV cache), and the compute-to-memory-access ratio during inference. Parameter scale determines the approximate order of magnitude of training compute and the minimum hardware threshold for inference. Only together do they form an actionable basis for technology selection.
It is worth stressing that models across different generations and market positions differ enormously in architecture, yet the “design space” they can be reduced to is limited. Mastering this design space has more long-term value than memorizing any specific model variant.
2. Breaking Down the Mainstream Architecture Paradigms
2.1 Dense Feed-Forward and Mixture of Experts (MoE)
The early mainstream was the dense architecture: the feed-forward network in each layer transforms the full hidden dimension, and all parameters are activated for every token. Its advantages are engineering simplicity and mature parallelization strategies; its drawback is that parameter growth and compute rise roughly linearly in tandem.
Mixture-of-Experts replaces the feed-forward layer with several parallel “expert” subnetworks, and a gating network selects a few experts to participate in computation for each token. Three metrics matter:
- Total parameters: determine the model’s capacity ceiling and the weight footprint in memory;
- Activated parameters: determine the actual floating-point operations per token;
- Expert granularity and routing strategy: finer-grained experts typically yield more balanced load and a smoother capacity-quality curve.
The routing logic can be abstracted schematically as:
# Pseudocode: expresses routing semantics only, not any specific implementationlogits = gate(x) # [tokens, num_experts]topk_idx, topk_w = topk(logits, k=2)y = sum(expert_i(x) * w_i for i, w_i in zip(topk_idx, topk_w))
The cost of MoE is memory and communication: even if only two experts are activated, all expert weights must either stay resident or be swapped in on demand, so parallelization typically introduces expert parallelism and requires careful optimization of all-to-all communication.
2.2 The Evolution of Attention Mechanisms
The complexity of standard multi-head self-attention grows quadratically with sequence length, and in long-context scenarios the KV cache becomes the dominant memory consumer. Common directions in the industry include:
- Grouped-query attention (GQA) / multi-query attention (MQA): multiple query heads share a set of key-value heads, substantially compressing the KV cache;
- Sliding-window and local attention: attending only to neighboring ranges, reducing complexity to near-linear;
- Sparse or learnable attention patterns: dynamically selecting which positions participate in computation by block, by frequency, or by content;
- Linear attention and state-space structures: replacing the ever-growing cache with a fixed-size state, suitable for very long sequences.
A common engineering practice is a hybrid layer design: some layers use global attention to preserve long-range dependencies, while others use local or linear structures to control cost.
2.3 Position Encoding, Normalization, and Activation Functions
Position encoding has evolved from absolute sinusoidal forms, to learnable forms, to rotary position embedding (RoPE) and its various extrapolation/interpolation extensions. The core goal in all cases is to give the model usable extrapolation ability beyond the training length. Normalization commonly adopts pre-normalization with root mean square normalization to reduce overhead; feed-forward activation functions mostly use the gated linear unit family (such as SwiGLU-style structures) to achieve better quality at the same parameter count.
3. Parameter Scale Tiers and Their Cost Implications
By common industry convention, current mainstream models can be roughly grouped into four tiers (values are typical orders of magnitude, not specific product figures):
| Tier | Total parameters | Activated parameters | Typical deployment |
|---|---|---|---|
| Lightweight on-device/edge | 1B–8B | Same as total | Single card or even consumer devices |
| Mid-size general purpose | 10B–40B | Same as total | Single to a few cards |
| Large-scale dense | 70B–200B | Same as total | Multi-card tensor parallelism |
| Very large-scale sparse | 300B–1T+ | 10B–60B | Multi-node multi-card + expert parallelism |
The most important way to read this table is: memory is driven by total parameters, compute by activated parameters. A sparse model with 600B total and 30B activated parameters has per-token compute close to a 30B dense model, but needs several times the memory to hold weights and cache. This explains a common puzzle—why a model with “small” activated parameters can be more memory-hungry.
A rough estimate of memory usage can be written as:
Weight memory ≈ total parameters × bytes per parameter (FP16 = 2, INT8 = 1, INT4 = 0.5)KV cache ≈ 2 × num_layers × num_kv_heads × head_dim × sequence_length × batch_size × bytesTraining memory ≈ weights + gradients + optimizer states (Adam-like ≈ 2× weights) + activations
4. From Architecture to Production: Selection and Deployment Practices
- Define constraints first, then choose scale. Clarify context length, concurrency, first-token latency, and throughput targets, then work backward to the acceptable activated parameters and cache budget.
- Quantization is tightly coupled to architecture. Sparse structures are more sensitive to quantization; errors in expert layers and routing get amplified, so differentiated precision strategies are usually needed for attention and feed-forward layers.
- Match the parallelization strategy to the architecture. Prefer tensor parallelism for dense models; sparse models need expert parallelism and communication overlap; long-context scenarios call for sequence or context parallelism.
- Compose serving capabilities from general-purpose categories. Inference serving can rely on a container platform for elastic scaling, object storage for model weights, a message queue for request peak shaving, and logging plus monitoring and alerting to track latency and failure rates.
- Layer the evaluation. Build separate metrics for foundational capability, long context, instruction following, structured output, and tool calling, rather than substituting a single score for engineering judgment.
5. Common Misconceptions
- Treating total parameters as a compute metric: ignoring activated parameters distorts capacity planning.
- Assuming context length is determined only by position encoding: it is also constrained by KV cache memory and the efficiency of the attention implementation.
- Overlooking routing load balance: expert load skew can make actual throughput far below the theoretical value.
- Inferring usable length from training length: extrapolation ability needs independent retrieval and position-based evaluation.
6. Conclusion
The most effective path to understanding modern LLMs is not tracking the parameter sheet of a particular variant, but building a three-dimensional mental model of architecture paradigm × parameter tier × cost model. Dense and sparse each have their applicable boundaries, and the evolution of attention and position encoding all address the same problem—carrying longer dependencies under limited memory and bandwidth. Once this framework is internalized, whether building your own inference service or engineering a deployment on a platform such as Baidu AI Cloud using general-purpose container, storage, and monitoring capabilities, you can locate bottlenecks faster, control costs, and make verifiable technical decisions.
