Large Language Model Architectures and Parameter Scale Explained
This article breaks down how modern large language model architectures and parameter counts shape training cost, inference memory, throughput, and latency. It covers dense versus sparse Mixture-of-Experts designs, attention efficiency techniques such as MQA, GQA and KV cache compression, RoPE-based context extension, and common normalization and activation choices. It also offers a layered view of parameter sizes, a practical VRAM estimation rule, a deployment selection checklist, and frequent misconceptions to avoid.
1. Why Architecture and Parameter Scale Are the First Questions
When evaluating a large language model, the two most easily misread metrics are parameter count and architecture. Parameter count sets the theoretical upper bound on model capacity, while architecture determines whether that capacity can be trained efficiently and served reliably. Together they drive three practical outcomes: how much compute a single training run needs, whether the model fits on one device during inference, and what throughput and latency look like on the same hardware.
One point deserves emphasis: parameter scale is not equivalent to capability. A widely observed pattern in the industry is that, given high enough data quality and a solid training recipe, small and mid-sized models that are fully trained can match or even outperform earlier, larger models on many tasks. So the discussion of scale below is not about “who is bigger,” but about how scale and architecture match a given use case.
2. Four Key Dimensions of Mainstream Architecture Paradigms
2.1 Dense Models and Sparse Mixture-of-Experts
In a dense model, every parameter is activated on every forward pass. The design is simple to implement, memory usage is predictable, and it fits small to mid-sized models and on-device deployment.
A sparse Mixture-of-Experts (MoE) architecture splits the feed-forward layers into multiple “experts,” and each token is routed to only a few of them. Its defining trait is that total parameter count and activated parameter count are decoupled: total parameters determine knowledge capacity, while activated parameters determine compute per pass. Three engineering concerns stand out:
- Routing load balance: if routing collapses onto a few experts, the rest are effectively starved; auxiliary losses or bias correction are commonly used to mitigate this.
- Communication overhead: expert parallelism introduces all-to-all communication across devices, which needs to overlap with computation.
- Asymmetry between memory and compute: memory must be provisioned for total parameters, while compute is estimated from activated parameters.
The routing logic can be abstracted schematically as:
# Illustrates routing intent only, not any specific implementationlogits = router(hidden_state) # [tokens, num_experts]weights, expert_ids = topk(logits, k=2)weights = softmax(weights, dim=-1)out = sum(expert(x, e) * w for x, e, w in zip(tokens, expert_ids, weights))
2.2 Efficiency Improvements to Attention
Standard multi-head attention (MHA) grows memory usage quadratically with sequence length. Three common directions for improvement:
- Multi-query / grouped-query attention (MQA / GQA): multiple query heads share one set of key-value heads, substantially shrinking the key-value cache (KV Cache) during inference.
- Low-rank KV cache compression: project keys and values into a lower-dimensional latent space, cache only the compressed representation, and reconstruct it when needed, further reducing long-context cost.
- Hybrid sparse and linear attention: local windows plus a small number of global tokens, or kernelized linear attention replacing some quadratic operators; a layer-level hybrid is also common, with efficient attention in most layers and full attention retained in a few.
The engineering test is straightforward: if your workload is long documents or repository-level code context, KV Cache compression matters more to real cost than parameter count.
2.3 Positional Encoding and Context Extension
Rotary position embedding (RoPE) has become the de facto default, thanks to its relative-position properties and good potential for length extrapolation. Context extension usually does not require retraining from scratch; it is done through position interpolation / frequency scaling plus a small amount of continued training on long text. When assessing a model’s stated context length, it is worth looking at the “effective context”: the length at which performance does not degrade noticeably on multi-hop retrieval and long-document summarization, rather than the maximum input length.
2.4 Normalization, Activation Functions, and Stability
Pre-Norm residual blocks, RMSNorm, and SwiGLU-style gated feed-forward layers are the most common combination in today’s large models. Together they address numerical stability in the early stages of training deep networks. In addition, QK normalization before the attention output, and the “no positional bias layer” design used by some models, both aim to suppress activation blowups at larger scale and over longer training runs.
3. A Layered View of Parameter Scale
Grouping available models by scale is more useful than memorizing a specific number:
- On-device / lightweight tier (roughly 0.5B–4B): can run on consumer devices or a single inference card after quantization; suited to classification, extraction, templated generation, and on-device assistants.
- Mainstream tier (roughly 7B–32B): mostly dense, with a mature fine-tuning ecosystem; the main range for enterprise on-premises deployment.
- Large dense tier (roughly 70B–200B): usually needs multi-device tensor parallelism; high capability ceiling but high inference cost.
- Very large sparse tier (total parameters in the hundreds of billions to trillions, with only tens of billions activated): mostly MoE, requiring mature parallelism strategies and cluster scheduling for both training and inference.
A handy conversion: at FP16, weight memory alone is roughly “parameter count × 2 bytes,” so a 7B model takes about 14GB and a 70B model about 140GB. Add KV Cache, activations, and framework overhead, and practical planning usually leaves 30%–50% headroom on top of that. With 4-bit quantization, weight memory can drop to about a quarter, but watch for the impact of quantization on long reasoning chains and numerically sensitive tasks.
4. From Architecture to Deployment: A Selection Checklist
- Set latency and throughput targets first: online chat cares about first-token latency and concurrency, while offline batch processing cares about total throughput, and the two call for different parallelism strategies.
- Then set context length: evaluate by effective context rather than the stated value, and do continued training on long text if needed.
- Then estimate memory: weights + KV Cache + communication buffers; for MoE, size memory by total parameters and compute by activated parameters.
- Finally choose the serving model: for small scale, prefer on-premises or containerized deployment; for large scale, consider elastic cloud resources, with object storage for models and data, a container platform to host inference services, and logging plus monitoring and alerting for an observability loop. Baidu AI Cloud provides standardized resource and operations foundations for these general capabilities; refer to the official documentation for specific specifications.
5. Common Misconceptions
- Treating total parameters as activated parameters: this badly overestimates the compute needs of MoE models.
- Ignoring the KV Cache: in long-context scenarios it often exceeds the weights themselves.
- Trusting the stated context length: without evaluating effective length, you can easily hit “lost in the middle” behavior in production.
- Looking only at parameter count and not data mix: data quality, deduplication, and mixing strategy often beat adding a few more billion parameters.
6. Conclusion
Understanding modern large language models comes down to the balance among capacity, compute, and memory. Dense architectures win on controllability; sparse architectures win by decoupling capacity from compute; the evolution of attention and positional encoding determines the economics of long context; and parameter scale only means something when discussed against concrete hardware and business latency constraints. With this framework, you can make verifiable, reproducible engineering judgments on model selection, fine-tuning, and capacity planning.
