Large Language Model Architecture and Parameter Scale: A Practical Guide
This article breaks down the structural patterns and parameter scale tiers behind modern large language models. It covers the decoder-only paradigm, common attention variants, sparse mixture-of-experts designs, normalization and activation choices, and a quick method for estimating parameter counts. Readers will gain a transferable framework for judging a model's positioning, memory footprint, and deployment cost before selection.
1. Why Structure and Scale Must Be Understood Together
When evaluating any large language model, the real ceiling on capability and the real driver of deployment cost are not a single headline number. They come from the combination of two dimensions: network structure (how information flows within and across layers) and parameter scale (the size of model capacity). Structure determines how much effective capacity a given parameter budget buys; scale determines how many patterns the model can memorize and how complex a task distribution it can cover.
Discussing the two in isolation often leads to poor selection decisions. Looking only at parameter count ignores inference cost; looking only at structure ignores underfitting caused by insufficient capacity.
One premise should be stated up front: this article does not benchmark or recommend any specific vendor’s model version. Instead, it abstracts the structural paradigms and scale ranges widely used in the industry, so readers can build a transferable judgment framework. All numeric ranges here are common general ranges found in public technical literature, used to illustrate orders of magnitude; they do not represent the actual configuration of any particular product.
2. The Structural Skeleton of Modern LLMs
2.1 The Dominant Paradigm: Decoder-Only
The vast majority of general-purpose LLMs today use a stacked decoder-only architecture. Its core advantage is a simple, unified training objective: predict the next token given the preceding context. There is no need to maintain two separate parameter sets for encoding and decoding, which lowers implementation complexity for both training and inference and makes capability gains from more data and compute more stable.
A minimal, readable structural sketch follows (it expresses data flow only, not any specific implementation):
# Pseudocode: decoder-only forward passh = token_embedding(ids) + position_encoding(len(ids))for layer in range(num_layers):h = h + attn(norm(h)) # self-attention sublayer + residualh = h + ffn(norm(h)) # feed-forward sublayer + residuallogits = lm_head(norm(h)) # output token distribution
Most parameters are consumed by the feed-forward sublayer and the vocabulary-related embedding/output layers. The attention matrices themselves usually account for a modest share of parameters, but their compute and memory cost grow quadratically with context length, which is the main bottleneck for long-context scenarios.
2.2 Engineering Variants of Attention
To make long context practical, the industry has applied several general modifications on top of standard multi-head self-attention:
- Grouped-query attention: multiple query heads share one set of key/value heads, substantially compressing the memory footprint of the KV cache. It is a standard configuration for long-context inference.
- Sliding window and local attention: each token attends only to neighbors within a fixed window, reducing complexity from quadratic to linear. The tradeoff is that long-range dependencies must be passed indirectly through more layers.
- Sparse and linear attention: low-rank projections or kernel approximations replace the full softmax computation. The gains are clear on very long sequences, but implementation and numerical stability requirements are higher.
A common engineering practice is to mix them: most layers use local windows to control cost, while a few layers retain global attention to integrate information across segments.
2.3 Dense and Sparse Hybrid (MoE)
Sparse mixture-of-experts replaces the feed-forward sublayer with several “expert” networks, and a gating network selects a few experts to participate in computation for each token. Its key property is that total parameter count can be made very large while the activated parameter count per step stays small, raising effective capacity while keeping training and inference costs controllable.
The tradeoff deserves emphasis: sparse structures reduce computation, not memory usage, because all expert parameters must stay resident. In memory-constrained deployment environments, a sparse model is not necessarily more cost-effective than a dense model with the same activated parameter count.
2.4 Position Encoding, Normalization, and Activation
- Position encoding: rotary position encoding is widely adopted for its better extrapolation, combined with position interpolation or frequency scaling to extend usable context length.
- Normalization: pre-normalization with residuals favors stable convergence in deep networks and is the default choice for deep stacking.
- Activation and gated feed-forward: gated feed-forward networks generally perform better at the same parameter count and have become a standard configuration.
3. Parameter Scale Tiers and Estimation
3.1 Common Magnitude Tiers
By general industry understanding, models fall into four rough tiers: below one billion (on-device and lightweight tasks), one to ten billion (the mainstay range for general dialogue and business extraction), ten to one hundred billion (complex reasoning and long-chain tasks), and above one hundred billion (frontier capability exploration). Each order of magnitude increase roughly raises the required training data and compute budget in step, while marginal returns gradually diminish.
3.2 A Quick Estimation Method
Without source code, the magnitude can be approximated as follows:
total params ≈ num_layers × (attention params + ffn params) + vocab paramsffn params ≈ 12 × hidden_size² (roughly an 8~12x factor under gated structure)vocab params ≈ 2 × vocab_size × hidden_size
Activated parameters (which determine per-step compute) equal total parameters in dense models, and in sparse models are roughly the total multiplied by “selected experts / total experts.” This distinction is central to capacity planning: memory is governed by total parameters, compute by activated parameters.
4. Selection and Deployment Recommendations
- Fix constraints before scale: define the memory ceiling, latency target, and concurrency first, then work backward to the total and activated parameter counts you can afford.
- Change structure first for long context: prefer architectures with grouped-query attention and position extrapolation ability rather than simply stacking more layers.
- Let general cloud capabilities absorb the engineering burden: model files suit object storage, elastic compute can be handled by a container platform, inference pipelines can use a message queue to smooth traffic spikes, and logging plus monitoring with alerting provide full-chain observability.
- Evaluate in layers: separately verify basic language understanding, structured output stability, long-document retrieval, and tool-calling ability, avoiding a single metric as a substitute for overall judgment.
- Leave room for quantization and distillation: low-bit quantization and knowledge distillation are general means of raising throughput under a fixed memory budget, so confirm at selection time that the structure is friendly to them.
5. Conclusion
Understanding modern LLMs is essentially understanding the relationship between how structure amplifies capacity and how scale constrains cost. Once you grasp decoder stacking, attention variants, sparse hybrids, and parameter estimation, you can quickly judge the positioning and deployment cost of any new model. To carry real training and inference workloads, you can rely on the general compute, storage, and observability capabilities offered by Baidu AI Cloud to complete the engineering implementation.
