Modern Large Language Model Architectures and Parameter Scaling: A Technical Deep Dive

    This article provides a technical overview of modern large language model (LLM) architecture and parameter scaling. It covers the dominance of Transformer-based decoder-only designs, self-attention and position encoding, parameter-count formulas and scale tiers, dense versus mixture-of-experts (MoE) models, pretraining and distributed training strategies, context-window extension, inference optimization such as quantization and speculative decoding, deployment and model-selection considerations, and emerging multimodal and agent trends. Readers will gain a structured understanding of how architecture, scale, training, and inference engineering interact in LLM design and deployment.

    1. Introduction: The Paradigm Shift of Large Language Models

    Modern large language models (LLMs) are built around the Transformer architecture and acquire general language understanding and generation capabilities through pretraining on massive text corpora. The introduction of self-attention enabled models to capture global dependencies when processing long sequences, overcoming the limitations of traditional recurrent neural networks in long-text modeling. Over the past few years, LLMs have grown from models with hundreds of millions of parameters to trillion-parameter scale. This progress is not merely a matter of stacking more compute; it also involves coordinated advances in architecture design, training strategy, and engineering optimization. Understanding the structural composition of LLMs and the principles behind parameter scaling is a prerequisite for model selection, inference deployment, and further development.

    2. Foundational Architecture: The Dominance of the Transformer

    2.1 Encoder-Decoder vs. Decoder-Only

    Modern LLMs almost universally adopt the Transformer architecture, but they differ in specific form. Early models, such as those for text translation, followed a symmetric encoder-decoder structure, where the encoder understands the input and the decoder generates the output. In contrast, current mainstream LLMs overwhelmingly use a decoder-only architecture, stacking all parameters on the decoder side and generating tokens autoregressively one by one. This design aligns more naturally with the directional nature of language modeling and shows stronger generalization in zero-shot and few-shot tasks.

    A typical decoder-only architecture includes multi-head self-attention sublayers, feed-forward network sublayers, layer normalization modules, and residual connections. In a GPT-style model, the core computation path is: input embedding → N Transformer decoder blocks → output projection to vocabulary dimension. Within each decoder block, self-attention establishes pairwise relationships among tokens, while the feed-forward network applies a nonlinear transformation to each token representation. These components are stacked alternately to form deep feature extraction capability.

    2.2 The Mathematical Essence of Attention

    The core formula for self-attention is:

    [
    \text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V
    ]

    Here, (Q), (K), and (V) are obtained by multiplying the input vectors with the corresponding weight matrices, and (d_k) is the dimension of the query vector. The scaling factor (\sqrt{d_k}) prevents excessively large inner products that could lead to vanishing gradients. Multi-head attention performs this computation in parallel multiple times, with each head focusing on a different feature subspace. The results are then concatenated and linearly projected, allowing the model to interpret semantic relationships from multiple perspectives.

    2.3 Position Encoding and Sequence Modeling

    Because self-attention itself has no inherent sense of order, position encoding must be introduced to inject absolute or relative positional information into tokens. Early absolute sinusoidal position encoding mapped positions to trigonometric functions with fixed frequencies. Modern models more often use learnable relative position encoding or rotary position encoding. Rotary position encoding implicitly incorporates relative position information into the inner-product computation of queries and keys through a rotation transformation. It demonstrates better extrapolation capability in long-sequence inference and has become a mainstream choice.

    3. Stepwise Jumps in Parameter Scale

    3.1 Parameter Composition and Scale Definition

    The parameter count of an LLM mainly consists of three parts: embedding-layer parameters (vocabulary size × hidden dimension), Transformer-layer parameters (attention weights and fully connected weights), and output-layer parameters (hidden dimension × vocabulary size). Transformer-layer parameters account for more than 90% of the total. When the hidden dimension is (d) and the number of layers is (L), the parameter count of a standard decoder-only model is approximately:

    [
    P \approx 12Ld^2 + 2Vd
    ]

    where (V) is the vocabulary size. This formula reveals the basic principle of model scaling: the most direct way to increase parameter count is to add more layers or enlarge the hidden dimension, but both lead to cubic growth in computation.

    3.2 From Billions to Trillions: The Scaling Path

    The industry commonly divides parameter scale into several typical tiers: billion-level (e.g., 1–10B), suitable for edge deployment and rapid iteration; tens-of-billions level (10–100B), with strong reasoning capability but significant memory pressure; hundreds-of-billions level (100B–1T), showing emergent capabilities and requiring multi-GPU parallel training; and trillion-level (>1T), which only a few leading teams can feasibly train.

    Each tier change is not merely numerical scaling. When model parameters cross the hundreds-of-billions threshold, training stability, memory management, and communication overhead undergo qualitative changes. For example, the intermediate activations of a hundreds-of-billions-parameter model may occupy tens of GB of memory, requiring a balance among activation recomputation, tensor parallelism, and pipeline parallelism.

    4. Architectural Divergence: Dense vs. Sparse

    4.1 Dense Models: Tight Coupling of Computation and Parameters

    Traditional Transformer models are dense architectures: every token activates all parameters in every layer. For a dense model with 70B parameters, one forward inference pass requires approximately 140 GFLOPs of floating-point computation, placing extremely high demands on single-GPU compute. Dense models have the advantages of simple implementation and stable training, but their disadvantage is low parameter utilization: for a specific task, often only a small subset of parameters actually contributes.

    4.2 Mixture of Experts: The Sparse-Activation Revolution

    Mixture of Experts (MoE) is a mainstream approach to addressing the compute bottleneck of dense models. Its core idea is to replace the traditional feed-forward network with multiple parallel expert subnetworks, while a router dynamically selects a subset of experts to participate in computation for the current token. A typical configuration such as “activate 2 experts out of 8” requires only one quarter of the theoretical computation of a dense model, while the parameter count can actually increase.

    The router computation usually uses a Softmax-normalized dot-product score:

    [
    G(x) = \text{Softmax}(x \cdot W_g)
    ]

    where (W_g) is the learnable routing weight matrix. For load balancing, modern MoE models also introduce auxiliary loss functions or expert capacity limits to prevent some experts from being overused while others remain idle.

    4.3 Engineering Costs and Optimization of MoE

    Although MoE significantly improves training and inference efficiency, it also introduces communication bottlenecks. Each token must send its intermediate representation to the selected experts. If experts are distributed across different GPUs, All-to-All communication is required. To address this, modern MoE systems make extensive optimizations in expert grouping strategies, memory layout, and communication scheduling, for example by combining expert parallelism with data parallelism.

    5. Training Strategy and Engineering Considerations

    5.1 Pretraining Data and Hyperparameters

    The pretraining corpora of modern LLMs often contain trillions of tokens, covering web pages, books, code, scientific papers, and other domains. Data quality directly determines the model ceiling and requires multiple stages such as cleaning, deduplication, language filtering, and toxicity filtering. On the hyperparameter side, learning rates typically follow a Warmup-Stable-Decay schedule, and batch size follows a linear scaling rule with model size.

    5.2 Mixed Precision and Distributed Training

    LLM training must rely on mixed-precision techniques: intermediate tensors are stored in BF16 or FP16, while an FP32 weight copy is retained for updates. In the distributed dimension, common parallelism strategies include:

    • Data parallelism: each GPU holds a full model replica and processes different data shards;
    • Tensor parallelism: matrix operations within a single Transformer layer are split across multiple GPUs;
    • Pipeline parallelism: the model is split by layers, with each GPU responsible for a consecutive set of layers.

    In practice, these three strategies are often combined. Together with the ZeRO optimizer, which further shards optimizer states, gradients, and parameters, training systems seek a trade-off between communication volume and memory usage.

    5.3 Extending the Context Window

    Modern LLMs generally support context windows of at least 32K tokens, and some newer models have extended this to 128K or even 200K. Extending the context window is not simply a matter of interpolating RoPE parameters. It also requires introducing long-sequence data during pretraining and using sliding-window attention or sparse attention during fine-tuning to reduce the quadratic computational complexity. At the same time, KV Cache memory during inference grows linearly with sequence length, requiring compression through paged KV Cache or KV quantization.

    6. Performance Optimization During Inference

    6.1 Quantization

    Model quantization reduces weights from FP16 to INT8 or INT4, significantly lowering memory usage and accelerating computation. Mainstream quantization approaches include post-training quantization (PTQ) and quantization-aware training (QAT). With INT4 quantization, for example, model size can be compressed by 4×. Combined with specialized low-bit matrix multiplication kernels, inference throughput can improve by 2–3×.

    6.2 Speculative Sampling and Parallel Decoding

    The token-by-token generation of autoregressive decoding leads to high inference latency. Speculative decoding uses a small draft model to quickly generate candidate token sequences, which are then verified by the large model. This can more than double decoding speed while preserving output quality. Another strategy is multi-token parallel prediction, which predicts multiple future tokens in a single forward pass. However, limited by training signals, its success rate on complex tasks remains limited.

    6.3 Serving Orchestration and Batching

    Online inference services often face dynamically arriving request streams. Continuous batching allows token-level computation to be dynamically interleaved across requests, significantly improving GPU utilization. Combined with preemptive scheduling and priority queues, it can maximize throughput while meeting latency SLAs.

    7. Deployment Paths for Industry Applications

    7.1 Model Selection and Cost Trade-offs

    When selecting an LLM, enterprises need to consider scenario complexity, requests per second (QPS), budget constraints, and other factors. Parameter count is not the only criterion. For simple tasks such as text classification or entity extraction, billion-level models are sufficient. For complex code generation, multi-turn dialogue, or long-document understanding, tens-of-billions or even hundreds-of-billions-level models may be required. More importantly, organizations should evaluate actual benchmark performance rather than blindly pursuing larger parameter counts.

    7.2 Adaptation and Deployment Paradigms

    Mainstream deployment routes fall into three categories: cloud API calls, private deployment, and edge inference. Cloud APIs lower the barrier to use and suit rapid prototyping. Private deployment ensures data security and suits finance and government scenarios; the key is choosing an appropriate deployment platform, with cloud providers offering options ranging from GPU bare metal to containerized elastic inference. Edge inference relies on quantization and pruning techniques and is suitable for mobile devices and edge scenarios.

    The next stage of LLMs will not be limited to the text modality. Fusion across vision, speech, video, code, and other modalities has become a clear trend. At the same time, the agent paradigm, centered on “reason-act-observe,” is reshaping application development. Models no longer only answer questions; they drive tool calls, code execution, and workflow orchestration. Some cloud platforms provide integrated support from model hosting to agent orchestration, greatly shortening the application deployment cycle.

    8. Future Outlook and Challenges

    LLM development still faces three major challenges. First, training and inference compute costs remain high, creating an urgent need for more efficient sparsification algorithms and hardware-software co-design. Second, hallucinations and factual errors limit adoption in heavily regulated scenarios, requiring retrieval-augmented generation (RAG) and tool-learning mechanisms. Third, context-length extension faces dual bottlenecks in attention complexity and KV Cache capacity; linear attention and state-space models are research directions worth watching.

    It is foreseeable that future LLMs will move toward “smaller but stronger” specialized routes. Through knowledge distillation, sparsification, and architecture search, models with tens of billions of parameters may approach the performance of hundreds-of-billions-level models in specific domains. This trend will help LLMs evolve from flagship luxury capabilities into inclusive foundational capabilities and a new type of infrastructure for the digital economy.

    9. Conclusion

    Understanding the structure and scale of LLMs is the starting point for mastering their capabilities. From the unified dominance of the Transformer architecture to the divergence between dense and MoE routes, and further to the engineering support provided by quantization and parallelism, every technical choice directly affects the performance ceiling and deployment efficiency of a model. Developers can make accurate decisions in a rapidly evolving ecosystem only by building systematic technical understanding. As cloud platforms continue to provide low-barrier model services and toolchains, the application boundary of LLM technology will widen further, injecting intelligent momentum into a wide range of industries.