Modern Large Language Model Architectures and Parameter Scales Explained

    This article explains how modern large language models are structured, how dense and mixture-of-experts architectures differ, and why total parameters do not directly determine model quality or inference cost. It also covers tokenization, attention, training stages, context windows, reasoning capabilities, quantization, distributed deployment, resource estimation, and practical criteria for selecting and evaluating models.

    1. Why Understanding LLM Architecture Matters

    Large language models are not simply databases that store large amounts of text. They use neural networks to learn statistical relationships among words, sentences, code, and knowledge, and then predict what is likely to come next based on context. Modern models are generally built on the Transformer architecture, combined with larger parameter scales, more efficient training methods, longer context windows, and post-training techniques designed for reasoning tasks.

    When selecting a model, many people focus first on its parameter count. However, parameter size alone does not determine model quality. Training data, data-cleaning methods, network architecture, training stability, alignment techniques, inference strategies, and hardware optimization can all significantly affect the final results.

    A model should therefore be evaluated across several dimensions:

    1. What base architecture does it use?
    2. Do all parameters participate in computation, or are only some activated?
    3. How long is its supported context?
    4. Can it handle complex reasoning, tool use, and code generation?
    5. How much GPU memory, compute, and network bandwidth does inference require?
    6. Is it suitable for local deployment, private deployment, or cloud-based access?

    2. The Basic Structure of Modern Large Language Models

    2.1 Input Representation and Tokenization

    Models cannot process natural-language text directly. Text is first divided into discrete units that the model can recognize, commonly called tokens. A token may be a Chinese character, part of an English word, a punctuation mark, or several characters from a piece of code.

    Tokenizer design affects three important factors:

    • How many tokens are produced from the same text;
    • The effective context length the model can process;
    • Training and inference costs.

    For Chinese, English, code, and mixed-language text, different tokenization methods may have significantly different compression efficiency. More tokens generally mean higher computational costs for the same amount of text. Tokenization efficiency is therefore an important engineering consideration for long-document question answering, code analysis, and multilingual applications.

    2.2 Embeddings and Positional Encoding

    After tokenization, the model maps each token to a high-dimensional vector. This vector is not a fixed dictionary definition, but a trainable mathematical representation. After extensive training, words with similar meanings or usage patterns tend to develop relationships in the vector space.

    Because a Transformer does not inherently understand word order, positional information must also be added. Positional encoding indicates where a token appears in a sequence, allowing the model to distinguish between statements such as:

    • “The user modifies the configuration file.”
    • “The configuration file modifies the user.”

    Modern models commonly use rotary positional encoding or related improvements designed to support longer contexts. However, a longer context window does not mean the model can reliably understand every piece of information at any possible length. As the context grows, attention costs, memory usage, and information interference may also increase.

    2.3 Self-Attention

    Self-attention is the core mechanism of the Transformer architecture. It allows the model to reference other tokens in the context while processing the current token, helping it establish long-range dependencies.

    For example, in a software program, a function definition may appear dozens or hundreds of lines before its invocation. Self-attention can help the model connect the function call with its definition. In long documents, it can also link titles, paragraphs, conclusions, and citations.

    The computational complexity of traditional attention generally grows quadratically with sequence length. As the context expands, computational and memory pressure can increase rapidly. Engineering solutions commonly include:

    • More efficient attention implementations;
    • Key-value caching;
    • Grouped-query attention or multi-query attention;
    • Chunked processing for long text;
    • Sparse attention or sliding-window attention;
    • Compressing historical content into summaries or memory vectors.

    2.4 Feed-Forward Networks and Activation Functions

    Each Transformer layer typically also contains a feed-forward network. It further transforms the information aggregated by attention and applies nonlinear processing to the features.

    Feed-forward networks often contain large intermediate layers and therefore account for a substantial portion of model parameters. Many modern designs use gated structures that allow the model to select different feature-transformation paths based on the input. Compared with a single linear transformation, gated feed-forward networks generally provide stronger representational capacity, but they also introduce additional parameters and computation.

    2.5 Residual Connections and Normalization

    Deep models must address gradient propagation and training stability. Residual connections allow each layer to preserve part of the original information, reducing information loss in very deep networks. Normalization controls the distribution of intermediate activations and helps stabilize training.

    A complete Transformer layer can be abstracted as follows:

    1. Input
    2. ├─ Normalization
    3. ├─ Self-attention
    4. ├─ Residual connection
    5. ├─ Normalization
    6. ├─ Feed-forward network or mixture-of-experts network
    7. └─ Residual connection
    8. Output

    Different models may vary in the placement of normalization, activation functions, attention mechanisms, and feed-forward structures, but the overall design is broadly similar.

    3. How to Understand Parameter Scale

    3.1 Parameter Count Does Not Equal Capability

    Parameters are numerical values learned during training. A larger parameter count generally gives a model greater representational capacity, but the relationship is not absolute.

    A relatively small model trained on high-quality data with an effective methodology may outperform a much larger general-purpose model on a specific task. Conversely, a model trained on noisy data or inadequately post-trained may behave inconsistently despite having a large number of parameters.

    Model evaluation should also consider:

    • The coverage of the training data;
    • Data quality and deduplication methods;
    • The proportions of code and mathematical data;
    • Multilingual capability;
    • Instruction-following ability;
    • Complex reasoning performance;
    • Output consistency;
    • How the model handles errors and uncertainty.

    3.2 Dense Models

    Dense models are the easiest architecture to understand. Nearly all parameters participate in computation whenever the model processes an input.

    If a model has tens of billions of parameters, each token requires forward computation using weights on a similar scale. Dense models offer several advantages:

    • Relatively simple architecture;
    • More consistent inference behavior;
    • Easier deployment and performance evaluation;
    • Strong overall performance on general-purpose tasks.

    Their disadvantages include higher compute requirements and memory consumption. In high-concurrency scenarios, performance can be especially constrained by GPU memory capacity and bandwidth.

    3.3 Mixture-of-Experts Models

    Mixture-of-experts models divide part of the network into multiple “expert” modules. For each input, a router selects only a small number of experts to participate in computation.

    As a result, a model may have a very large total parameter count while activating relatively few parameters for each token. For example, a model may contain tens of billions of parameters or more but invoke only a subset of its experts for each token. Inference cost therefore does not necessarily increase in direct proportion to total parameter count.

    Key engineering questions for mixture-of-experts architectures include:

    • How the router selects experts;
    • How load is distributed among experts;
    • How expert overload is prevented;
    • How expert parameters are transferred across devices;
    • Whether communication overhead offsets the savings in computation.

    In distributed deployments, expert models generally require efficient communication between devices. If network bandwidth is insufficient, frequent exchange of expert data can reduce throughput.

    3.4 Total Parameters and Active Parameters

    When reading model documentation, distinguish between two concepts:

    • Total parameters: The number of all weights in the model;
    • Active parameters: The number of parameters actually used to process one token.

    For dense models, these figures are usually close. For mixture-of-experts models, they may differ substantially.

    Total parameters alone are therefore not enough to estimate inference cost. A more accurate evaluation should consider:

    1. Total parameter count;
    2. Active parameters per token;
    3. Number of layers and hidden dimension;
    4. Number of attention heads;
    5. Context length;
    6. Numerical precision;
    7. Whether cross-device communication is required.

    4. Training Stages and the Formation of Model Capabilities

    4.1 Pretraining

    Pretraining typically uses large amounts of text, code, and structured data to teach the model language patterns, knowledge associations, and basic reasoning patterns. The usual objective is to predict the next token based on the preceding context.

    Pretraining determines much of the model’s knowledge coverage and basic generation ability, but it does not guarantee that the model can follow user instructions accurately. A model that has only undergone pretraining may be able to continue text, yet fail to follow requests such as “list the steps,” “use a fixed format,” or “call a tool.”

    4.2 Instruction Tuning

    Instruction tuning uses question-and-answer examples, task examples, and formatting examples to teach the model how to interpret user intent and organize responses. Common training tasks include:

    • Question answering;
    • Summarization;
    • Translation;
    • Classification;
    • Information extraction;
    • Code generation;
    • Code repair;
    • Document rewriting;
    • Multi-turn conversation.

    Instruction tuning can significantly improve usability. However, training data that is too narrow may cause the model to behave rigidly in open-ended scenarios.

    4.3 Preference Optimization and Safety Training

    After instruction tuning, a model may undergo preference optimization to make its outputs more helpful, accurate, consistent, and aligned with safety requirements.

    This training may evaluate:

    • Whether the model actually answers the user’s question;
    • Whether the response contains irrelevant content;
    • Whether it invents facts;
    • Whether it follows formatting requirements;
    • Whether it can acknowledge uncertainty;
    • Whether it avoids generating high-risk content.

    Preference optimization cannot completely eliminate hallucinations. In professional applications, retrieval augmentation, tool use, result validation, and human review should still be used to reduce risk.

    5. Context Length and Reasoning Capability

    5.1 Context Windows

    A context window represents the number of tokens a model can receive and process in one operation. Longer windows are theoretically better suited to long documents, code repositories, meeting transcripts, and complex task chains.

    However, expanding the context introduces three major challenges:

    1. Higher computational costs;
    2. Greater memory consumption;
    3. The possibility that the model cannot focus equally on all information.

    Applications should therefore avoid simply inserting all available material into a single context. Chunked retrieval, hierarchical summarization, key-information extraction, and context compression are often more effective strategies.

    5.2 Reasoning-Oriented Models

    Some modern models receive additional optimization for mathematics, code, planning, and complex decision-making tasks. They may perform a longer internal reasoning process before producing a final answer, improving accuracy on difficult problems.

    These models commonly have the following characteristics:

    • They are not necessarily faster on simple questions;
    • Complex tasks require a larger compute budget;
    • Output quality depends on the ability to decompose problems;
    • Tools or external verification may be needed;
    • Reasoning should not be treated as equivalent to factual correctness.

    In enterprise applications, reasoning capabilities are useful for solution design, code analysis, data verification, and multi-step workflows. For real-time customer service or large-scale summarization, however, lower-latency models may provide better cost efficiency.

    6. Inference Deployment and Resource Estimation

    6.1 GPU Memory for Model Weights

    The storage required for model weights depends mainly on parameter count and numerical precision. Common formats include full precision, half precision, and lower-bit quantized formats.

    A simplified estimate for weight storage is:

    1. Weight storage ≈ Number of parameters × Bytes per parameter

    Lower-bit formats can significantly reduce weight storage, but may introduce accuracy loss. Actual deployment must also account for:

    • Attention key-value cache;
    • Temporary activations;
    • Runtime framework overhead;
    • Parallel communication buffers;
    • Memory used by batched requests;
    • Additional memory required by long contexts.

    For this reason, GPU memory should not be selected based only on the size of the model weights.

    6.2 Quantization

    Quantization converts high-precision weights into lower-bit representations. It can reduce memory consumption and memory-bandwidth pressure, allowing larger models to run on more limited hardware.

    Common approaches include:

    • Weight-only quantization;
    • Quantization of both weights and activations;
    • Per-layer quantization;
    • Per-channel quantization;
    • Mixed-precision quantization.

    Quantized models should be evaluated on real tasks, especially mathematics, code, long-text processing, and domain-specific terminology. Different tasks have different levels of sensitivity to precision loss.

    6.3 Parallelism and Serving

    Larger models often require deployment across multiple devices. Common parallelism strategies include:

    • Tensor parallelism: Splitting the computation of a single layer across multiple devices;
    • Pipeline parallelism: Assigning different network layers to different devices;
    • Data parallelism: Replicating the model to process different requests simultaneously;
    • Expert parallelism: Distributing different experts across different devices.

    Production serving also requires mechanisms such as dynamic batching, request queues, streaming output, timeout control, rate limiting, and monitoring alerts. For enterprise applications, reliability is often more important than the highest speed measured in a single test.

    7. How to Choose the Right Model Scale

    7.1 Small Models

    Small models are suitable for:

    • Simple classification;
    • Keyword extraction;
    • Short-text rewriting;
    • Lightweight customer service;
    • Deployment on edge or local devices;
    • Applications with very strict latency requirements.

    They offer low cost and fast response times, but are usually limited in complex reasoning, long-document understanding, and multi-step tasks.

    7.2 Medium-Sized Models

    Medium-sized models often provide a practical balance among quality, cost, and deployment complexity. They are suitable for:

    • Enterprise knowledge question answering;
    • Document analysis;
    • Code assistance;
    • Data extraction;
    • Content moderation;
    • Workflow automation.

    For many enterprise scenarios, choosing a thoroughly evaluated medium-sized model is more reasonable than pursuing the largest available model without sufficient testing.

    7.3 Large Models

    Large models are suitable for complex reasoning, cross-domain tasks, long-chain planning, and high-quality content generation. They also require more capable hardware, concurrency scheduling, and service budgets.

    A layered architecture can be used in practice:

    1. Simple requests → Lightweight model
    2. General requests → General-purpose model
    3. Complex requests → Large or reasoning model
    4. High-risk requests → Model generation + retrieval + tool validation + human review

    This routing strategy can reduce overall costs while preserving quality for critical tasks.

    8. Do Not Evaluate Models by Parameter Count Alone

    A model evaluation system should include the following metrics:

    1. Accuracy: Whether the answer is correct;
    2. Completeness: Whether it covers the key aspects of the question;
    3. Consistency: Whether repeated runs produce excessively different results;
    4. Latency: Time to first token and total response time;
    5. Throughput: The number of requests processed per unit of time;
    6. Cost: Per-request cost and high-concurrency operating cost;
    7. Context capability: Information retrieval performance in long documents;
    8. Safety: Whether the model produces non-compliant content;
    9. Maintainability: Whether it is easy to monitor, upgrade, and roll back;
    10. Integrability: Whether it works with existing enterprise systems and permission models.

    When deploying in a cloud environment such as Baidu AI Cloud, evaluation should also account for compute resources, object storage, logging, monitoring and alerting, message queues, and container platforms. A complete model service chain is often required. The model itself is only one part of an intelligent application; data processing, access control, service governance, and result auditing are equally important.

    9. Conclusion

    The Transformer remains the foundation of modern large language models, but their engineering form has evolved from simple dense networks into complex systems that may include mixture-of-experts architectures, long-context processing, low-bit quantization, reasoning enhancements, and multi-device parallelism.

    When analyzing model scale, distinguish between total parameters and active parameters. When assessing capability, consider training data, post-training methods, and task suitability together. When estimating deployment costs, account for weights, caches, numerical precision, concurrency, and communication overhead.

    For developers, the most reliable selection strategy is not to search for the model with the largest parameter count. Instead, build an evaluation system based on task complexity, latency requirements, data sensitivity, deployment environment, and budget. Use lightweight models for routine requests, general-purpose models for the main workflow, and reasoning models for difficult problems. Combined with retrieval, tool use, and result validation, this layered approach can produce LLM applications that are stable, controllable, and genuinely useful.