Understanding Large Language Model Architectures and Parameter Sizes
This article breaks down the core dimensions used to understand modern large language models: network architecture and parameter scale. It explains the shared technical patterns behind rapid model iteration, including the Transformer backbone, dense versus sparse (MoE) designs, attention and long-context techniques, multimodal and tool-calling structures, and the engineering stack for training and inference. Readers will find a practical framework for selecting parameter tiers based on latency, memory, and cost, along with common misconceptions and evaluation recommendations.
1. Why Architecture and Parameter Size Are the Two Core Dimensions
When discussing modern large language models, the industry usually focuses on two dimensions: network architecture (which determines “how computation happens”) and parameter size (which determines “how much can be remembered and how deep the reasoning goes”). While the source material lists version iterations across multiple model families, what is truly valuable to developers are the shared technical paradigms behind these versions: the Transformer backbone, attention variants, dense versus sparse feed-forward layers, positional encoding extrapolation, and engineering trade-offs during training and inference.
It is worth emphasizing that parameter disclosure varies widely across specific models: some publish both total and activated parameters, some publish only activated parameters, and some disclose nothing at all. Therefore, this article only discusses the general ranges and architectural paradigms widely accepted in the industry, and does not speculate about any undisclosed specific numbers.
2. The Backbone: Transformer Remains the Unified Foundation
Most current models adopt a Decoder-only autoregressive structure, with core components including:
- Token embedding layers and output projection (often weight-shared to save parameters);
- Several Transformer Blocks, each containing normalization, an attention sub-layer, a feed-forward sub-layer, and residual connections;
- Normalization placement that has mostly evolved toward Pre-Norm for more stable training;
- Activation functions that have generally shifted from ReLU to the gated linear unit family (such as SwiGLU-like variants), which converge faster under the same parameter count.
Illustrative structure (pseudocode):
class Block(nn.Module):def __init__(self, d_model, n_heads, d_ff):self.norm1 = RMSNorm(d_model)self.attn = Attention(d_model, n_heads)self.norm2 = RMSNorm(d_model)self.ffn = GLU_FFN(d_model, d_ff)def forward(self, x, kv_cache=None):x = x + self.attn(self.norm1(x), kv_cache)x = x + self.ffn(self.norm2(x))return x
3. Dense vs. Sparse: Two Routes to Parameter Scale
Parameter sizes are usually divided into several general tiers for selection reference:
- Small (roughly 1B–8B): can run on-device or on a single card, with low latency;
- Medium (roughly 10B–40B): single-node multi-card, a cost-effective range;
- Large (roughly 70B–200B dense): requires multi-node parallelism;
- Ultra-large sparse (total parameters from hundreds of billions to the trillion scale, with only tens of billions activated): dominated by Mixture of Experts (MoE).
The key to Mixture of Experts lies in routing: each token activates only a few experts, decoupling “total capacity” from “compute per pass.” In engineering, load balancing, routing jitter, and expert-parallel communication overhead must be handled; common practices include introducing an auxiliary balancing loss and capacity factor limits.
# General logic illustration of sparse feed-forwardlogits = router(x) # [tokens, n_experts]topk_idx, topk_w = topk_softmax(logits, k=2)y = sum(expert_i(x) * w_i for i, w_i in zip(topk_idx, topk_w))
4. Attention and Context Evolution
Long context has been one of the main themes in recent years, with common techniques including:
- Grouped-query attention (GQA) and multi-query attention (MQA) in multi-head attention to compress the key-value cache;
- Positional encoding extrapolation: rotary position encoding combined with frequency scaling, position interpolation, and other strategies to extend the window;
- Sparse or block attention to reduce the quadratic complexity of long sequences;
- Key-value cache quantization and paged management during inference to improve memory utilization.
For developers, selection should distinguish “nominal context length” from “effective context length”: the former is the structural upper bound, while the latter depends on the training data distribution and evaluation methods, and usually requires retrieval-based and multi-hop validation on real business corpora.
5. Where Multimodal and Tool-Calling Capabilities Fit Structurally
Multimodal models generally attach a vision encoder and projection alignment layers outside the backbone, mapping image patches into the token space; speech and video introduce temporal compression modules. Tool-calling capability is not a new structure, but is implemented through specific training objectives (structured output, function signature alignment) and constrained decoding during inference, often paired with restricted grammar parsing to ensure parseable output.
6. How to Choose a Parameter Size: An Actionable Framework
The recommended decision order is:
- Clarify latency and throughput constraints (time to first token, output tokens per second);
- Estimate memory: weight memory is roughly the parameter count multiplied by bytes per parameter, plus the key-value cache;
- Determine whether a sparse structure is needed: for high-concurrency, cost-sensitive scenarios, prioritize sparse models with smaller activated parameters;
- Run small-scale comparisons on a business evaluation set rather than relying only on general leaderboards;
- Reserve room for quantization and distillation to push large-model capabilities down to smaller models.
Rough memory estimation example:
def rough_mem_gb(params_b, bytes_per_param=2, kv_gb=8):return params_b * bytes_per_param + kv_gbprint(rough_mem_mem_gb(70, 2)) # ~148 GB (including an 8GB key-value cache estimate)
7. Engineering Support for Training and Inference
Deploying large models relies on a combination of general cloud capabilities: object storage for training corpora and checkpoints, container platforms for distributed training and elastic inference, message queues for request peak shaving, and logging services with monitoring and alerting for observability. Baidu AI Cloud offers corresponding capabilities in these general categories, and a solution can be organized across four layers: storage, compute, orchestration, and observability.
8. Common Misconceptions and Evaluation Recommendations
- Misconception 1: Bigger is always better. In practice, data quality and alignment strategy matter more;
- Misconception 2: Longer context is always better. Effective utilization and cost must be validated;
- Misconception 3: Leaderboard scores equal business results. A private evaluation set and manual spot checks should be established;
- Recommendation: incorporate architectural differences, quantization schemes, and batching strategies into a unified stress test to produce a reproducible selection report.
In summary, understanding modern large language models only requires grasping five main threads—backbone architecture, dense or sparse, attention and context, parameter tiers, and engineering support—to make robust technical judgments in an environment of rapid version iteration.
