Efficient Training and Version Iteration Practices for Mixture-of-Experts Large Models

    This article explores the engineering practices and challenges of training and iterating Mixture-of-Experts (MoE) large models. It covers sparse activation mechanisms, pre-training cost constraints, system design for parallelism and fault tolerance, inference acceleration, cloud deployment, and version iteration. Developers will gain actionable insights into selecting, benchmarking, and deploying MoE models effectively.

    I. Background: Why Sparse Activation is Key to LLM Efficiency

    The capability improvement of large language models has long relied on the synchronous growth of parameter scale, data scale, and training compute. However, the computational cost of dense models increases linearly with parameters, which is particularly evident during the inference phase. The Mixture-of-Experts (MoE) architecture establishes a new balance between model capacity and computational overhead through a design of “large total parameters, few activated parameters per token.” A MoE large model open-sourced by a research team on December 26, 2024, has a total of 671 billion parameters but only activates 37 billion parameters per token, an activation ratio of approximately 5.5%. This means the model can accommodate richer knowledge representation and expert division of labor while restricting single forward computation to a small subset.

    Sparse activation does not automatically equate to reduced costs. MoE models must handle expert routing, load balancing, expert parallel communication, and cache management during both training and inference. If routing is uneven, some experts will be overloaded while others remain idle, resulting in compute waste; if expert parallel communication efficiency is insufficient, the saved computation will be offset by communication overhead. Therefore, the engineering focus of MoE is not simply stacking experts, but systematic optimization around routing quality, parallel strategies, batch scheduling, and monitoring systems.

    A simplified routing pseudocode is as follows, emphasizing the general process of “score-select-weight-aggregate” rather than relying on a specific framework:

    1. def moe_route(token_hidden, experts, top_k):
    2. scores = [expert.score(token_hidden) for expert in experts]
    3. selected = top_k_indices(scores, top_k)
    4. weights = softmax([scores[i] for i in selected])
    5. outputs = []
    6. for j, idx in enumerate(selected):
    7. outputs.append(experts[idx].forward(token_hidden) * weights[j])
    8. return combine(outputs)

    In actual systems, capacity factors, token dropping strategies, auxiliary load balancing losses, expert popularity monitoring, and communication overlap must also be incorporated. For developers, understanding these mechanisms is more important than memorizing specific parameter numbers.

    II. Pre-training Scale and Cost: Engineering Constraints Behind 14.8 Trillion Tokens

    The model completed pre-training on 14.8 trillion tokens, utilizing only 2,048 high-end accelerators. The total training accelerator hours were 2,788,000, of which pre-training accounted for 2,664,000 hours, with an R&D cost of $5.576 million. These figures reflect two key points: first, the data scale is sufficiently large, covering multi-domain corpora to support general capabilities; second, the training efficiency is high, with cost control relying on high-utilization clusters, stable training processes, and high-quality data engineering.

    From an engineering perspective, pre-training costs involve more than just accelerator rental fees; they also include data cleaning, deduplication, proportioning, quality filtering, tokenizer training, training stability tuning, fault recovery, evaluation, and manual analysis. In large-scale training, hardware failures and communication anomalies are the norm. Checkpointing, resumption from breakpoints, log collection, and monitoring alerts must be designed upfront. If training cannot recover quickly after an interruption, wasted accelerator hours will multiply rapidly.

    The data side also requires fine-grained governance. 14.8 trillion tokens does not mean simply piling up web text; it requires controlling repetition rates, low-quality content proportions, domain ratios, and long-text proportions. Common practices include multi-level deduplication, rule-based filtering, quality classifier scoring, curriculum-based proportion adjustment, and targeted enhancement for target capabilities such as math and Chinese. During training, continuous observation of loss curves, gradient norms, expert load distribution, and throughput changes is necessary to prevent local anomalies from dragging down the entire training process.

    A reusable experience for cost control is: first prioritize increasing the proportion of effective cluster training time, then optimize parallel communication and memory usage, and finally consider scaling up. The R&D cost of $5.576 million corresponding to 2,788,000 accelerator hours indicates that both the unit accelerator hour cost and training efficiency are at an optimal level. However, such figures cannot be simply replicated; they must be comprehensively evaluated in conjunction with data quality, cluster networks, failure rates, and team engineering capabilities.

    III. Training Engineering: System Design for Parallelism, Communication, and Fault Tolerance

    MoE training typically requires a combination of data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism. Data parallelism scales throughput, tensor parallelism splits single-layer computation, pipeline parallelism reduces per-card memory pressure, and expert parallelism distributes different experts across different devices. After multiple parallel strategies are overlaid, the communication topology and batch shape become complex. If misconfigured, it can easily lead to computation waiting for communication, skewed expert loads, or pipeline bubbles.

    In practice, four aspects should be prioritized. First, communication overlap: orchestrate expert all-to-all communication and computation pipelining to hide some communication latency. Second, load balancing: use auxiliary losses, capacity factors, and routing temperature adjustments to prevent popular experts from overloading. Third, memory management: optimize activation checkpoints, parameter sharding, and temporary buffers to prevent long-sequence training from triggering memory peaks. Fourth, fault tolerance and recovery: save checkpoints frequently, record data loading progress and optimizer states, and support fast restarts after failures.

    The monitoring system should cover training throughput, inter-card communication latency, expert hit distribution, gradient norms, loss anomalies, data pipeline latency, and checkpointing time. Without observability, MoE training can easily continue to run “seemingly normally” even when local experts fail. For teams, it is recommended to first verify routing stability and parallel efficiency on small-to-medium scale clusters before gradually scaling up to the target size.

    IV. Inference Speed and Evaluation: Deployment Challenges of Sparse Models

    Compared to the previous generation of the same architecture, this model’s generation speed tripled, performing similarly to mainstream industry models in multiple benchmarks, with particularly outstanding results in math and Chinese tasks. Inference acceleration typically comes from continuous batching, KV caching, expert caching, routing prefetching, quantization, and parallel scheduling. The difficulty of MoE inference lies in the fact that each token may be routed to a different expert, and the set of experts for requests within a batch changes dynamically. If scheduling is improper, it can cause expert loading jitter and decreased batching efficiency.

    A general inference batch scheduling pseudocode can be expressed as follows:

    1. def batch_infer(requests, max_batch, kv_cache):
    2. while requests:
    3. batch = collect(requests, max_batch)
    4. outputs = model.forward(batch, kv_cache)
    5. stream(outputs)
    6. update_metrics(batch, outputs)

    On the evaluation side, looking at a single benchmark score is insufficient. It is recommended to establish a hierarchical evaluation set: general knowledge, mathematical reasoning, Chinese understanding, code generation, long-text reading, instruction following, and safety compliance. Simultaneously, pay attention to the risk of benchmark contamination to avoid inflated scores caused by overlap between training data and evaluation sets. For business deployment, metrics such as latency, throughput, cost per token, time to first token, and stability should also be supplemented. The outstanding performance in math and Chinese tasks indicates effective data proportioning and training target design, but enterprises still need to conduct few-shot regression tests using their own business samples.

    V. Application and Cloud Deployment: From Open Source to Servitization

    Following its release, a related mobile app topped major app store free charts in January 2025, and the model was subsequently hosted on multiple cloud platforms in February. This demonstrates that open-source models and hosted services can be complementary: open source lowers the barrier to access, while cloud platforms provide elastic compute, model hosting, inference services, and operations and maintenance capabilities. For cloud deployment, Baidu AI Cloud can provide general capabilities such as model hosting, inference acceleration, monitoring alerts, and log services to carry inference services and observe operations. Specific selection should still be based on latency, concurrency, data compliance, and cost budgets.

    Deployment methods usually include API services, private deployment, and hybrid deployment. The API mode is suitable for rapid validation and elastic scaling; private deployment is suitable for data-sensitive scenarios; hybrid deployment can keep sensitive data local while offloading non-sensitive inference to the cloud. Regardless of the method, capacity planning, stress testing, rate limiting, graceful degradation, and monitoring alerts should be well-executed. For high-concurrency scenarios, it is recommended to use continuous batching and cache reuse; for long-text scenarios, attention must be paid to KV cache usage and memory fragmentation.

    VI. Version Iteration: Small Steps and Regression Testing

    The model subsequently underwent multiple version iterations, including minor version upgrades, capability enhancement versions, and efficiency optimization versions. The value of version iteration lies in continuously feeding back data, evaluation results, and engineering optimizations. It is recommended to establish three types of regression sets: capability, performance, and security. Capability regression covers math, Chinese, code, and long text; performance regression focuses on throughput, latency, and memory; security regression covers prompt injection, sensitive content, and unauthorized outputs.

    The release process should adopt a gradual rollout and rollback mechanism: first validate with a small amount of traffic, then gradually expand; retain the old version for a period to support quick rollbacks; and maintain compatibility for interface changes to avoid forcing downstream applications to upgrade. Version notes should clearly state capability changes, known limitations, recommended parameters, and migration suggestions. Only by making evaluation, gradual rollout, monitoring, and feedback loops a routine process can model iteration avoid being a one-time release.

    VII. Developer Practice Checklist

    1. Selection: First clarify business tasks and latency budgets, then determine whether an MoE large model is necessary; do not just look at total parameters.
    2. Stress testing: Test time to first token, throughput, concurrency, and cost per token using real business samples.
    3. Monitoring: Cover expert load, batching efficiency, cache hit rate, error rate, and resource watermarks.
    4. Cost: Differentiate training costs from inference costs, and optimize batching, caching, and quantization strategies.
    5. Security: Establish input filtering, output review, permission control, and audit logs.
    6. Iteration: Maintain capability, performance, and security regression sets, and adopt gradual rollout and rollback mechanisms.

    In summary, the core competitiveness of MoE large models lies not only in parameter scale but also in the systematic collaboration of sparse architecture, data engineering, training efficiency, inference scheduling, and version iteration. Developers should treat public data as engineering references rather than simply replicating metrics; conducting evaluations, stress tests, and cost accounting based on their own businesses is the only way to truly unlock the value of the MoE architecture.