Understanding Modern LLM Architectures and Parameter Scale
This article breaks down the two main axes for evaluating modern large language models: architecture and parameter scale. It compares dense and sparse Mixture-of-Experts (MoE) designs, reviews attention and positional encoding advances for long context, and explains how to distinguish total parameters, activated parameters, and serving memory. It also offers practical selection, benchmarking, and deployment guidance, plus common misconceptions to avoid.
1. Why Architecture and Parameter Scale Are the Two Main Axes
When evaluating a modern large language model, developers most often ask two questions: what architecture does it use, and how many parameters does it have. These two dimensions largely determine a model’s capability ceiling and its usage cost. Architecture governs how information flows within and across layers, while parameter scale determines how much knowledge the model can hold and how well it can fit data. The two are not linearly correlated: better architectural design can approach the effect of a larger model with fewer parameters, while scaling parameters up brings linear or even super-linear growth in memory, bandwidth, and inference latency.
There is no single “correct” architecture in the industry. Different teams make different trade-offs based on training cost, inference cost, context length requirements, and deployment form. This article therefore does not benchmark any specific model; instead, it abstracts a transferable framework for technical judgment.
2. Two Mainstream Parameter Organization Paradigms
2.1 Dense Architecture
In a dense model, the feed-forward network in every layer computes over all hidden dimensions, and all parameters are activated in every forward pass. The advantages are simple engineering implementation, operator friendliness, and stable training. The drawback is that inference compute is strictly bound to total parameter count, so scaling up means a proportional cost increase. Dense architectures are common in small-to-medium scale and latency-sensitive scenarios.
2.2 Sparse Mixture-of-Experts (MoE)
A sparse MoE replaces the feed-forward layer with several “expert” subnetworks, and a gating network selects a few experts to participate in computation for each token. Its core value is decoupling “total parameter count” from “activated parameters per token”: the total parameter count can be made very large to carry knowledge, while a single inference activates only a small portion, controlling compute overhead.
Engineering practice must confront three costs:
- Load imbalance: the gate tends to route many tokens to a few experts, requiring auxiliary losses or a capacity factor as constraints;
- Communication overhead: expert parallelism introduces all-to-all communication into the critical path, making it sensitive to interconnect bandwidth;
- Training stability: routing decisions are discrete, usually requiring more careful learning rate and initialization strategies.
The routing logic can be abstracted schematically as:
# Pseudocode: expresses only the idea of gating and sparse activationlogits = gate(hidden_state) # [tokens, num_experts]topk_idx = topk(logits, k=2) # each token selects 2 expertsweights = softmax(select(logits, topk_idx))out = sum(weights[i] * expert[topk_idx[i]](hidden_state) for i in range(k))
3. The Evolution of Attention and Context
Multi-head attention remains the baseline, but several general improvement ideas have emerged around the cost of long context:
- Grouped-query attention (GQA) and multi-query attention (MQA): let multiple query heads share one set of key-value heads, significantly compressing the key-value cache size during inference;
- Sliding window and local-global hybrids: local layers handle fine-grained patterns, while a few global layers handle long-range dependencies;
- Sparse or linear attention variants: trade a controllable approximation for lower complexity, at the cost of possibly weakened long-range exact retrieval;
- Key-value cache compression and quantization: reduce memory usage within acceptable accuracy loss.
For positional encoding, rotary position embedding combined with frequency scaling (such as position interpolation and frequency extrapolation methods) has become a common approach for extending the context window. Normalization is typically pre-applied root mean square normalization, and residual connections preserve identity mapping. These details affect large-scale training stability far more than intuition suggests.
4. Understanding Parameter Scale in Layers
When discussing “how many parameters,” you must distinguish three different numbers, or conclusions will be distorted:
- Total parameters: the total amount of model weights, determining weight occupancy in memory;
- Activated parameters: the parameters actually involved in computation in a single token forward pass, determining compute and latency;
- Serving memory footprint: weights + key-value cache + communication buffers + framework overhead, usually far larger than the weights themselves.
Rough estimation can help build an order-of-magnitude intuition (illustrative only, not exact formulas):
Weight memory ≈ total parameters × bytes per parameter # about 2 bytes for FP16KV cache ≈ 2 × num_layers × num_kv_heads × head_dim × seq_len × batch_size × bytes
In practice, the key-value cache in long-context scenarios often becomes a harder constraint than the weights. This is the fundamental reason grouped-query attention and cache compression are widely adopted.
5. Practical Selection and Validation Recommendations
- Define constraints before choosing scale: clarify latency targets, concurrency, context length, and budget, then work backward to the affordable range of total and activated parameters;
- Use total parameters to assess the capability ceiling and activated parameters to assess unit cost, and benchmark the two separately;
- Focus on architectural details rather than numbers alone: attention variants, normalization placement, activation functions, and vocabulary size all change actual performance;
- Build your own small-scale evaluation set covering four task types: long-context retrieval, structured output, code, and multi-turn consistency;
- On the deployment side, prioritize combinations of general cloud capabilities, such as container platforms hosting inference services, object storage for models and datasets, message queues for request peak shaving, and logging services with monitoring and alerting for observability, so you can focus your energy on the model and business logic itself.
6. Common Misconceptions
- Believing more parameters always means stronger: data quality, training recipes, and post-training alignment are equally critical;
- Treating total parameters as a compute metric: under sparse architectures the two can differ by several times;
- Ignoring inference-side cost: training is a one-time investment, while inference is a long-term recurring expense;
- Looking only at leaderboards and not your own distribution: public benchmarks and real business distributions often diverge significantly.
In summary, the right way to understand modern large language models is: first determine dense or sparse, then break down the attention and positional encoding scheme, and finally do engineering accounting with the three numbers of total parameters, activated parameters, and serving memory. With this framework, you can quickly complete architecture judgment and cost estimation for each new model version, without relying on the marketing of a single model.
