LLM Architecture, Parameter Scale, and Model Selection Guide
This article explains how modern large language models are built, how to interpret parameter counts in both dense and mixture-of-experts architectures, how training methods shape model capability, and how to evaluate and select models based on real business requirements such as latency, context length, deployment cost, and concurrency rather than parameter numbers alone.
1. Why a Systematic Understanding of LLMs Matters
Large language models have evolved from simple text generation tools into general-purpose infrastructure capable of question answering, summarization, translation, code generation, information extraction, knowledge analysis, and agent-based tasks. When comparing models, developers typically ask:
- What network architecture does the model use?
- How large is its parameter count?
- Are total parameters the same as actual inference cost?
- Why do some smaller models achieve strong results?
- How do you choose a model for a business scenario instead of relying on marketing numbers?
These questions cannot be answered by “more parameters means better.” Model performance is jointly determined by architecture design, training data, training methods, context length, inference strategy, tool-calling ability, and task fit. Parameter count is an important measure of model capacity, but not the only one.
2. The Basic Structure of Modern LLMs
2.1 Transformer Remains the Mainstream Foundation
Most mainstream LLMs are built on the Transformer architecture. Its core components include:
Tokenizer
Splits text into discrete units the model can process. A word, a character, a punctuation mark, or a character sequence may each map to one or more tokens.Embedding layer
Maps discrete tokens to continuous vectors so the model can process text mathematically.Stacked network blocks
Each layer typically consists of an attention mechanism, a feed-forward network, normalization, and residual connections.Output layer
Predicts the probability distribution of the next token given the preceding context.
The model does not understand and produce an entire passage at once. It generates text step by step by predicting the next token, recomputing candidate probabilities against the existing context at each step.
2.2 Attention Models Contextual Relationships
The attention mechanism determines which parts of the context the current token should focus on. When processing “the server receives a request and returns a response,” the model must build semantic links such as “server–receives–request” and “returns–response.”
Classic multi-head attention assigns independent queries, keys, and values to each head. To reduce cache and compute overhead during inference, several variants are commonly used:
- Multi-head attention (MHA): strong expressiveness, but higher compute and cache costs;
- Grouped-query attention (GQA): multiple query heads share a subset of keys and values, balancing quality and efficiency;
- Multi-query attention (MQA): all query heads share a single set of keys and values, significantly reducing cache size;
- Sparse or sliding-window attention: attends only to part of the context, suitable for very long texts.
None of these is universally superior. Full attention suits tasks that require precise use of global context, while sparse mechanisms fit scenarios with extremely long inputs where local relationships matter most.
2.3 Feed-Forward Networks Handle the Main Nonlinear Transformations
Within each Transformer layer, the feed-forward network typically contains two or more linear transformations combined with a nonlinear activation function. It applies an independent high-dimensional transformation to the semantic representation at each position.
At equal parameter counts, the width of the feed-forward network, the activation function, the gating structure, and the number of layers all affect model capability. Modern models often use gated feed-forward structures that let the model learn which information should pass through and which should be suppressed, improving training stability and expressiveness.
2.4 Position Encoding Determines How the Model Understands Order
Language is strongly order-dependent. “Execute first, then roll back” and “roll back first, then execute” mean entirely different operations. Position encoding injects token order information into the model.
Common designs include:
- Absolute position encoding;
- Relative position encoding;
- Rotation-based position encoding;
- Position encoding variants that support context extension.
When evaluating long-context models, do not look only at the advertised context length. Also examine how well the model retains information at different positions. Some models accept long inputs but show degraded recall of content in the middle or unstable long-range dependencies in practice.
3. Dense Models vs. Sparse Mixture-of-Experts Models
3.1 Dense Models
In a dense model, nearly all parameters participate in computation for every input token.
If a model has ten billion parameters, processing each token roughly involves all ten billion. Advantages include:
- Relatively simple structure;
- Mature training and deployment pipelines;
- Predictable computational behavior;
- Suitability for general-purpose inference and small-to-medium deployments.
The downside is that compute cost grows in lockstep with total parameters. As models scale up, memory, bandwidth, and inference latency all increase noticeably.
3.2 Sparse Mixture-of-Experts Models
Sparse mixture-of-experts (MoE) models place multiple expert modules in some layers and use a router to select a small number of experts for each token.
For example, a model may have tens of billions or more total parameters, but activate only a small fraction per token. Two concepts must be distinguished:
- Total parameters: the sum of all expert and shared module parameters;
- Active parameters: the parameters actually involved in computing a single token.
MoE models can control per-token compute while maintaining high total capacity, making them suitable for large general-purpose models. But they introduce new engineering challenges:
- Load imbalance across experts;
- Router training stability;
- Higher network communication requirements in distributed deployment;
- Total memory must still hold all parameters;
- Fewer active parameters do not automatically guarantee better results.
When choosing an MoE model, do not focus only on active parameters. Consider total memory footprint, communication overhead, concurrency, and deployment topology together.
3.3 Shared Parameters vs. Expert Parameters
Many sparse architectures combine shared modules with expert modules. Shared modules handle foundational capabilities needed by all inputs, such as general semantic understanding, format modeling, and basic reasoning; expert modules learn features for different domains or patterns.
This design reduces redundant learning across experts, but actual resource consumption still depends on parameter precision, parallelism strategy, and caching policy. In enterprise deployments, memory usage and throughput should be measured through real load testing rather than estimated from parameter counts alone.
4. How to Interpret Parameter Scale
4.1 Parameters Represent Capacity, Not Guaranteed Performance
Parameters are the numerical values a model learns during training. More parameters generally mean stronger representational capacity, but also:
- More data and compute required for training;
- Higher memory demands at inference;
- Longer model loading times;
- Higher concurrency deployment costs;
- More complex quantization and sharding strategies.
Conversely, if training data quality is insufficient or the training objective is poorly designed, adding parameters may yield limited gains and can even lead to overfitting, factual errors, or degraded inference efficiency.
4.2 Common Scale Ranges
From a deployment perspective, models can be roughly grouped as follows:
Small Models
Typically from hundreds of millions to a few billion parameters. Suitable for:
- Running on local devices;
- Lightweight text classification;
- Information extraction;
- Simple question answering;
- Edge inference;
- Latency- and cost-sensitive services.
Small models respond quickly and are easy to deploy, but usually have limited complex reasoning, long-text comprehension, and open-domain knowledge capabilities.
Medium Models
Typically from a few billion to tens of billions of parameters. They cover most common enterprise tasks: knowledge-base Q&A, document summarization, code assistance, structured information extraction, and intelligent customer service.
Medium models are often the sweet spot for enterprise adoption: clearly stronger than small models while requiring far fewer resources than very large ones.
Large Models
With tens of billions of parameters or more, these models generally offer strong general reasoning, complex instruction following, and multi-task transfer. They fit high-value, high-complexity scenarios such as multi-step analysis, complex code generation, long-document research, and AI agents.
However, large models cost more and require careful planning around memory, network bandwidth, batching strategy, failover, and elastic scaling.
5. Parameter Precision and Actual Resource Consumption
The same model can occupy very different amounts of memory under different numeric precisions. Common options include:
- Full-precision floating point: good numerical stability but resource-heavy;
- Half-precision floating point: common in training and inference;
- Lower-bit-width integers: significantly reduce model size and bandwidth pressure;
- Mixed precision: applies different precisions to different layers, trading off quality and cost.
A rough estimate of weight memory is:
Weight memory ≈ parameter count × bytes per parameter
But this is only a baseline. Real deployments must also account for:
- Attention (KV) cache;
- Temporary activations;
- Runtime workspace;
- Multi-GPU communication buffers;
- Number of concurrent requests;
- Input and output lengths;
- Whether batching is enabled;
- Whether parameter sharding is used.
Therefore, identical parameter counts do not imply identical deployment costs. Especially in long-context and high-concurrency scenarios, the attention cache can become the dominant resource consumer.
6. How Training Methods Shape Model Capability
6.1 Pre-training
Pre-training uses large-scale text, code, and structured data so the model learns language patterns, knowledge associations, and general regularities. Data quality, deduplication strategy, data mixture ratios, and time coverage all influence final performance.
6.2 Instruction Tuning
Instruction tuning teaches the model to complete tasks based on natural-language instructions: answering questions, following formats, explaining its process, and declining inappropriate requests. A model without sufficient instruction tuning may have strong language-modeling ability but fail to reliably follow user instructions.
6.3 Preference Optimization
Preference optimization uses human or automated evaluation signals to steer the model toward helpful, accurate, clear, and safe responses. It generally improves the interaction experience, but care is needed to prevent excessive sycophancy, verbose answers, or avoidance of legitimate questions.
6.4 Reasoning Enhancement
Some models are trained with longer reasoning traces, process supervision, or multi-step task samples to improve complex problem solving. These models may be slower and more expensive per request, but can deliver more stable results on math, code, planning, and complex analysis tasks.
7. How to Choose a Model by Scenario
7.1 Low-Latency Scenarios
Real-time customer service, search suggestions, and online form processing prioritize response speed. Prefer small or medium models, and reduce latency through caching, batching, quantization, and context trimming.
7.2 Long-Text Scenarios
Contract analysis, technical document summarization, and knowledge-base Q&A require long contexts. Beyond the maximum context length, evaluate:
- Recall of key information within long texts;
- Ability to connect content across multiple sections;
- How latency changes as input length grows;
- Memory growth caused by the attention cache;
- Document chunking and retrieval strategies.
7.3 Complex Reasoning Scenarios
For multi-step planning, complex code analysis, and logical judgment, focus on reasoning stability, error self-correction, and structured output capability rather than simply chasing larger parameter counts.
7.4 Enterprise Private Deployment
Private deployment requires a combined assessment of model licensing, hardware resources, data security, upgrade mechanisms, monitoring, and operational complexity. Where appropriate, use a tiered architecture: small models handle high-frequency simple requests while large models handle a small number of complex ones, reducing overall cost.
8. Metrics to Consider When Evaluating Models
A complete evaluation framework should cover at least these dimensions:
- Task accuracy: does it actually solve the business problem;
- Factual reliability: does it hallucinate;
- Instruction following: can it produce the required output format;
- Long-context capability: can it effectively use distant information;
- Code quality: is the generated code runnable and maintainable;
- Response latency: time to first token and full response time;
- Throughput: requests processed per unit of time;
- Resource consumption: GPU memory, RAM, CPU, and network usage;
- Stability: reliability under high concurrency and abnormal conditions;
- Safety: handling of sensitive content and unauthorized requests.
On cloud platforms such as Baidu AI Cloud, you can combine compute resources, object storage, logging services, monitoring and alerting, and container platforms to build an integrated workflow covering model deployment, data management, and service monitoring. The specific architecture should still be designed around your data scale, compliance requirements, and access patterns.
9. Conclusion
Modern LLMs remain deep neural networks based on the Transformer, but they continue to evolve in attention mechanisms, position encoding, feed-forward structures, sparse experts, and inference optimization.
When evaluating models, keep these distinctions clear:
- Total parameters are not the same as active parameters;
- Active parameters are not the same as actual memory usage;
- Parameter scale is not the same as final model quality;
- Context length is not the same as long-text comprehension;
- Theoretical throughput is not the same as real business throughput.
For developers, the soundest selection method is not to find the model with the most parameters, but to first define the task type, latency requirements, concurrency scale, data sensitivity, and deployment budget, then decide through standardized evaluation and real-world load testing. For enterprises, the model itself is only the foundational capability—what truly determines system value also includes data governance, retrieval augmentation, tool calling, access control, monitoring and alerting, and continuous evaluation.
