Understanding LLM Architecture and Parameter Count: A Practical Guide

    This guide breaks down the two core dimensions of modern large language models: architecture paradigms and parameter scale. It explains dense and sparse (Mixture-of-Experts) designs, attention variants, positional encoding, and the three distinct ways parameter counts are reported. You will also find a rough method for estimating inference memory, a deployment capacity planning workflow, and a checklist of common misconceptions to avoid when selecting or serving a model.

    1. Why Architecture and Parameter Count Are the Two Main Axes

    When discussing modern large language models, the industry usually approaches them from two dimensions: the network architecture paradigm (how information flows and mixes) and parameter scale (how much capacity the model has). The former determines the type of capabilities and inference characteristics; the latter determines the capacity ceiling and resource overhead.

    It is worth emphasizing that parameter count is not the only metric. Training data scale and quality, training strategy, and post-training alignment are equally critical. However, on the engineering side, parameter count and architecture directly determine memory usage, throughput, and latency, so these two dimensions must be explained first.

    2. A General Breakdown of Mainstream Architecture Paradigms

    2.1 Dense Feed-Forward Backbone and Residual Framework

    The vast majority of models follow a backbone of “embedding layer + several Transformer blocks + output head.” Each block consists of normalization, an attention sub-layer, a feed-forward sub-layer, and residual connections. Common engineering optimizations include: replacing mean-centered normalization with root-mean-square normalization to reduce overhead; and replacing standard linear feed-forward networks with gated linear unit feed-forward networks to achieve better representational efficiency at a similar parameter count.

    2.2 Common Variants of the Attention Mechanism

    • Grouped-query attention: multiple query heads share a set of key-value heads, significantly compressing the key-value cache during inference.
    • Sliding window and local attention: restricting attention to a local range, reducing complexity for long sequences.
    • Sparse or linear attention: trading approximation for a more favorable complexity curve, but with higher implementation and numerical stability requirements.

    2.3 Positional Encoding

    From absolute positional encoding, to rotary positional encoding, to position interpolation and extrapolation schemes for long contexts, the core goal is consistent: to keep the model usable beyond its training length. In engineering, this is usually combined with chunked pre-training and progressive length extension.

    2.4 Sparse Mixture-of-Experts Architecture

    Sparse architectures replace the feed-forward sub-layer with multiple “experts” plus a routing network, where each token activates only a few experts. The key takeaway is that the total parameter count can be very large while the per-token computation remains manageable. The costs are high memory usage, uneven routing load, and heavy distributed communication pressure, requiring supporting mechanisms such as capacity factor, load balancing loss, and expert parallelism.

    1. # Illustrative: simplified sparse routing logic (not a real API)
    2. logits = router(hidden) # [tokens, num_experts]
    3. weights, idx = topk(softmax(logits), k=2)
    4. weights = weights / weights.sum(-1, keepdim=True)
    5. out = sum(weights[:, i:i+1] * expert_i(hidden, idx[:, i])
    6. for i, expert_i in enumerate(experts))

    3. Parameter Scale Tiers and Counting Conventions

    3.1 Common Scale Tiers

    The industry usually groups models by capacity into several tiers: below one billion (device-side and lightweight scenarios), one billion to ten billion (general dialogue and business customization), ten billion to one hundred billion (complex reasoning and multimodal), and above one hundred billion (frontier general capabilities). Each tier does not represent a linear improvement in capability, but is jointly determined by data, training compute, and alignment strategy.

    3.2 Three Types of “Parameter Count” That Must Be Distinguished

    • Total parameters: includes all sub-networks; for sparse models this value is far larger than the actual computation.
    • Activated parameters: the scale that actually participates in computation during a single token forward pass, and the main source of latency and compute.
    • Serving-convention parameters: includes the embedding layer, output head, and possible vision or audio adapters; different counting boundaries lead to different numbers.

    3.3 A Rough Way to Estimate Memory

    Inference memory ≈ weight bytes + key-value cache + activations and framework overhead. Weight bytes are roughly equal to the parameter count multiplied by bytes per parameter (about 2 bytes for half precision, about 1 byte for 8-bit). The key-value cache grows linearly with sequence length and concurrency, and is the main bottleneck for long-context serving.

    1. Weights ≈ P × bytes_per_param
    2. KV ≈ 2 × layers × kv_heads × head_dim × seq_len × batch × bytes

    4. From Architecture to Deployment Capacity Planning

    1. Define the scenario first: for device-side, prioritize activated parameters and memory bandwidth; for server-side, prioritize throughput and concurrency.
    2. Then define precision and parallelism: half precision as the baseline; low-bit quantization requires evaluating accuracy regression; tensor parallelism, pipeline parallelism, and expert parallelism are chosen according to topology.
    3. Then define the caching strategy: paged key-value cache, prefix reuse, and continuous batching can significantly improve effective throughput.
    4. Finally, close the loop with load testing: use monitoring alerts and logging services to collect latency percentiles, throughput, and error rates, forming a capacity regression baseline.

    When deploying on the cloud, you can combine a container platform to host inference services, object storage to store models and data, a message queue to smooth request peaks, and logging and monitoring systems for observability support. These are all general capability categories and do not point to any specific product.

    5. Common Misconceptions and a Judgment Checklist

    • Looking only at total parameters: for sparse models, activated parameters must be considered at the same time.
    • Ignoring counting boundaries: whether embeddings and adapters are included causes inconsistent numbers.
    • Treating context length as a free capability: attention and cache overhead rise with length.
    • Overlooking routing balance: skewed expert load slows down overall throughput.
    • Lacking baseline load tests: without percentile latency data, capacity conclusions are not reproducible.

    6. Conclusion

    To understand modern large language models, the key is to discuss the “architecture paradigm” and “parameter convention” separately, then layer in data and training strategy to form a complete judgment. For developers, mastering the differences between dense and sparse models, the trade-offs of attention and positional encoding, and the methods for estimating memory and throughput is enough to support most selection and deployment decisions.