Understanding Modern LLM Architectures and Parameter Scale

    This article breaks down the core structure of modern large language models and explains how parameter scale shapes capacity and inference cost. It covers the standard decoder-only backbone, attention optimizations, dense versus sparse feed-forward layers, positional encoding and normalization choices, and the key distinction between total parameters, active parameters, and training compute. It also provides a quick method to estimate model size from weight file size, along with practical guidance for model selection and deployment.

    1. Why Structure and Parameter Count Are the Two Core Reference Points

    When discussing any modern large language model, only two things carry real engineering significance: the structure that turns tokens into a prediction distribution, and the number of parameters that determines capacity and inference cost. Source material often lists models one by one, organized by vendor and model name, but for developers, model names iterate quickly. Structure and scale are the transferable knowledge. This article therefore strips away specific product attributes and frames the topic as a general technical question: what structural paradigms do mainstream LLMs use, what order of magnitude are their parameter counts, and how can you make a reasonable estimate without access to internal documentation.

    One boundary to clarify up front: no team discloses every hyperparameter, and any claim precise down to “how many billion parameters a given version has” should defer to the official technical report. This article only discusses widely accepted general definitions and order-of-magnitude ranges.

    2. A General Breakdown of Modern LLM Structure

    2.1 The Overall Skeleton: Decoder-Only Is the De Facto Standard

    The current mainstream approach splits text into tokens, passes them through an embedding layer into several identical Transformer blocks, and finally applies a language model head to produce a distribution over the vocabulary. Compared with earlier encoder-decoder designs, the decoder-only structure is more favorable in three respects: a unified training objective, incremental inference, and context that can extend indefinitely. That is why it has become the default choice.

    A readability-first sketch (tensor dimension details omitted):

    1. class Block(nn.Module):
    2. def __init__(self, d_model, n_heads, d_ff, norm_eps=1e-5):
    3. super().__init__()
    4. self.norm1 = RMSNorm(d_model, norm_eps)
    5. self.attn = CausalSelfAttention(d_model, n_heads)
    6. self.norm2 = RMSNorm(d_model, norm_eps)
    7. self.mlp = MLP(d_model, d_ff) # dense or sparse implementation
    8. def forward(self, x, kv_cache=None):
    9. x = x + self.attn(self.norm1(x), kv_cache)
    10. x = x + self.mlp(self.norm2(x))
    11. return x

    2.2 Attention: From Full Computation to Controllable Overhead

    The compute cost of standard multi-head self-attention grows quadratically with sequence length, so long-context scenarios require modification. Common industry techniques include grouped-query attention (letting multiple query heads share one set of key-value heads, directly compressing the KV cache), sliding-window and local-global hybrid attention (letting most layers attend only to nearby tokens while a few layers handle global information aggregation), and various linear or sparse approximations. The most general engineering rule of thumb is: KV cache size ≈ number of layers × number of key-value heads × head dimension × sequence length × bytes per value of precision. It often becomes a memory bottleneck before the weights do.

    2.3 Feed-Forward Layers: The Dense and Sparse Paths

    A dense feed-forward layer usually accounts for the bulk of a single layer’s parameters. The sparse path splits the feed-forward layer into multiple “experts,” where each token activates only a few of them, decoupling total parameter count from per-token compute. This is the root reason a model can have a very large total parameter count without slowing inference proportionally. The key engineering concerns for sparse structures are routing balance and communication overhead: routing collapse leaves some experts idle, and cross-device distribution introduces additional latency.

    2.4 Positional Encoding, Normalization, and Activation

    Positional information now commonly uses rotary positional encoding and its long-context interpolation/scaling variants, the benefit being extrapolation without changing the structure. Normalization mostly uses root mean square normalization, dropping mean centering and bias terms to save compute. Activation functions commonly come from the gated linear unit family, replacing a single nonlinearity with an element-wise product, which has been observed to converge more stably.

    3. Parameter Scale: Magnitude, Composition, and Estimation

    3.1 Three Concepts That Must Be Kept Separate

    • Total parameters: includes all experts and embeddings, and determines weight occupancy in memory;
    • Active parameters: the portion that actually participates in computation for a single forward pass of one token, determining compute and latency;
    • Training compute: approximated as 6 × number of parameters × number of training tokens (including backpropagation), a first-order approximation for cost estimation.

    Conflating the three is the most common source of misjudgment during the selection stage.

    3.2 Distribution of Magnitudes

    General-purpose dialogue and reasoning models mostly have total parameters in the range of tens of billions to hundreds of billions; sparse structures can push total parameters into the hundreds of billions while keeping active parameters at the tens-of-billions level. On-device and real-time scenarios concentrate below a billion parameters, compressed through distillation and quantization. Context length has generally expanded from tens of thousands to hundreds of thousands of tokens, but it is a configuration item rather than a parameter and should not be counted in scale discussions.

    3.3 A Quick Estimation Method

    Knowing the weight file size is enough to work backward to precision and scale:

    1. parameter count ≈ weight bytes / bytes per parameter
    2. fp16/bf16 → 2 bytes; int8 → 1 byte; int4 → 0.5 bytes
    3. inference memory ≈ weights + KV cache + activations and framework overhead (reserve 20%~30%)

    For example, a 16-bit weight file of 40GB corresponds to roughly 20 billion parameters; with 4-bit quantization, the same parameter count needs only about 5GB, but note the loss quantization imposes on long-tail capabilities.

    4. Selection and Deployment Recommendations

    1. Set the latency and cost ceiling first, then discuss parameter count. If the business has a strict time-to-first-token requirement, look at active parameters and KV cache strategy first, not total parameters.
    2. Pay for long context by hit rate. If retrieval already solves 80% of the problems, a moderate context plus a retrieval pipeline is usually more economical than blindly extending the window.
    3. For sparse models, evaluate routing stability and batching efficiency; in small-batch scenarios the sparse advantage gets diluted.
    4. Run evaluations on your own data. Public leaderboards are only for ruling out clearly unsuitable candidates; the final decision depends on accuracy and unit cost on a business-specific subset.
    5. On the deployment side, make good use of general cloud capability combinations: container platforms host inference services, object storage holds models and datasets, logging services and monitoring/alerting handle observability, and message queues smooth out request spikes, forming an elastically scalable closed loop.

    5. Conclusion

    Model names change, but structural paradigms and scale patterns remain relatively stable. Master the main thread of skeleton, attention, feed-forward, and positional encoding, plus the distinction and estimation of total parameters, active parameters, and training compute, and you can make reliable technical judgments under incomplete information without chasing the name of every new release.