Understanding Modern LLM Architecture, Parameter Scale, and Model Selection
This article explains why parameter count alone is a misleading metric for large language models, covering core concepts like total vs. active parameters, dense and Mixture-of-Experts architectures, Transformer components, inference cost estimation (weights, KV cache, context length), and a practical framework for selecting the right model based on latency, quality, deployment, and evaluation requirements.
1. Why Parameter Count Alone Is Not Enough
When discussing large language models, “parameter count” is often the most frequently cited—and most easily misunderstood—metric. A model may have billions or tens of billions of parameters, or even more, but that does not mean it performs better on every task, nor does it mean deployment cost scales directly with the total parameter count.
The reason is that modern models involve several distinct concepts:
- Total parameter count: the number of all trainable parameters in the model.
- Active parameter count: the number of parameters actually involved in computation when processing a single token.
- Non-embedding parameter count: the parameter scale after excluding vocabulary embeddings, output layers, and similar components.
- Context length: the maximum number of tokens the model can process at once.
- Compute: the floating-point operations required for a single inference pass, typically related to input length, output length, and active parameters.
- Memory footprint: determined not only by model weights, but also by caches, batch size, quantization, and parallelism strategies.
Therefore, evaluating a model requires more than asking “how many parameters does it have?” You should also understand its architecture, how many parameters are computed per inference, what context length it supports, and its effectiveness and cost on the target task.
2. The Basic Architecture of Modern LLMs
Most mainstream general-purpose language models today are built on the Transformer architecture. The basic workflow is: split text into tokens, convert them into vector representations, model contextual relationships through multiple neural network layers, and finally predict the next token.
2.1 Tokenization and Vector Representation
Input text first goes through tokenization. A character, English word, number, or punctuation mark may correspond to one or more tokens. The tokenization method directly affects context length, inference speed, and vocabulary size.
After tokens are assigned IDs, they are mapped to continuous vectors. This process typically includes:
- Vocabulary mapping;
- Token embeddings;
- Positional encoding;
- Input format markers;
- Role identifiers for multi-turn conversations.
Positional information helps the model distinguish the order of tokens. Modern models often use rotary position embeddings or other relative position representations to improve long-text handling.
2.2 The Transformer Decoder
Text generation models typically use a causal decoder architecture. When predicting the current position, the model can only see content before that position and cannot access future tokens.
A typical Transformer layer contains:
- Normalization modules: stabilize training and improve the numerical behavior of deep networks.
- Attention modules: compute dependencies between different tokens.
- Feed-forward networks: apply nonlinear transformations to each position’s representation.
- Residual connections: mitigate gradient propagation problems in deep network training.
The attention mechanism is key to how the model understands context. For each position in the input sequence, the model computes its relevance to other positions and aggregates information accordingly. As sequence length grows, attention computation and cache overhead increase significantly, making long-context optimization an important research direction.
2.3 Engineering Optimizations for Attention
Standard multi-head attention stores key and value caches for every attention head. During text generation, historical content usually does not need to be recomputed, but the cache consumes substantial memory.
Common optimization approaches include:
- Reducing the number of key and value heads;
- Sharing key-value representations across multiple query heads;
- Using more efficient attention kernels;
- Storing the cache in lower precision;
- Adopting chunked, paged, or hierarchical cache management;
- Using sparse attention to reduce unnecessary computation.
These optimizations may not change the total parameter count, but they can significantly affect actual throughput, latency, and deployment cost.
3. Dense Models vs. Mixture-of-Experts Models
Modern LLMs can be broadly divided into two categories: dense models and Mixture-of-Experts (MoE) models.
3.1 Dense Models
The defining feature of dense models is that every input token passes through nearly the same network layers. If a model has several layers, each containing an attention module and a feed-forward network, a token sequentially passes through all these modules during inference.
Advantages include:
- Relatively simple architecture;
- Mature training and deployment workflows;
- More stable computational behavior;
- Straightforward resource planning;
- Easier adaptation to small-scale hardware environments.
The downside is that as model scale grows, every token must execute the full network, so compute cost and memory pressure rise in tandem.
3.2 Mixture-of-Experts Models
MoE models typically split the feed-forward network into multiple expert modules and add a router. Based on the current token’s representation, the router selects a small number of experts to participate in computation.
These models have two important parameter measurements:
- Total parameter count: the combined scale of all expert parameters;
- Active parameter count: the scale of expert parameters actually invoked per token.
For example, a model may have a large total parameter count, but each token activates only a small fraction of its experts. This allows large capacity while controlling per-token compute.
MoE models offer higher compute efficiency and larger capacity, making them suitable for large-scale training and high-throughput inference. However, they also introduce new engineering challenges:
- Communication is required between experts;
- Routing loads may be imbalanced;
- Some experts may be invoked disproportionately often;
- Distributed deployment is more complex;
- Memory usage is not necessarily determined by active parameter count alone.
It is important to note: active parameter count primarily affects compute, while whether the model weights can fully reside on a device still depends on total parameter count, precision, and sharding strategy.
4. What Parameter Count Really Means
4.1 Parameter Count and Model Capability
Parameters can be understood as the adjustable values a model learns from training data. Generally, as parameter scale increases, the model can express more complex linguistic patterns and knowledge relationships, but capability improvement is not infinitely linear.
Model effectiveness also depends on:
- Quality of training data;
- Data coverage;
- Training objectives;
- Number of training tokens;
- Optimization algorithms;
- Data cleaning strategies;
- Quality of instruction tuning;
- Prompt design at inference time;
- Tool-calling and retrieval-augmentation capabilities.
A model with more parameters but lower-quality data is not necessarily better than a smaller model trained more thoroughly.
4.2 Common Parameter Scale Tiers
From an engineering perspective, models can be roughly categorized into the following tiers:
- Lightweight models: suitable for end devices, edge devices, simple classification, summarization, and structured extraction.
- Medium-scale models: suitable for enterprise knowledge Q&A, code assistance, content generation, and multi-turn conversation.
- Large-scale models: suitable for complex reasoning, long-document analysis, cross-domain tasks, and high-difficulty generation.
- Very large MoE models: achieve stronger knowledge expression through large total parameter capacity while using sparse activation to control per-token compute.
These divisions are not strict standards. In practice, decisions should be based on latency, concurrency, precision, and budget—not simply on ranking by parameter count.
5. Training vs. Inference
5.1 Pre-training
The pre-training stage typically uses large-scale text, code, and other sequential data to teach the model language structure, knowledge associations, and basic reasoning patterns. The core objective is generally to predict subsequent tokens based on existing content.
Pre-training costs mainly come from:
- Data loading and cleaning;
- Model forward computation;
- Backpropagation;
- Gradient synchronization;
- Checkpoint saving;
- Cluster communication;
- Training stability monitoring.
During training, weights, gradients, and optimizer states must all be stored, so memory requirements are far higher than simply loading the model for inference.
5.2 Instruction Tuning
Pre-trained models usually only have text continuation ability. They also need instruction data to learn how to understand tasks, follow formats, and engage in multi-turn interaction.
Instruction tuning can improve:
- Question comprehension;
- Output format stability;
- Role and tone control;
- Refusal behavior and safety boundaries;
- Tool-calling workflows;
- Complex task decomposition.
5.3 Preference Alignment
In real applications, users care not only about correctness but also about clarity, safety, and compliance with task requirements. Models may therefore undergo preference optimization to make them more inclined to produce helpful, accurate, concise, and well-formed content.
However, preference alignment can also cause excessive caution, templated responses, or constrained knowledge expression, so it should be evaluated in the context of the task type.
6. How to Estimate Inference Cost
Model inference cost is primarily influenced by the following factors:
6.1 Weight Memory
If a model uses higher-precision storage, each parameter requires more bytes. Lower-precision quantization reduces weight memory but may introduce some accuracy loss.
A rough calculation is:
Weight memory ≈ number of parameters × bytes per parameter
Actual deployment must also account for quantization metadata, temporary buffers, and framework overhead.
6.2 KV Cache
Generative inference typically stores key-value representations of historical tokens to avoid recomputation. The longer the context and the larger the batch, the higher the KV cache usage.
Therefore, even if a model’s weights fit on a device, increased context length or concurrency may exhaust cache capacity, reducing throughput or even preventing normal operation.
6.3 Input and Output Length
The total compute for a request is generally related to the number of input and output tokens. Long-document Q&A, long-text continuation, and batch summarization all significantly increase inference cost.
In practice, distinguish between:
- Time to first token: the time required to process the input and generate the first token;
- Generation speed: tokens generated per second during the continuous output phase;
- Total request latency: the time from request start to complete response;
- Unit cost: the compute resources needed to complete a fixed task.
7. How to Choose the Right Model Architecture
7.1 Low-Latency Scenarios
If the application demands fast responses—such as real-time Q&A, interactive assistants, or online customer service—prioritize:
- Smaller active parameter counts;
- Quantization support;
- Efficient cache management;
- Reasonable context length;
- Stable batching strategies.
7.2 High-Quality Complex Tasks
For complex reasoning, long-document analysis, code generation, and multi-step tasks, choose models with larger parameter scale and more thorough training data. At the same time, provision stronger compute resources and implement timeout, rate-limiting, and fallback strategies.
7.3 On-Premises and Private Deployment
If data cannot leave the internal environment, focus on evaluating:
- Model weight licensing;
- Hardware compatibility;
- Quantization quality;
- Concurrency capability;
- Logging and auditing mechanisms;
- Data isolation;
- Upgrade and rollback procedures.
In these scenarios, bigger is not always better. A model that runs stably, is easy to maintain, and meets accuracy requirements often delivers more practical value than a theoretically stronger model with excessive resource consumption.
8. Build a Complete Evaluation Framework
It is recommended to evaluate models across four dimensions:
- Capability metrics: knowledge Q&A, reasoning, code, summarization, extraction, and classification performance.
- Stability metrics: format adherence rate, repetition rate, hallucination rate, and long-text consistency.
- Performance metrics: time to first token, generation speed, concurrent throughput, and resource utilization.
- Engineering metrics: deployment difficulty, monitoring capability, fault recovery, version management, and security.
Enterprise applications should ideally build test sets from real business data rather than relying solely on public benchmarks. The test set should cover common requests, edge cases, malicious inputs, very long inputs, and malformed formats.
9. Conclusion
The core of modern LLMs is not simply “more parameters means better performance,” but the combined effect of architecture, data, training methods, and inference systems. Dense models are easy to understand and deploy, while MoE models strike a balance between large capacity and low active compute. Total parameter count determines model capacity, active parameter count affects per-token compute, and KV cache plus context length directly determine actual memory usage and concurrency capability.
When selecting a model, first clarify the task objectives, then comprehensively compare model quality, latency, cost, deployment environment, and security requirements. Only by understanding parameter scale within the complete technical system can you avoid being misled by a single number and build LLM applications that are truly deployable, scalable, and maintainable.
