Understanding Modern LLM Architectures and Parameter Scaling: A Technical Breakdown

    A practical guide to understanding modern large language models: how architecture types (decoder-only, dense, and MoE) differ, what parameter counts actually measure, how to estimate memory for inference and training, and how to evaluate model performance for real-world deployment.

    1. Three Questions to Separate Before Discussing Modern LLMs

    When discussing modern large language models, people often conflate three distinct questions: “What architecture does it use?”, “How many parameters does it have?”, and “How much compute does it actually need to run?” These are closely related, but they are not the same question.

    Architecture determines how information flows, how context interacts, and which network modules are invoked at each computation step. Parameter count describes the number of learnable values in the model. Runtime resources, meanwhile, are shaped by weight precision, input length, output length, concurrency, caching strategy, and deployment choices.

    A technically meaningful model description should therefore answer at least the following questions:

    • Is the model decoder-only, encoder–decoder, or some other architecture?
    • Does the feed-forward network use dense computation or sparse expert routing?
    • Do the published parameter counts refer to total parameters, active parameters, or a specific subcomponent?
    • How are queries, keys, and values organized in the attention module?
    • Do the parameter statistics include word embeddings, the output layer, and multimodal modules?
    • Under what context length, precision, and concurrency were inference resources measured?

    Without these conditions, comparing parameter numbers in isolation easily leads to wrong conclusions.

    2. The Basic Architecture of Mainstream Generative Models

    2.1 Decoder-only architecture: predicting the next token from context

    Modern autoregressive generative LLMs widely adopt the decoder-only architecture. The core objective is to predict the next token based on the tokens that have already appeared.

    A typical data path can be described as:

    Input text → tokenization → embedding vectors → multi-layer network computation → output probability distribution.

    Note that a “token” is not strictly equivalent to a character, word, or byte. Different tokenization rules produce different segmentation results, so the same piece of natural-language text may map to different numbers of tokens in different models.

    During training and generation, models typically apply causal attention masking: a given position can only use information from itself and earlier positions, and cannot directly read later positions. This keeps the training objective consistent with step-by-step generation.

    2.2 What a typical layer contains

    A common transformer layer mainly consists of the following modules:

    Attention module — responsible for exchanging information across positions. For example, when handling coreference, the model needs to link a pronoun to an entity earlier in the text.

    Feed-forward network — applies nonlinear transformations to the representation at each position; it accounts for a major share of parameters and computation. In sparse expert architectures, this component is typically replaced by multiple expert networks plus a routing mechanism.

    Normalization module — adjusts the numerical distribution of intermediate representations, which helps stabilize training. Where normalization is placed affects training stability and how signals propagate.

    Residual connections — add each module’s input to its transformed output, providing more direct paths for information and gradient flow in deep networks.

    Modern model advances, therefore, are not just “stacking more layers.” They also include improvements in attention organization, feed-forward network design, normalization placement, and positional encoding mechanisms.

    2.3 Not every task suits the same architecture

    Encoder-only architectures are generally better suited to representation learning, text classification, and semantic matching tasks. Encoder–decoder architectures separate input understanding from output generation, making them suitable for conditional generation from input to output.

    There are also hybrid architectures that combine attention, recurrent state, or other sequence-modeling mechanisms. These designs typically attempt to strike different balances between long-sequence handling, cache footprint, and computational efficiency.

    Note that capabilities like “supports conversation,” “can reason,” or “can invoke external tools” are behavioral or system-level descriptions — they cannot be directly equated with any specific underlying network architecture.

    3. Dense Models vs. Mixture-of-Experts Models

    3.1 Dense models: most core parameters participate in every computation

    The defining characteristic of a dense model is that, for every input position, the same core network modules in each layer are used.

    Their advantage is a regular computation path, relatively straightforward performance analysis, and more predictable deployment and tuning. However, under otherwise similar conditions, scaling up a model tends to increase both weight storage requirements and per-forward-pass computation.

    “Dense” here does not mean every parameter is accessed identically at every step. For example, word embeddings are typically looked up by input index rather than computed against the entire embedding matrix.

    3.2 Mixture-of-Experts: partially decoupling capacity from per-pass computation

    In a Mixture-of-Experts (MoE) architecture, some or all layers contain multiple expert networks, and a routing module selects a subset of them for each input position.

    The key value of this design: it increases total parameter capacity while controlling how many experts each position actually uses, so computation does not grow in lockstep with total parameters.

    Understanding this architecture requires distinguishing two metrics:

    • Total parameters: the sum of all parameters in the model, including experts not selected for the current input.
    • Active parameters: the parameters actually involved in computation when processing an input position, typically including shared modules plus the selected experts.

    For example, a hypothetical model might contain roughly 200 billion total parameters but activate only tens of billions per position. This example is purely to explain the statistical distinction and does not correspond to any specific product.

    3.3 Fewer active parameters does not necessarily mean lower resource requirements

    Sparse routing reduces part of the computation, but inactive experts still occupy storage. During deployment, the system typically still needs the full weights resident on the device cluster, or accessible through tiered storage and dynamic loading.

    In addition, expert architectures can introduce further overhead:

    • Routing decisions and input reshuffling;
    • Data exchange across devices;
    • Uneven expert load;
    • Reduced device utilization from small per-expert batch sizes;
    • Expert capacity limits and the associated scheduling strategies.

    So you cannot conclude that a sparse model and a dense model have the same latency, throughput, or deployment cost simply because their active parameter counts are similar.

    4. How to Actually Interpret Parameter Scale

    4.1 There is no single “modern standard” for parameter counts

    There is no single typical size for modern LLMs. Models built for local execution, specialized tasks, general chat, and complex generation can range from hundreds of millions to tens of billions, hundreds of billions, or beyond.

    Parameter count reflects one dimension of model capacity, but capability also depends on training data quality, training compute investment, architecture, optimization methods, and post-training pipelines.

    Therefore, “more parameters means better on all tasks” does not hold. A smaller model trained on high-quality domain data can outperform a larger general-purpose model on specific tasks.

    4.2 How structure affects parameter counts

    For common dense architectures, parameter counts can be understood with simplified formulas.

    Let the hidden dimension be h and the feed-forward intermediate dimension be m. In a standard multi-head attention setup where the query, key, and value projection dimensions all equal the hidden dimension, the four main projection matrices contain roughly:

    Attention projection parameters ≈ 4h²

    If the feed-forward network uses two linear transformations, its main parameters are approximately:

    Feed-forward parameters ≈ 2hm

    With a gated feed-forward structure, there is usually one additional input projection:

    Gated feed-forward parameters ≈ 3hm

    Total core network parameters can then be roughly expressed as:

    Core parameters ≈ number of layers × parameters per layer

    Beyond that, you should add parameters for word embeddings, the output layer, and other modules.

    These formulas are explanatory approximations only. Shared key-value projections, different head dimensions, weight tying, expert structures, and multimodal modules all change the actual results — do not apply them directly to every model.

    4.3 Vocabulary size and weight sharing also affect the statistics

    If the vocabulary size is V and the hidden dimension is h, the input embedding matrix contains roughly V × h parameters.

    When the output layer shares weights with the input embeddings, the parameter statistics differ from the non-shared case. For smaller models, vocabulary-related parameters can even account for a significant proportion.

    So when comparing models, check whether the parameter statistics include the output layer, vision encoder modules, audio modules, and other add-on components.

    5. Estimating GPU Memory from Parameter Count: Weights First, Then Runtime Overhead

    5.1 Weight storage is only the baseline

    Weight memory can be estimated with a simple formula:

    Weight storage bytes ≈ parameter count × bits per parameter ÷ 8

    Take a hypothetical dense model with 8 billion parameters:

    • At 16-bit storage, raw weights are roughly 16 billion bytes, i.e., 16 decimal GB;
    • At 8-bit storage, roughly 8 decimal GB;
    • At 4-bit storage, theoretically roughly 4 decimal GB.

    These numbers are not actual deployment memory. Low-bit representations usually require scale factors, group metadata, or other auxiliary information, and runtime execution may involve alignment, temporary buffers, and extra copies.

    5.2 What full inference memory includes

    A more practical estimate is:

    Inference memory ≈ weights + KV cache + intermediate activations + compute workspace + runtime overhead

    The KV cache stores part of the attention states for the already-processed context, avoiding recomputing all historical keys and values for every newly generated position.

    Under a common cache design, its footprint can be approximated as:

    Cache bytes ≈ 2 × layers × batch size × cache length × KV heads × head dimension × bytes per element

    The factor of 2 corresponds to keys and values. If the implementation uses cache quantization, windowed attention, cache compression, or different state representations, the calculation needs to be adjusted accordingly.

    This also explains why “the weights fit on the device” does not mean “long context and high concurrency will run stably.”

    5.3 Training memory cannot be estimated the same way as inference

    Beyond storing weights, training also requires gradients, intermediate activations, and optimizer states — sometimes with additional higher-precision weight copies.

    As a result, training resources are typically significantly higher than inference resources for a model of the same scale. Activation recomputation, state sharding, and various parallelism strategies can reduce per-device usage, but usually at the cost of extra computation or communication.

    6. Why Attention Mechanisms Drive Long-Context Costs

    6.1 Longer context does not mean just a little more attention computation

    In standard full attention, each position must establish relationships with all other visible positions. Attention computation during training or prompt prefill typically includes a component that grows with the square of sequence length.

    Efficient implementations can reduce explicit storage of intermediate results and data movement, but they cannot simply be understood as fundamentally eliminating the pairwise interaction computation of full attention.

    In the cached, step-by-step generation phase, a new position usually only needs to compute relationships between its current query and historical keys and values. At this stage, the cost of reading historical states per step in standard full attention grows with the existing context length.

    6.2 Shared KV heads reduce cache pressure

    Standard multi-head attention organizes separate queries, keys, and values for each head; grouped-query or shared-KV designs let multiple query heads reuse a smaller set of KV heads.

    This reduces KV cache size and relieves some memory access pressure. But there are trade-offs among compression ratio, representational capacity, and actual performance, which should be judged based on training results and deployment implementation.

    6.3 Advertised context window ≠ effective understanding length

    Being able to accept long inputs does not mean a model can reliably extract information at all positions, let alone correctly perform multi-step reasoning across the full text.

    Evaluating long-context capability should consider:

    • Retrieval accuracy at different positions;
    • Ability to connect evidence across multiple segments;
    • Handling of conflicting and distracting information;
    • Time-to-first-token under long inputs;
    • Cache growth and failure rates under concurrent load.

    Long context is both a model capability issue and a service capacity management issue.

    7. Performance Evaluation Is More Than Tokens Per Second

    Inference typically involves two phases.

    Prompt prefill processes the input and builds the initial state and cache. It is sensitive to input length and often directly affects time-to-first-token.

    Step-by-step decoding continuously generates new tokens. It is influenced by weight access, cache reads, batching, and inter-device communication.

    Production evaluation should therefore cover at least:

    • Time-to-first-token;
    • Per-step latency of subsequent outputs;
    • Single-request generation speed;
    • Overall throughput;
    • High-percentile latency;
    • Peak memory and memory growth trends;
    • Timeout and request failure rates;
    • Cost per task at a given quality target.

    Note that high throughput does not necessarily mean low latency. Increasing batch size improves resource utilization but may also increase queuing time. Each business should first define its service objectives, then choose scheduling strategies.

    8. A Model Selection Workflow for Developers

    Step 1: Define the task and acceptance criteria

    Translate “is the model good?” into measurable questions. For example, structured extraction should focus on field accuracy and format compliance; knowledge Q&A should focus on factual accuracy and evidence consistency; code generation should focus on test pass rates, not just fluency.

    Step 2: Establish your real input-length distribution

    Do not just record the longest input — also measure the proportion of typical, longer, and extreme inputs. Track output length separately, since it directly affects request duration and concurrent resource usage.

    Step 3: Verify architecture and parameter accounting

    Record whether the model is dense or sparse, total parameter count, active parameter count, deployment precision, and context settings. Mark any unpublished or unverifiable information explicitly as unknown — do not guess based on the model name or version number.

    Step 4: Validate quality before compressing and accelerating

    Establish a reliable quality baseline first, then evaluate low-bit quantization, cache optimization, or other acceleration techniques. Optimized models must be re-tested on critical tasks — otherwise you may only see memory savings while missing format errors, calculation errors, or degraded domain performance.

    Step 5: Load-test under target workloads

    Testing should approximate real business input lengths, concurrency levels, and output distributions, and observe stability under sustained operation. A few short, one-off test requests cannot represent long-term service performance.

    Step 6: Build a post-launch regression process

    Deployment is not the end. Changes to prompt templates, knowledge content, input distributions, or scheduling strategies can all affect results. Keep a stable evaluation set and continuously monitor quality, cost, and latency.

    9. Conclusion: Parameters Measure Capacity, Not Capability or Cost

    The most effective way to understand modern LLMs is not to memorize model names and parameter numbers, but to build three interlinked perspectives:

    Use network architecture to understand how information is processed, parameter accounting to understand model capacity, and real workloads to understand deployment cost.

    Dense vs. MoE determines different computation organization; total vs. active parameters describe different scale dimensions; context length, KV caching, and concurrency strategies together shape runtime resource requirements.

    For developers and enterprises, a reliable selection decision should ultimately rest on clear technical definitions, real-task evaluation, and load testing under target workloads — not on a single parameter leaderboard.