Large Language Model Architectures and Parameter Scale Explained
This article breaks down the two main axes for understanding modern large language models: architecture and parameter count. It explains how dense and sparse Mixture-of-Experts (MoE) designs, attention optimizations, and positional encoding schemes affect training stability, inference throughput, and memory usage. It also covers parameter size tiers, memory estimation formulas, the general training and post-training pipeline, and practical selection advice for latency-sensitive, high-concurrency, long-context, and private deployment scenarios.
1. Why Architecture and Parameter Scale Are the Two Main Axes
When discussing a model in engineering practice, the two dimensions most often misread are network architecture and parameter scale. Architecture determines how computation happens, while parameter scale determines the capacity ceiling and inference cost. Together, they influence three things: training stability, inference throughput, and GPU memory usage. Although source materials often list many series and version entries, the information that is truly valuable to developers is not the version numbers themselves, but the common technical paradigms that repeatedly appear behind those entries. This article therefore strips away specific product references and discusses a general technical framework.
It is important to emphasize that parameter scale does not equal effective capability. The industry widely observes that data quality, training data mixtures, and post-training alignment strategies often contribute to final performance as much as parameter count itself.
2. Four Layers of Mainstream Modern Architecture Paradigms
2.1 Dense Architecture
Every token activates all parameters. The advantages are predictable memory and compute usage, mature operator implementations, and stable latency under low concurrency. The drawback is that the marginal cost of each unit of intelligence improvement is relatively high. It is suitable for latency-sensitive scenarios without extreme concurrency.
2.2 Sparse Mixture-of-Experts (MoE) Architecture
The feed-forward layers are split into multiple experts, and a routing network selects the Top-K experts for each token. There are three core metrics: total parameter count, activated parameter count, and expert parallelism degree. In engineering, load balancing and routing jitter require particular attention; otherwise, a few experts may overheat and overall throughput may collapse.
# Pseudocode: general representation of an MoE feed-forward layerlogits = router(x) # [batch*seq, num_experts]idx, gate = topk(softmax(logits), k=2)y = zeros_like(x)for e in unique(idx):mask = (idx == e)y[mask] += gate[mask] * expert[e](x[mask])
2.3 Efficiency Improvements to the Attention Mechanism
Common approaches include grouped-query attention to reduce the KV cache, sliding-window and local attention to limit the receptive field, and linear or sparse attention approximations. Their shared goal is to compress KV cache growth from linear to a controllable range under long contexts.
2.4 Positional Encoding and Long-Context Extrapolation
Rotary position embeddings combined with frequency scaling, interpolation, or chunking strategies are the mainstream methods for extending context windows today. When evaluating them, do not look only at the nominal window size; also examine the real degradation on long-text tasks such as middle-segment recall.
3. Parameter Scale Tiers and Cost Estimation
The industry generally divides scale roughly into four tiers: small (below the billion level, for on-device use and high-frequency classification), medium (billion to tens of billions, mainstream general-purpose), large (tens of billions to hundreds of billions, complex reasoning), and ultra-large (above hundreds of billions, mostly carried by sparse architectures).
A general estimation logic for GPU memory usage is as follows:
Weight memory ≈ parameter count × bytes per parameterInference peak ≈ weights + KV cache + activations and framework overheadKV cache ≈ 2 × layers × KV heads × head dimension × sequence length × batch size × bytes
Taking tens of billions of parameters in half precision as an example, the weights alone require tens of GB of GPU memory. Therefore, quantization (such as 8-bit/4-bit weights) and KV cache compression are almost mandatory for long-context inference. The advantage of sparse architectures here is very direct: total parameters can be very large, but activated parameters and weight read volume stay at a low level, yielding better cost-effectiveness in memory-bandwidth-constrained scenarios.
4. General Training and Post-Training Pipeline
- Pre-training: large-scale corpus cleaning, deduplication, and mixture design, combined with learning rate warmup and cosine decay.
- Mid-training: long-context extension and high-quality corpus annealing to improve knowledge density.
- Post-training: supervised fine-tuning plus preference optimization to shape instruction following and format stability.
- Evaluation: examine both general benchmarks and business-side custom sets to avoid overfitting to a single metric.
5. Practical Selection Advice
- Latency first, low concurrency: prioritize small and medium dense models.
- High concurrency, cost-sensitive: prioritize sparse architectures and focus on activated parameters rather than total parameters.
- Long-document scenarios: stress-test KV cache and middle-segment recall rather than looking only at window numbers.
- Private deployment: include the quantization scheme, memory watermark, and batching strategy in the evaluation.
If an enterprise wants to complete the above validation on Baidu AI Cloud, it can adopt a combination of general-purpose capabilities: a container platform to host inference services, object storage to hold corpora and model files, and logging and monitoring services to track latency and memory watermarks. This shifts architecture selection from “looking at parameters” to “looking at measurable service metrics.”
