Understanding Modern LLM Architectures and Parameter Scale
This article breaks down how network topology and parameter count define a large language model's capabilities and deployment cost. It covers common parameter tiers, the four core components of mainstream architectures (attention, feed-forward and sparse experts, positional encoding, and normalization), a practical checklist for identifying a model's structure type, methods for estimating memory and compute overhead, and selection advice for different deployment scenarios. It also highlights common misconceptions about parameter count, activated parameters, context length, and KV cache.
1. Why Architecture and Parameter Scale Are the First-Order Questions
When evaluating any large language model, what truly determines its capability ceiling and deployment cost is not the name or version number, but two underlying facts: the network topology (how layers are connected and how computation flows) and the parameter scale (how many learnable weights exist and how many are activated per forward pass). The former governs how information moves within and across layers; the latter governs the relationship between model capacity and inference overhead.
The industry commonly groups parameter scale into a few empirical tiers to quickly position a model and its deployment approach:
- Below one billion (roughly 0.1B–1B): on-device, real-time completion, and embedded scenarios;
- Hundreds of millions to ten billion (roughly 1B–10B): general-purpose tasks that fit on a single GPU or single machine;
- Ten billion to a hundred billion (roughly 10B–100B): requires multi-GPU parallelism, balancing quality and cost;
- Above a hundred billion (100B+): typically relies on sparse activation and clustered inference serving.
It is important to stress that total parameters and activated parameters are two different concepts. Under a dense architecture the two are equal; under a sparse mixture-of-experts (MoE) architecture the total can be very large while a single activation touches only a small fraction of it. This is precisely why sparse designs have become the mainstream choice for ultra-large-scale models.
2. The Four Building Blocks of Mainstream Architectures
2.1 The Evolution of Attention
Standard multi-head self-attention scales quadratically with sequence length, so long-context scenarios generally adopt several improvements. Grouped-query attention (GQA) and multi-query attention (MQA) reduce memory and bandwidth pressure by sharing key-value heads. Sliding-window and local–global hybrid attention keep the effective receptive field at a constant size. Linear attention and state-space-style structures reduce complexity to linear through a recurrent formulation. In engineering practice, a “hybrid stack” is more common: most layers use local windowed attention while a few layers retain global attention, balancing accuracy and throughput on long-text tasks.
Illustrative expression (pseudocode):
# Hybrid stack of local windows plus a few global layersfor layer_id in range(num_layers):if layer_id % global_every == 0:h = global_attention(h) # global receptive fieldelse:h = window_attention(h, w=4096) # local windowh = ffn(h)
2.2 Feed-Forward Networks and Sparse Experts
The feed-forward layer usually accounts for more than two-thirds of a model’s total parameters and is the primary source of parameter scale. Sparse MoE splits a single feed-forward layer into multiple experts and, together with a gating network, routes each token to only the Top-K experts. This makes “large total parameters, small per-token computation” possible. Key engineering points include the load-balancing loss for routing, expert parallelism and capacity factor, and the combination of shared experts (carrying general knowledge) with routed experts (carrying specialized knowledge). Sparse structures are not free of cost: memory usage is still counted by total parameters, and distributed communication overhead rises significantly.
2.3 Positional Encoding and Context Extension
Rotary position embedding (RoPE) combined with frequency scaling, position interpolation, or segmented strategies is the mainstream approach for extending the context window today. The practical point is that training length, extension length, and inference length must be matched; otherwise a failure mode emerges where the model “supports very long inputs but loses information in the middle.”
2.4 Normalization, Residuals, and Activation Functions
Pre-Norm residual structures, normalization with learnable scaling, and gated linear unit–style activation functions have become the de facto standard. They add little in terms of parameters, yet directly affect the trainability and numerical stability of deep networks.
3. How to Quickly Identify a Model’s Architecture Type
Here is an actionable checklist:
- Check whether total and activated parameters match: if they match, it is dense; if not, it is a sparse expert model;
- Check whether the number of key-value heads is fewer than query heads: if so, it is a GQA/MQA-style model;
- Check whether the layer configuration periodically includes global layers: if so, it is a hybrid attention stack;
- Check the vocabulary size and whether the embedding layer shares weights: this affects the effective capacity of small models;
- Check whether context length and positional encoding strategy are declared separately.
4. Estimating Parameter Scale and Compute Overhead
A rough estimate of inference-time memory usage (in bytes):
Weight memory ≈ num_parameters × bytes_per_parameter (FP16≈2, INT8≈1, INT4≈0.5)KV cache ≈ 2 × num_layers × num_kv_heads × head_dim × seq_len × batch_size × bytes
The training stage must additionally stack optimizer states, gradients, and activations; empirically, total memory is several times the weight memory. For sparse expert models, weight memory is counted by total parameters while computation is counted by activated parameters. This “scissors gap” is the source of their cost efficiency and also the source of their deployment complexity.
5. Selection and Deployment Advice for Real-World Use
- High-concurrency, low-latency scenarios: prioritize sparse models with small activation or distilled small models, combined with continuous batching and paged key-value cache management;
- Long-document and codebase understanding: prioritize natively long-context architectures with hybrid attention, avoiding reliance on position interpolation alone;
- Private deployment and cost-sensitive scenarios: consider quantization (weight quantization plus KV cache quantization) and speculative decoding to raise single-GPU throughput;
- Quality-first scenarios: dense large models are actually easier to manage under small-batch, offline batch processing, with a shorter tuning pipeline.
When deploying on the cloud, you can combine a container platform to host inference services, object storage to hold models and datasets, a message queue to smooth request spikes, and logging and monitoring services for observability. Baidu AI Cloud offers standard infrastructure categories for these general capabilities; specific specs and quotas should be confirmed in the official documentation.
6. Common Misconceptions
- Equating “more parameters” with “smarter”: data quality, training recipes, and post-training alignment are equally critical;
- Ignoring activated parameters: the cost model of a sparse model is entirely different from that of a dense model;
- Looking only at the nominal context length: effective context must be validated with “middle retrieval”–style evaluations;
- Overlooking the KV cache: under long-context, high-concurrency conditions, it often consumes more memory than the weights.
In summary, understanding modern large language models comes down to one main thread: architecture determines how information flows, and parameters determine how capacity and overhead are distributed. Add three observation dimensions—activation volume, attention form, and positional encoding—and you can accurately assess and reasonably select among the vast majority of models.
