The Evolution of Open-Source LLM Architecture: From Dense Models to Sparse Expert Systems and Improved Training Methods

    This article explores the architectural evolution and training methodologies of open-source large language models (LLMs). It covers the foundations of dense model scaling, the critical role of data quality, the transition to mixture-of-experts (MoE) architectures, fine-grained and shared expert designs, engineering challenges in MoE systems, efficient attention mechanisms, and a practical framework for evaluating a model's technical route. The discussion emphasizes that modern LLM progress depends not only on parameter count but on the coordinated optimization of data, architecture, training strategy, and system engineering.

    1. Starting from Dense Models: The Foundation of Open-Source LLMs

    In recent years, the development of large language models has generally followed a clear technical path: first build dense models with a moderate parameter count, then expand model capability through improvements in data, compute, training strategies, and structural design. In dense models, every input token passes through nearly the entire network computation, and all model parameters participate in each forward pass. This structure is relatively straightforward to implement, offers good training stability, and is convenient for distributed parallelism.

    A representative class of open-source models has released versions with billions and tens of billions of parameters, with the primary goal of validating large-scale pretraining feasibility and achieving high performance on tasks such as general language understanding, knowledge QA, code generation, and mathematical reasoning. Their technical value lies not only in parameter count but also in systematic exploration of training recipes, data composition, and scaling laws.

    Scaling laws refer to the observation that model performance generally improves with increased model size, training data volume, and compute budget, but these factors do not scale in a simple linear manner. When model scale increases without sufficient training data quality, newly added parameters may not be fully utilized. If the data volume is too small, the model may suffer from repeated learning, overfitting, or insufficient knowledge coverage. If data quality is inconsistent, the model may pick up incorrect information, low-value expressions, and inconsistent formatting.

    Therefore, model training cannot be simplistically understood as “more parameters is better” or “more data is better.” Within a fixed compute budget, the following factors must be balanced carefully:

    1. Parameter scale: Determines the amount of knowledge and complex patterns the model can accommodate.
    2. Number of training tokens: Influences the model’s coverage of language rules, knowledge distribution, and task formats.
    3. Data quality: Includes accuracy, deduplication, structural completeness, and task relevance.
    4. Training stability: Includes learning rate, batch size, optimizer configuration, and parallel strategies.
    5. Downstream adaptability: Determines whether the base model can be further applied to dialogue, code, reasoning, and other scenarios.

    When high-quality data dominates, a limited compute budget should often be prioritized to increase the model’s effective capacity rather than endlessly pile up low-value data. This reasoning provides an important basis for subsequent model iterations: first determine the data recipe and hyperparameters through small-scale experiments, then launch more expensive large-scale training.

    2. Why Data Quality Affects Scaling Effects

    Pretraining data is not just a collection of text. For large language models, data quality directly affects the final knowledge structure, language style, and reasoning ability of the model.

    First, data needs deduplication. Excessive repeated web pages, mirrored documents, and templated content can waste compute and cause the model to over-memorize certain fixed expressions. Second, quality filtering is needed to remove obvious garbled text, advertisements, low-information-density pages, and incomplete texts. Third, different types of data must be kept at reasonable ratios—for example, encyclopedia knowledge, technical documents, written corpora, code, math problems, and multi-turn dialogue data all contribute differently to model capabilities.

    Data engineering typically involves several stages:

    • Collection and parsing: Convert web pages, documents, code, and structured content into trainable text.
    • Cleaning and filtering: Remove garbled characters, duplicate content, abnormal characters, and low-quality fragments.
    • Quality scoring: Use rule-based or classification models to assess text completeness and information density.
    • Sensitive content handling: Process content unsuitable for the training set according to training goals and compliance requirements.
    • Mixing and sampling: Set sampling ratios for different data sources based on target capabilities.
    • Validation and iteration: Use independent evaluation sets to determine whether data changes truly yield capability improvements.

    Note that data quality does not mean all text must be highly advanced knowledge. Simple, clear, well-formatted foundational texts are equally important for learning language regularities. The critical point is that the data distribution must align with model goals, and its practical value must be verifiable through evaluation.

    3. Mixture-of-Experts Architecture: Reducing Active Compute

    When model scale continues to grow, dense architectures face significant compute and memory pressure. Because every token must pass through all parameters, model size, inference latency, and compute cost increase simultaneously. The mixture-of-experts (MoE) architecture offers a different approach: retain a large total parameter count while activating only a fraction of parameters per token.

    In a typical MoE structure, the feed-forward network of standard Transformer modules is replaced with multiple expert networks, plus a router. The router selects several most suitable experts for the current token based on its representation. Thus, different tokens can follow different computation paths.

    For example, if a layer contains several experts and each token selects only a few of them for computation, the total parameter count can be large while the actual compute per token remains controlled. The main benefits of this mechanism include:

    • Reducing active computation while maintaining large model capacity;
    • Improving compute utilization per unit during training and inference;
    • Allowing different experts to gradually learn distinct language patterns;
    • Providing finer-grained division of labor for knowledge, code, math, and dialogue capabilities.

    However, MoE does not simply benefit from adding more experts. Router stability, expert load balance, and communication overhead all directly affect the final outcome.

    4. From Large Experts to Fine-Grained Experts

    Traditional MoE models typically use a small number of large experts—for example, selecting a few out of dozens of experts for computation. This design is simple but can introduce two problems.

    First, each large expert tends to learn multiple capabilities simultaneously, making the boundaries between experts unclear. Second, different experts may redundantly learn a large amount of common knowledge—such as basic grammar, common facts, and general language patterns—leading to low parameter utilization.

    A finer-grained design splits the original large experts into more, smaller experts and appropriately increases the number of experts selected per token. The core goal is not to make experts work in isolation but to establish division of labor along finer capability dimensions.

    For example, some experts may become more specialized in technical text, some in mathematical expressions, others in code structure or multilingual content. Because each expert has smaller capacity, its responsibilities converge to relatively clear ranges.

    Meanwhile, shared experts can be introduced. Shared experts execute computation for every token, carrying common abilities such as syntax, basic semantics, and general knowledge; specialized experts handle more distinctive patterns. This way, specialized experts do not need to repeatedly learn the same foundational knowledge, reducing parameter redundancy and improving expert specialization.

    This design can be summarized as:

    • Shared part: Learns foundational abilities needed by all inputs;
    • Specialized part: Learns domain-specific, task-specific, or expression-specific patterns;
    • Routing mechanism: Dynamically selects specialized experts based on token context;
    • Load control: Avoids over-calling a few experts and ensures stable training.

    5. Engineering Challenges in Mixture-of-Experts Models

    Although MoE structures reduce active compute, they do not necessarily make system implementation simpler. They typically introduce more complex communication and scheduling issues.

    1. Expert load imbalance

    If the router overly favors certain experts, some experts become overloaded while others receive almost no tasks. The former can become a system bottleneck, and the latter means parameters are not fully trained.

    Common improvements include adding load-balancing loss, limiting individual expert capacity, constraining routing outcomes, and monitoring expert call distributions during training.

    2. Inter-device communication overhead

    In distributed training, different experts may be deployed on different compute devices. Tokens in a batch are routed to the devices hosting their selected experts, computed, then aggregated back. If communication volume is too high, the theoretical compute savings may be offset by network transfer costs.

    Therefore, MoE systems require integrated design of data parallelism, model parallelism, and expert parallelism, while minimizing cross-device transfers.

    3. Training stability

    The router itself is a module that must be learned. If the routing distribution changes dramatically in early training, some experts may be undertrained or gradient instability may occur. In practice, initialization methods, routing constraints, and training schedules need to be carefully configured so that experts gradually form stable specializations.

    4. Inference deployment complexity

    Dense models have relatively fixed inference paths, while MoE models dynamically select experts based on input. This imposes higher demands on batching, caching, memory management, and service scheduling. Especially under concurrency, random expert communication triggered by different requests must be avoided.

    6. More Efficient Attention Mechanisms

    Beyond MoE, large models also need to optimize the attention module. Standard multi-head attention stores large key and value caches for each attention head. As context length grows, cache usage increases rapidly, becoming a major bottleneck for long-text inference.

    A common improvement is to use latent representation compression: map the larger key-value information into a more compact latent space, then use it for subsequent attention computation. The goal is to reduce cache size and memory access while preserving expressive power as much as possible.

    The value of such methods is mainly reflected in:

    • Reducing memory usage during long-context inference;
    • Reducing key-value cache storage pressure;
    • Improving batch inference capability;
    • Improving service efficiency in high-concurrency scenarios.

    It should be emphasized that attention compression is not simply about reducing dimensions. It requires balancing information retention, expressive capability, and computational efficiency. Over-compression may lose long-range dependency information, while under-compression yields little engineering benefit.

    7. How to Evaluate a Large Model Technical Route

    Evaluating large models should not rely solely on parameter count or single-leaderboard results. A more complete indicator system is needed.

    First, examine base capabilities, including language understanding, knowledge QA, long-text processing, and multilingual ability. Second, examine reasoning abilities, including math, logic, and complex task decomposition. Third, examine code capability, including code completion, error analysis, and cross-file understanding. Fourth, examine efficiency, including training cost, inference throughput, memory usage, and deployment complexity. Fifth, examine stability, including output consistency under different prompt styles and service reliability during long-running operation.

    From a technical-route perspective, dense models are suitable for scenarios requiring simple structure and clear deployment. MoE models are more appropriate for tasks demanding large capacity and high compute efficiency. Efficient attention mechanisms are especially important for long-context and high-concurrency services.

    Overall, the development of this model class reflects an important trend: competition in large models is no longer just about parameter count, but about the integrated competition of data quality, architecture design, training strategy, and system engineering capabilities. High-quality data determines what the model can learn, scaling strategy determines how compute is invested, MoE determines how parameters are efficiently activated, and attention optimization determines whether the model can handle longer and more complex contexts at lower cost. Only by coordinating these components can we build open-source large language models that truly balance capability, efficiency, and deployability.