Large Language Model Architecture and Parameter Scale: A Practical Guide
This article breaks down how modern large language models are structured and sized, and how those two factors shape capability, memory usage, and serving cost. It covers the decoder-only Transformer backbone, attention and long-context techniques, MoE sparsity, parameter tiers from edge to trillion-scale, and a direct method for estimating inference memory from parameter count. Readers will gain a clear framework for model selection, deployment, and cost estimation.
1. Why Structure and Parameters Are the Starting Point
Before asking whether a model is “good enough” in engineering practice, two more fundamental questions come first: what structure it is stacked from, and how large its capacity is. Structure determines the capability ceiling and inference characteristics (for example, whether ultra-long context is supported and how much compute a single forward pass costs), while parameter scale directly determines memory footprint, throughput, and latency. Together they form the coordinate system for selection, deployment, and cost estimation.
One distinction matters: total parameters and activated parameters per token are different concepts. In dense models the two are equal; in Mixture-of-Experts (MoE) structures the total can be very large, but each token is routed to only a few experts, so the activated count is far smaller than the total. Ignoring this difference is a common cause of capacity estimation errors.
2. Common Structural Paradigms
2.1 Backbone: Decoder-only Transformer
The current mainstream approach is the decoder-only structure, built by stacking several identical layers, each containing two sub-blocks:
# Illustrative structure, not any specific product implementationfor layer in layers:h = h + attn(rms_norm(h), kv_cache) # self-attention sub-block + residualh = h + ffn(rms_norm(h)) # feed-forward sub-block + residuallogits = lm_head(rms_norm(h))
Key engineering details include: a Pre-Norm residual layout to keep deep training stable; RMSNorm replacing LayerNorm to reduce overhead; and SwiGLU-style gated feed-forward replacing ReLU/GELU feed-forward, which is usually better at the same parameter count.
2.2 Attention and Long Context
Long-context capability mainly comes from three modifications: rotary position embeddings (RoPE) with interpolation/extrapolation extensions; grouped-query attention (GQA) or multi-query attention to compress the KV Cache; and a hierarchical layout that mixes sliding-window and global attention. The first two reduce memory and bandwidth pressure, while the latter balances “local detail + global recall.”
2.3 Sparsity: MoE and Activation Strategy
MoE replaces the feed-forward sub-block with multiple experts plus a router, with a common configuration of dozens to a hundred experts per layer and the top 1–2 selected per token. The cost is high memory usage and heavy load-balancing and communication overhead; the benefit is a significant reduction in floating-point operations for both training and inference. Some designs also introduce fine-grained experts and shared experts to trade off between “specialization” and “generalization.”
2.4 Multimodality and Generation Paradigms
Multimodal models typically attach an encoder and a projection layer on each side of the language backbone, mapping representations of images/audio into the same token space. On the generation side, there are two lines of thought: autoregressive token-by-token decoding and diffusion-style parallel decoding, the latter being more common in image tasks.
3. Parameter Scale Tiers
The industry usually makes empirical divisions by capacity range (values are general magnitudes, not specific models):
| Tier | Typical Total Parameters | Activated Parameters | Use Cases |
|---|---|---|---|
| Edge/lightweight | 0.5B–4B | Same as total | Local assistants, classification/extraction, low latency |
| Medium | 7B–14B | Same as total | General chat, code completion, on-premises deployment |
| Larger | 30B–70B | Same as total | Complex reasoning, long-document understanding |
| Very large sparse | 100B–1T+ | 10B–40B | Hard reasoning, multimodal, high-concurrency serving |
The “very large sparse” tier is exactly the mainstream direction in recent years: pushing the total up to increase knowledge capacity while keeping the activated count within a servable range.
4. From Parameters to Memory: A Ready-to-Use Estimate
Inference memory ≈ weights + KV Cache + runtime overhead. Taking 16-bit weights as an example, weights take about parameter count × 2 bytes; 4-bit quantization is about parameter count × 0.6 bytes (including dequantization and alignment overhead).
# 70B dense model, 16-bit weightsweights ≈ 70e9 * 2B ≈ 140 GB# KV Cache (GQA, kv_heads=8, head_dim=128, layers=80)per_token = 2 * 80 * 8 * 128 * 2B ≈ 0.33 MB32k context ≈ 10.5 GB
As shown, in long-context scenarios the KV Cache can compete with the weights in magnitude, which is the fundamental reason techniques like GQA, KV quantization, and paged cache exist. For MoE models, weights are counted by the total, but compute is counted by the activated amount, so “tight on memory, ample on compute” is the norm.
5. Selection and Deployment Recommendations
- Define constraints before choosing a model: clarify the memory ceiling, concurrency, P99 latency, and context length, then work backward to the candidate capacity range.
- Evaluate activated parameters first, not the total: the serving cost of sparse models is closer to their activated scale.
- Use dual-track validation with general capability benchmarks plus a small business sample, avoiding reliance on leaderboards alone.
- On the deployment side, make good use of general cloud capability combinations: container platforms to host inference services, object storage for models and datasets, logging services with monitoring and alerting for observability, and message queues for request peak shaving.
- Leave room for evolution: at the structural level, position-encoding extensions and quantization schemes often extend a model’s lifecycle more than switching models does.
6. Conclusion
Structure determines characteristics, parameters determine cost, and activated parameters determine serving efficiency. Putting these three on the same table for trade-offs turns model selection from “going by feel” into a computable, reproducible engineering decision.
