Understanding Modern LLM Architecture and Parameter Scale: A Technical Overview

    This article breaks down the two core dimensions of modern large language models: architecture and parameter count. It compares the decoder-only, encoder-only, and encoder-decoder paradigms, walks through the five key components inside a Transformer decoder layer, and explains the trade-offs between dense and sparse (Mixture-of-Experts) designs. It also provides a common approximation formula for estimating parameter count, discusses how scale affects capability and its limits, and offers practical guidance for capacity planning and deployment.

    1. Why Architecture and Parameter Scale Are the Two Coordinates for Understanding LLMs

    When discussing modern large language models, two questions come up most often: which modules the model is actually assembled from, and what the parameter scale really means. The former determines the model’s capability boundaries and training stability, while the latter directly affects memory usage, throughput, latency, and overall cost. Nailing down these two coordinates gives us a shared language for later discussions about model selection, fine-tuning, quantization, and deployment.

    It is worth stressing that there is no single “standard architecture” in the industry. Different teams make engineering trade-offs on top of the same base paradigm, so this article only describes the general practices widely accepted in the industry and does not touch on any specific vendor’s implementation details.

    2. The Main Paradigms: Encoder-Only, Decoder-Only, and Encoder-Decoder

    • Decoder-only (autoregressive): Predicts the next token one token at a time with a causal mask. The training objective is simple and easy to scale, making it the mainstream choice for general-purpose dialogue and generation models today.
    • Encoder-only (masked language modeling): Good at understanding and classification. Bidirectional attention produces stronger contextual representations, but it is not natively good at long-form generation.
    • Encoder-decoder: The encoder handles understanding and the decoder handles generation, which suits sequence-to-sequence tasks such as translation and summarization. The structure is more complex, and parameter distribution must be balanced across both ends.

    The vast majority of general-purpose large models choose decoder-only. The reason is not that it is “smarter,” but that its training and inference engineering pipeline is more mature and scales better.

    3. Five Key Components Inside a Single Layer

    A typical Transformer decoder layer can be abstracted into the following pseudocode:

    1. # Pseudocode: illustrates the data flow only, not any specific implementation
    2. h = x + attn( norm_pre(x), mask=causal_mask ) # self-attention sublayer
    3. out = h + ffn( norm_pre(h) ) # feed-forward sublayer
    1. Normalization: Modern architectures generally adopt pre-normalization (Pre-Norm) for more stable training. Moving normalization from post to pre is an important prerequisite for stacking deep networks to dozens or even hundreds of layers.
    2. Attention: The core is scaled dot-product attention, combined with multi-head splitting to capture relationships across different subspaces. To reduce the overhead of long sequences, the industry often introduces key-value sharing ideas such as multi-query/grouped-query attention, as well as variants like sliding-window, sparse, or linear attention.
    3. Positional encoding: From absolute positions to rotary position embeddings, and then to various position interpolation and extrapolation schemes, the goal is to keep the same set of weights performing stably over longer contexts.
    4. Feed-forward network (FFN): Carries most of the parameter count, with the intermediate layer usually expanded by several times. Gated linear unit activations (such as the SwiGLU family) offer a better balance of effectiveness and efficiency and have become a common choice.
    5. Residual connections and initialization: Residual connections guarantee the gradient path, and combined with reasonable initialization and learning-rate warmup, they determine whether a deep network can converge.

    4. Dense vs. Sparse: Two Routes to Parameter Scale

    • Dense architecture: Every parameter participates in computation on every forward pass. Memory and compute overhead grow linearly with parameter count, inference cost is predictable, and engineering complexity is low.
    • Sparse architecture (Mixture of Experts): The total parameter count is very large, but each token only activates a few expert branches, decoupling “capacity” from “compute per pass.” The cost is uneven routing load, high memory usage, and more complex distributed communication.

    A commonly misunderstood point: a sparse model’s “total parameter count” is not equal to its “compute per inference pass.” When doing capacity planning, you must distinguish total parameters from activated parameters; otherwise, memory and throughput estimates will be seriously off.

    5. How to Estimate Parameter Scale

    For a decoder-only dense model, you can use a common industry approximation to quickly estimate:

    1. N ≈ 12 * L * d^2 # L is the number of layers, d is the hidden dimension

    Here, the attention and feed-forward parts contribute the main order of magnitude, and word embeddings and the output layer are also non-negligible with very large vocabularies. For example, doubling the hidden dimension makes the parameter count roughly four times larger; doubling the number of layers makes it roughly twice as large. This relationship explains why “widening” consumes more of the parameter budget than “deepening.”

    In engineering practice, you also need to add details such as vocabulary size, whether input and output embeddings are shared, and normalization and bias terms. The error is usually within an acceptable range, making it suitable for early capacity assessment.

    6. Capability Changes and Boundaries from Scale

    Increasing parameter scale usually brings more stable instruction following, stronger multi-step reasoning, and better cross-lingual transfer, but the gains are not linear. Data quality, training mix, context length, and post-training strategy are equally critical. The industry widely observes that “scale + high-quality data + sufficient training” are all indispensable; simply piling on parameters without enough data tends to produce memorization rather than generalization.

    7. Practical Recommendations for Implementation

    1. Do capacity budgeting first: Use the approximation above to estimate parameter count, then convert to memory and throughput based on precision (such as half precision or lower-bit quantization).
    2. Match the task shape first: For understanding tasks, consider bidirectional architectures; for generation and dialogue tasks, prioritize autoregressive architectures.
    3. Validate long context separately: Position extrapolation schemes vary noticeably across different lengths, so evaluate against the real lengths of your business.
    4. Bring sparse architectures online cautiously: Confirm that routing balance and communication overhead are under control before evaluating their cost advantages.
    5. Make good use of general cloud capabilities: Container platforms host inference services, object storage holds models and data, logging services and monitoring alerts handle observability, and message queues decouple asynchronous tasks, letting you focus your energy on the model and the business itself.

    8. Conclusion

    Understanding modern large language models is essentially understanding how architecture choices constrain capability and how parameter scale translates into cost. Once the main paradigm, the components inside a layer, the dense and sparse routes, and the parameter estimation method are clear, that is enough to support most technical selection and capacity planning discussions. From here, you can go deeper into dedicated topics such as attention variants, position extrapolation, and training stability.