Modern Large Language Model Architectures and Parameter Counts Explained
Understand how LLM architecture, total and active parameter counts, memory requirements, and context length affect deployment. This article explains dense and mixture-of-experts models, KV cache costs, inference performance, and a practical framework for evaluating model quality, latency, throughput, and resource costs.
1. Understanding Modern LLMs Starts with Three Questions
Discussions of large language models often focus on two questions: What architecture does the model use, and how many parameters does it have? Neither is enough to determine whether a model fits a business application. A third question is essential: How are those parameters used at runtime, and what compute, storage, and communication resources do they consume?
Modern model design often follows three directions:
- Expand the capacity to store and represent knowledge without increasing the computation required for every generated token proportionally.
- Support longer input sequences while controlling attention computation and inference cache costs.
- Improve hardware utilization so that theoretical computational advantages translate into practical throughput and response times.
Understanding a model therefore requires examining its architecture, parameters, and runtime behavior together. Two models with similar total parameter counts can have very different inference costs. Two models with the same context limit can also differ substantially in how well they handle long documents.
The source material provides a model catalog and several architectural trends, but not enough verifiable configuration details to establish specific model sizes. Rather than infer those specifications, this article presents a general framework for interpreting public technical documentation and selecting models for deployment.
2. The Basic Structure of Generative Language Models
Decoder-Based Autoregressive Models
Language models designed for open-ended text generation commonly use attention-based decoder architectures. Their core training objective is to predict the next token from the tokens that precede it.
A token is a unit defined by a tokenizer. It does not necessarily correspond to a complete word, character, or punctuation mark. A context limit measured in tokens therefore cannot be directly interpreted as a fixed number of words or characters.
A typical processing pipeline is:
Input text → Tokenization → Token embeddings → Decoder layers → Output projection → Next-token probabilities
Each decoder layer typically includes:
- An attention module that aggregates information from relevant sequence positions.
- A feed-forward network that transforms features.
- Normalization operations that improve numerical stability and training behavior.
- Residual connections that preserve information and help optimize deep networks.
Generation uses a causal constraint: each position can access information at that position and earlier positions, but not content that has not yet been generated.
What Attention and Feed-Forward Networks Do
Attention acts as a dynamic mechanism for retrieving and combining information. The same token can attend to different positions in different contexts, producing a context-dependent representation.
The feed-forward network applies nonlinear transformations to the representation at each position. In many model configurations, feed-forward networks account for a substantial share of the parameters, making them an important place to expand model capacity.
Mixture-of-experts architectures typically introduce multiple experts within the feed-forward portion rather than simply duplicating the entire model. This distinction explains how a model can have a large total parameter count while activating far fewer parameters for each token.
Not Every Model Uses the Same Computational Units
Some architectures use local attention, state-update units, or a combination of sequence-processing mechanisms instead of relying exclusively on global attention.
These designs generally aim to reduce the time or memory required to process long sequences, but they introduce trade-offs. Restricting the attention range, for example, can reduce computation while limiting direct access to distant information. Other mechanisms may be needed to compensate.
Calling a model “attention-based” is therefore only a broad classification. It does not replace an examination of layer-level computation, information flow, and caching mechanisms.
3. How to Interpret Parameter Counts
Total Parameters Measure Learnable Weights
The total parameter count includes all learnable parameters in a model, such as embedding matrices, attention projection matrices, feed-forward weights, and any router or expert-network parameters.
Technical documentation commonly uses these units:
- B: billion, or 10⁹.
- T: trillion, or 10¹².
Models with several billion to tens of billions of parameters are common, while larger models can reach hundreds of billions or trillions. These numbers describe scale, not a ranking of model quality.
More parameters generally provide a higher capacity ceiling. Actual performance also depends on training data, training compute, optimization methods, post-training, and suitability for the target task.
Active Parameters Measure the Computational Path
In a dense model, a token typically uses most of the core network weights as it passes through the layers. Active and total parameter counts are therefore relatively close, although counting conventions can differ for components such as large embedding tables.
In a sparse mixture-of-experts model, a layer may contain multiple experts, but each token is routed to only a few of them. This creates two distinct measurements:
- Total parameters: parameters in all shared modules and all experts.
- Active parameters: parameters in the shared modules and selected experts used during a token’s forward pass.
Total parameters describe capacity, while active parameters more closely describe the computational path. Neither directly determines latency.
Even with fewer active parameters, inference can be inefficient if experts are spread across multiple devices. Communication delays, uneven workloads, and small computation batches can offset the theoretical savings.
Why Parameter Count Is Not a Capability Score
Two models with the same total parameter count can perform very differently if one is well trained on high-quality data and the other is substantially undertrained.
Performance also does not necessarily improve uniformly across mathematical reasoning, code generation, factual question answering, information extraction, and long-document understanding.
Parameter counts are useful for understanding resource scale and architectural choices. They should not be the sole basis for purchasing or model selection.
4. Dense Models vs. Mixture-of-Experts Models
Dense Models: Consistent Computation and More Direct Deployment
Dense models use a relatively consistent computational path for each token.
Their engineering advantages include:
- Regular computation graphs that support batching and operator optimization.
- No need for complex expert routing.
- Less dynamic expert dispatch in multi-device deployments.
- Generally more straightforward capacity planning and performance diagnosis.
The limitation is that increasing model size usually increases both computation and weight-reading costs per token.
Mixture-of-Experts Models: More Capacity, More Scheduling Complexity
A mixture-of-experts, or MoE, architecture uses a router to select a subset of experts for each token. Experts are learned subnetworks; they do not inherently correspond to clearly defined human business roles.
A simplified parameter relationship is:
Total parameters ≈ Shared parameters + Number of experts × Parameters per expertActive parameters per token ≈ Shared parameters+ Selected experts per token × Parameters per expert
These expressions illustrate the principle rather than provide universal counting formulas. Actual models may have different configurations across layers, shared experts, or experts of different widths.
The main challenges include:
- Balancing routing so that a few experts do not become overloaded.
- Preventing communication between experts from becoming a bottleneck.
- Using sufficiently large batches to improve expert utilization.
- Avoiding underused experts or overly concentrated routing during training.
- Storing, distributing, and reading expert weights efficiently during deployment.
More experts do not automatically produce better results. Expert granularity, the number selected per token, training strategy, and hardware topology must be considered together.
5. How Much GPU Memory Do Model Weights Require?
Start with Weight Storage
The basic estimate is:
Weight storage ≈ Parameter count × Bytes per parameter
For example, a hypothetical 30-billion-parameter model stored at two bytes per parameter requires approximately 60 billion bytes for its weights alone: about 60 decimal gigabytes. The numerical value differs when expressed in binary capacity units.
Low-bit quantization can reduce the theoretical weight size. Actual storage may also include scaling factors, grouping metadata, alignment padding, and weights that remain unquantized.
Multiplying the parameter count by the bit width is therefore a starting estimate, not a complete device-memory requirement.
Inference Memory Includes More Than Weights
Total inference memory typically also includes:
- Key-value caches for previous tokens.
- Intermediate activations and temporary workspaces.
- Communication buffers for parallel execution.
- Runtime and scheduling overhead.
- Memory allocator reservations and fragmentation.
For MoE models, resident model memory cannot be calculated from active parameters alone. Experts not selected for the current token must still be stored somewhere. Tiered storage or on-demand loading introduces additional data-transfer and access-latency considerations.
Training Memory and Inference Memory Are Different
Training typically requires gradients, optimizer states, and activations needed for backpropagation, in addition to model weights.
The overhead depends on numerical precision, the optimizer, activation recomputation, and distributed sharding. An inference memory figure cannot be used directly to infer the resources required for full training.
6. Why Long Contexts Increase Costs
Longer Contexts Mean More Tokens to Process
Long contexts can accommodate more documents, conversation history, and code, but processing additional tokens is not free.
With standard global attention, the number of attention relationships grows quadratically with sequence length. Efficient implementations can reduce intermediate storage and data movement, but they do not automatically eliminate this growth in global attention computation.
During generation, accessing a longer history cache at every step also increases data-reading and computational demands.
What Determines KV Cache Size?
Autoregressive inference commonly stores keys and values for previous tokens so that it does not need to recompute all historical representations for every new token.
For a conventional attention-cache layout, an approximate estimate is:
KV cache bytes ≈ 2 × Number of layers× Total cached tokens× Number of KV heads× Head dimension× Bytes per element
Here:
- The factor of two accounts for keys and values.
- Total cached tokens must include all concurrent requests.
- Request lengths can differ; assuming equal lengths is not always valid.
- Specialized compression, cache sharing, and allocation granularity can change actual memory use.
This explains a common deployment problem: the weights fit on the device, but increasing concurrency or input length still causes out-of-memory failures.
Common Approaches to Reducing Cache Costs
Reducing the number of key-value heads allows multiple query heads to share keys and values, lowering cache usage.
Lower-precision cache storage can save additional memory, but its effects should be tested on long-text tasks, precise retrieval, and numerically sensitive workloads.
Local windows can limit how much history some layers access, potentially affecting long-range information exchange.
Compressed representations can reduce historical storage, but their effectiveness depends on the architecture, training method, and task.
All these approaches aim to reduce storage and access costs per historical token while keeping quality loss acceptable. They should not be treated as universally lossless switches that can be combined arbitrarily.
7. A Large Context Window Does Not Guarantee Strong Long-Document Understanding
Long-context capability has at least three distinct levels:
- Whether the system accepts the input.
- Whether the model accurately retrieves information from different positions.
- Whether the model integrates evidence across passages, reasons over it, and produces a verifiable answer.
These are not the same capability. A model may accept very long inputs yet degrade substantially when there is extensive distracting information, evidence is scattered, or answers require precise citations.
Long-context evaluation should therefore go beyond finding a single sentence. It should test:
- Relationships among multiple pieces of evidence.
- Conflicts between document versions.
- Whether the model avoids fabricating answers when information is missing.
- Joint analysis of conditions located in different parts of the input.
- Changes in quality and latency as input length increases.
For enterprise systems, retrieving and filtering relevant passages, compressing conversation history, and organizing inputs around the task are often more economical and easier to diagnose than filling the entire context window.
8. Evaluate Inference Performance in Two Stages
Prefill: Processing the Input
The input-processing stage reads prompt tokens and builds the cache. Much of this work can be parallelized.
Longer inputs generally increase processing costs. For document analysis, knowledge-based question answering, and multi-turn conversations, this stage can account for much of the wait before the first output token appears.
Decode: Generating Tokens Sequentially
The generation stage produces output incrementally, with each step depending on the previous result.
Performance can be limited by weight reads, cache access, device communication, and batch size. In some workloads, memory bandwidth matters more than peak compute capacity. In others, cross-device communication or computation itself is the primary bottleneck.
A useful performance report should include:
- Time to first token.
- Time between subsequent output tokens.
- End-to-end completion time.
- Total throughput under sustained concurrency.
- High-percentile latency and failure rates.
Claims about “generation speed” have limited engineering value without input lengths, output lengths, concurrency levels, and quality requirements.
9. A Practical Framework for Model Selection
Define the Task Before Chasing Parameter Counts
First determine whether the application involves information extraction, classification, open-ended question answering, code generation, or multi-step reasoning.
Structured extraction may depend heavily on instruction following and output consistency. Complex reasoning emphasizes correctness. Knowledge-based question answering also requires retrieval, citations, and access controls.
Different tasks respond differently to increases in model size.
Build a Test Set from Real Request Distributions
Include typical, difficult, and abnormal requests, and record their actual input and output lengths.
If most production requests are short but a small fraction are very long, evaluate them separately. This helps prevent a few long requests from slowing the experience for everyone.
Compare Quality and Resources on Consistent Terms
When comparing options, standardize:
- Hardware and concurrency conditions.
- Input and output length distributions.
- Weight and cache precision.
- Generation strategy.
- Quality criteria.
- Use of retrieval, caching, or additional reasoning steps.
A more useful measure than cost per token is the cost of a successfully completed task that meets quality and latency requirements.
Evaluate the Model as Part of the Complete System
Production services also depend on request queues, container platforms, object storage, logging, monitoring, and alerting.
When output is incorrect or a request fails, the system should make it possible to distinguish among:
- Incorrect retrieved content.
- Truncated input.
- Model reasoning failures.
- Invalid structured output.
- Scheduling timeouts.
Without this observability, switching to a larger model often fails to address the root cause.
10. Conclusion: Move Beyond Parameter Counts to a System-Level View
Four distinctions are central to understanding modern LLMs:
Total parameters are not active parameters. Active parameters are not actual runtime cost. Maximum context length is not effective comprehension length. Theoretical computational advantages are not guaranteed production performance.
Architecture determines how computation is organized. Parameter scale establishes the basic range of capacity and resource requirements. Caching mechanisms shape the pressures created by long contexts and concurrent requests. Training quality and task fit determine the eventual results.
For developers and enterprises, the reliable approach is not simply to seek the largest parameter count. It is to evaluate task quality, response latency, throughput, and resource cost together. Only by analyzing these factors within a common framework can teams select an LLM that genuinely fits their application.
